Compare commits
1 Commits
master
...
feature/pa
Author | SHA1 | Date |
---|---|---|
|
b5ef3befb4 |
Binary file not shown.
After Width: | Height: | Size: 9.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
|
@ -0,0 +1,53 @@
|
|||
import 'package:bloc/bloc.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
import '../../../../../model/passo/assessment_level.dart';
|
||||
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||
|
||||
part 'assessment_level_event.dart';
|
||||
part 'assessment_level_state.dart';
|
||||
|
||||
class AssessmentLevelBloc extends Bloc<AssessmentLevelEvent, AssessmentLevelState> {
|
||||
AssessmentLevelBloc() : super(AssessmentLevelInitial()) {
|
||||
List<AssessmentLevel> assLevel = [];
|
||||
on<LoadAssessmentLevel>((event, emit) async {
|
||||
assLevel = await SQLServices.instance.readAllAssessmentLevels();
|
||||
|
||||
emit(AssessmentLevelLoaded(assLevel: assLevel));
|
||||
});
|
||||
// on<AssessmentLevelSyncToDevice>((event, emit) async {
|
||||
// try {
|
||||
// final result =
|
||||
// await AssessmentLevelAdminApiServices.instance.fetch();
|
||||
|
||||
// // Assuming result is a List of JSON objects, convert them to City objects.
|
||||
// final cities =
|
||||
// result.map((json) => City.fromJson(json)).toList();
|
||||
|
||||
// // Loop through the list of City objects and insert them into the local database.
|
||||
// for (City city in cities) {
|
||||
// print(city.cityDescription);
|
||||
// print(city.cityCode);
|
||||
// await SQLServices.instance.createAssessmentLevel(city);
|
||||
// }
|
||||
// } catch (e) {
|
||||
// // Handle any errors that might occur during the API call or database insertion.
|
||||
// print("Error: $e");
|
||||
// }
|
||||
|
||||
// // emit(const LoadAssessmentLevel());
|
||||
// });
|
||||
on<AddAssessmentLevel>((event, emit) async {
|
||||
await SQLServices.instance.createAssessmentLevel(
|
||||
AssessmentLevel(
|
||||
id: event.id,
|
||||
classificationId: event.classificationId,
|
||||
over: event.over,
|
||||
notOver: event.notOver,
|
||||
assessmentLevels: event.assessmentLevels,
|
||||
genCode: event.genCode
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
part of 'assessment_level_bloc.dart';
|
||||
|
||||
class AssessmentLevelEvent extends Equatable {
|
||||
const AssessmentLevelEvent();
|
||||
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class AddAssessmentLevel extends AssessmentLevelEvent {
|
||||
final int id;
|
||||
final int classificationId;
|
||||
final String over;
|
||||
final String notOver;
|
||||
final String assessmentLevels;
|
||||
final String genCode;
|
||||
|
||||
const AddAssessmentLevel({
|
||||
required this.id,
|
||||
required this.classificationId,
|
||||
required this.over,
|
||||
required this.notOver,
|
||||
required this.assessmentLevels,
|
||||
required this.genCode,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object> get props => [
|
||||
id,
|
||||
classificationId,
|
||||
over,
|
||||
notOver,
|
||||
assessmentLevels,
|
||||
genCode,
|
||||
];
|
||||
}
|
||||
|
||||
class LoadAssessmentLevel extends AssessmentLevelEvent {
|
||||
const LoadAssessmentLevel();
|
||||
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class AssessmentLevelSyncToDevice extends AssessmentLevelEvent {
|
||||
const AssessmentLevelSyncToDevice();
|
||||
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
part of 'assessment_level_bloc.dart';
|
||||
|
||||
class AssessmentLevelState extends Equatable {
|
||||
const AssessmentLevelState();
|
||||
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class AssessmentLevelInitial extends AssessmentLevelState {}
|
||||
|
||||
class AssessmentLevelLoaded extends AssessmentLevelState {
|
||||
final List<AssessmentLevel> assLevel;
|
||||
|
||||
const AssessmentLevelLoaded({required this.assLevel});
|
||||
@override
|
||||
List<Object> get props => [assLevel];
|
||||
}
|
|
@ -1,7 +1,9 @@
|
|||
import 'package:bloc/bloc.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:unit2/model/passo/property_assessment.dart';
|
||||
|
||||
import 'package:unit2/sevices/passo/building/property_assessment_services.dart';
|
||||
import 'package:http/http.dart';
|
||||
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||
|
||||
part 'bldg_assessment_offline_event.dart';
|
||||
|
@ -65,6 +67,13 @@ class BldgAssessmentOfflineBloc
|
|||
});
|
||||
on<UpdateBldgAssessment>((event, emit) async {
|
||||
await SQLServices.instance.updateAssessment(event.id, event.assessment);
|
||||
// final tempID = await SharedPreferences.getInstance();
|
||||
// final tempID2 = tempID.getInt('tempid')! - 1;
|
||||
Response response = (await PropertyAssessmentServices.instance
|
||||
.updateEdit(event.assessment, event.id))!;
|
||||
print('assessment');
|
||||
print(response.statusCode);
|
||||
print(response.body);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,8 @@ import 'package:bloc/bloc.dart';
|
|||
import 'package:equatable/equatable.dart';
|
||||
import 'package:unit2/model/passo/general_description.dart';
|
||||
import 'package:unit2/sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||
|
||||
import 'package:unit2/sevices/passo/building/general_description_services.dart';
|
||||
import 'package:http/http.dart';
|
||||
import '../../../../../sevices/offline/offline_passo/building/property_owner_info_service.dart';
|
||||
|
||||
part 'general_description_event.dart';
|
||||
|
@ -60,6 +61,16 @@ class GeneralDescriptionBloc
|
|||
on<UpdateGeneralDescription>((event, emit) async {
|
||||
await SQLServices.instance
|
||||
.updateGeneralDescription(event.id, event.gendesc);
|
||||
emit(GeneralDescriptionLoading());
|
||||
final state = this.state;
|
||||
try {
|
||||
Response response = (await GeneralDescriptionServices.instance
|
||||
.update(event.gendesc, event.gendesc.id))!;
|
||||
print('property_info');
|
||||
print(response.body);
|
||||
} catch (e) {
|
||||
emit(const GeneralDescriptionErrorState(errorMessage: ''));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ class UpdateGeneralDescription extends GeneralDescriptionEvent {
|
|||
final GeneralDesc gendesc;
|
||||
final int id;
|
||||
|
||||
UpdateGeneralDescription({required this.id, required this.gendesc});
|
||||
const UpdateGeneralDescription({required this.id, required this.gendesc});
|
||||
|
||||
@override
|
||||
List<Object> get props => [id, gendesc];
|
||||
|
|
|
@ -12,6 +12,11 @@ class GeneralDescriptionInitial extends GeneralDescriptionState {
|
|||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class GeneralDescriptionLoading extends GeneralDescriptionState {
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class LocationLoaded extends GeneralDescriptionState {
|
||||
final List<GeneralDesc> gendesc;
|
||||
|
||||
|
@ -27,3 +32,10 @@ class SpecificGeneralDescriptionLoaded extends GeneralDescriptionState {
|
|||
@override
|
||||
List<Object> get props => [gendesc];
|
||||
}
|
||||
|
||||
class GeneralDescriptionErrorState extends GeneralDescriptionState {
|
||||
final String errorMessage;
|
||||
const GeneralDescriptionErrorState({required this.errorMessage});
|
||||
@override
|
||||
List<Object> get props => [errorMessage];
|
||||
}
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
import 'package:bloc/bloc.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:unit2/sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||
import 'package:unit2/sevices/passo/building/landref_services.dart';
|
||||
|
||||
import '../../../../../model/passo/land_ref.dart';
|
||||
import '../../../../../model/passo/todo.dart';
|
||||
import '../../../../../sevices/offline/offline_passo/building/property_owner_info_service.dart';
|
||||
|
||||
import 'package:http/http.dart';
|
||||
part 'landref_location_event.dart';
|
||||
part 'landref_location_state.dart';
|
||||
|
||||
|
@ -73,6 +74,17 @@ class LandrefLocationBloc
|
|||
|
||||
on<UpdateBldgLandRef>((event, emit) async {
|
||||
await SQLServices.instance.updateLandRef(event.id, event.landRef);
|
||||
|
||||
emit(LandrefLoading());
|
||||
final state = this.state;
|
||||
try {
|
||||
Response response = (await LandRefServices.instance
|
||||
.update(event.landRef, event.landRef.id))!;
|
||||
print('property_info');
|
||||
print(response.body);
|
||||
} catch (e) {
|
||||
emit(LandRefErrorState(errorMessage: e.toString()));
|
||||
}
|
||||
});
|
||||
|
||||
// on<DeleteTodo>((event, emit) async {
|
||||
|
|
|
@ -62,7 +62,7 @@ class UpdateBldgLandRef extends LandrefLocationEvent {
|
|||
final LandRef landRef;
|
||||
final int id;
|
||||
|
||||
UpdateBldgLandRef({required this.id, required this.landRef});
|
||||
const UpdateBldgLandRef({required this.id, required this.landRef});
|
||||
|
||||
@override
|
||||
List<Object> get props => [id, landRef];
|
||||
|
|
|
@ -12,6 +12,11 @@ class LandrefInitial extends LandrefLocationState {
|
|||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class LandrefLoading extends LandrefLocationState {
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class LandrefLoaded extends LandrefLocationState {
|
||||
final List<LandRef> landref;
|
||||
|
||||
|
@ -27,3 +32,10 @@ class SpecificLandrefLoaded extends LandrefLocationState {
|
|||
@override
|
||||
List<Object> get props => [landref];
|
||||
}
|
||||
|
||||
class LandRefErrorState extends LandrefLocationState {
|
||||
final String errorMessage;
|
||||
const LandRefErrorState({required this.errorMessage});
|
||||
@override
|
||||
List<Object> get props => [errorMessage];
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import 'package:bloc/bloc.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:unit2/sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||
import 'package:unit2/sevices/passo/building/location_landref_services.dart';
|
||||
|
||||
import '../../../../../model/passo/bldg_loc.dart';
|
||||
|
||||
import 'package:http/http.dart';
|
||||
part 'location_event.dart';
|
||||
part 'location_state.dart';
|
||||
|
||||
|
@ -43,6 +44,17 @@ class LocationBloc extends Bloc<LocationEvent, LocationState> {
|
|||
});
|
||||
on<UpdateBldgLoc>((event, emit) async {
|
||||
await SQLServices.instance.updateLocation(event.id, event.bldgLoc);
|
||||
|
||||
emit(LocationLoading());
|
||||
final state = this.state;
|
||||
try {
|
||||
Response response = (await LocationLandrefServices.instance
|
||||
.update(event.bldgLoc, event.bldgLoc.id))!;
|
||||
print('property_info');
|
||||
print(response.body);
|
||||
} catch (e) {
|
||||
emit(LocationErrorState(errorMessage: e.toString()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,3 +27,15 @@ class SpecificLocationLoaded extends LocationState {
|
|||
@override
|
||||
List<Object> get props => [location];
|
||||
}
|
||||
|
||||
class LocationLoading extends LocationState {
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class LocationErrorState extends LocationState {
|
||||
final String errorMessage;
|
||||
const LocationErrorState({required this.errorMessage});
|
||||
@override
|
||||
List<Object> get props => [errorMessage];
|
||||
}
|
||||
|
|
|
@ -4,9 +4,13 @@ import 'dart:io';
|
|||
import 'package:bloc/bloc.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:unit2/model/passo/esignature.dart';
|
||||
import 'package:unit2/model/passo/floor_sketch.dart';
|
||||
import 'package:unit2/model/passo/sworn_statement.dart';
|
||||
import 'package:unit2/sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||
import 'package:unit2/sevices/passo/building/building_services.dart';
|
||||
import 'package:unit2/sevices/passo/building/property_info_services.dart';
|
||||
import 'package:unit2/utils/global.dart';
|
||||
import 'package:unit2/utils/text_container.dart';
|
||||
import '../../../../../model/offline/offline_profile.dart';
|
||||
import '../../../../../model/passo/additional_items.dart';
|
||||
import '../../../../../model/passo/bldg_loc.dart';
|
||||
|
@ -17,13 +21,13 @@ import '../../../../../model/passo/property_assessment.dart';
|
|||
import '../../../../../model/passo/property_info.dart';
|
||||
import '../../../../../model/passo/structureMaterial.dart';
|
||||
import '../../../../../model/passo/todo.dart';
|
||||
import '../../../../../model/profile/basic_information/primary-information.dart';
|
||||
import '../../../../../sevices/offline/offline_passo/building/property_owner_info_service.dart';
|
||||
import '../../../../../model/passo/valid_ids.dart';
|
||||
import 'package:http/http.dart';
|
||||
|
||||
import 'package:path/path.dart';
|
||||
// as http;
|
||||
|
||||
import '../../../../../utils/passo/post_request.dart';
|
||||
import '../../../../../utils/urls.dart';
|
||||
part 'crud_event.dart';
|
||||
part 'crud_state.dart';
|
||||
|
@ -55,7 +59,9 @@ class CrudBloc extends Bloc<CrudEvent, CrudState> {
|
|||
assessedByName: event.assessedByName,
|
||||
dateCreated: event.dateCreated,
|
||||
dateModified: event.dateModified,
|
||||
genCode: event.genCode),
|
||||
genCode: event.genCode,
|
||||
citizenship: event.citizenship,
|
||||
civilStatus: event.civilStatus),
|
||||
);
|
||||
|
||||
propertyOwner.add(ownerInfo);
|
||||
|
@ -73,11 +79,22 @@ class CrudBloc extends Bloc<CrudEvent, CrudState> {
|
|||
|
||||
on<UpdatePropertyOwnerInfo>((event, emit) async {
|
||||
await SQLServices.instance.updateBldgOwner(event.id, event.propertyInfo);
|
||||
emit(PropertyOwnerInfoLoading());
|
||||
final state = this.state;
|
||||
try {
|
||||
Response response = (await PropertyInfoService.instance
|
||||
.update(event.propertyInfo, event.propertyInfo.id))!;
|
||||
print('property_info');
|
||||
print(response.body);
|
||||
} catch (e) {
|
||||
emit(PropertyOwnerInfoErrorState(errorMessage: ''));
|
||||
}
|
||||
});
|
||||
|
||||
on<FetchTodos>((event, emit) async {
|
||||
emit(PropertyOwnerInfoLoading());
|
||||
propertyOwner = await SQLServices.instance.readAllBldgOwner();
|
||||
|
||||
emit(PropertyInfoLoaded(propertyInfos: propertyOwner));
|
||||
});
|
||||
|
||||
|
@ -106,19 +123,21 @@ class CrudBloc extends Bloc<CrudEvent, CrudState> {
|
|||
UploadBuildingFaas event, PropertyInfo infos) async {
|
||||
// Fetch data
|
||||
List<Map<String, dynamic>> genDesc =
|
||||
await SQLServices.instance.getGeneralDescription(infos.id);
|
||||
await SQLServices.instance.getGeneralDescription(infos.id!);
|
||||
List<Map<String, dynamic>> loc =
|
||||
await SQLServices.instance.getLocation(infos.id);
|
||||
await SQLServices.instance.getLocation(infos.id!);
|
||||
List<Map<String, dynamic>> landRef =
|
||||
await SQLServices.instance.getLandRef(infos.id);
|
||||
await SQLServices.instance.getLandRef(infos.id!);
|
||||
List<Map<String, dynamic>> assessment =
|
||||
await SQLServices.instance.getBldgAssessment(infos.id);
|
||||
await SQLServices.instance.getBldgAssessment(infos.id!);
|
||||
List<Map<String, dynamic>> strucMat =
|
||||
await SQLServices.instance.getStructuralMaterials(infos.id);
|
||||
await SQLServices.instance.getStructuralMaterials(infos.id!);
|
||||
List<Map<String, dynamic>> addItems =
|
||||
await SQLServices.instance.getAdditionalItems(infos.id);
|
||||
await SQLServices.instance.getAdditionalItems(infos.id!);
|
||||
List<Map<String, dynamic>> bldgStructure =
|
||||
await SQLServices.instance.getBuildingAndStructure(infos.id);
|
||||
await SQLServices.instance.getBuildingAndStructure(infos.id!);
|
||||
List<Map<String, dynamic>> swornStatement =
|
||||
await SQLServices.instance.getSwornStatement(infos.id!);
|
||||
|
||||
// Parse data
|
||||
GeneralDesc firstGenDesc = GeneralDesc.fromJson2(genDesc.first);
|
||||
|
@ -128,15 +147,20 @@ class CrudBloc extends Bloc<CrudEvent, CrudState> {
|
|||
PropertyAssessment.fromJson2(assessment.first);
|
||||
StructureMaterials firstStructMat =
|
||||
StructureMaterials.fromJson2(strucMat.first);
|
||||
SwornStatement firstSwornStatement =
|
||||
SwornStatement.fromJson2(swornStatement.first);
|
||||
|
||||
print(swornStatement.toString());
|
||||
|
||||
// Prepare details
|
||||
DateTime dateIssued = DateTime.parse(firstGenDesc.dateIssued!);
|
||||
final details = {
|
||||
"assessed_by_id": event.offlineProfile.id.toString(),
|
||||
"assessed_by_name": event.offlineProfile.firstName,
|
||||
"assessed_by_name": 'event.offlineProfile.firstName',
|
||||
"date_created": "{{currentTimestamp}}",
|
||||
"date_modified": "{{currentTimestamp}}",
|
||||
"trans_code": '08887',
|
||||
"date_sync": "{{currentTimestamp}}",
|
||||
"trans_code": infos.transCode,
|
||||
"tdn": infos.tdn,
|
||||
"pin": infos.pin,
|
||||
"fname": infos.fname,
|
||||
|
@ -152,8 +176,11 @@ class CrudBloc extends Bloc<CrudEvent, CrudState> {
|
|||
"admin_tin": infos.adminTin,
|
||||
"faas_type": infos.faasType,
|
||||
"gen_code": "5TH",
|
||||
"citizenship": infos.citizenship,
|
||||
"civil_status": infos.civilStatus,
|
||||
"bldgappr_location.date_created": "{{currentTimestamp}}",
|
||||
"bldgappr_location.date_modified": "{{currentTimestamp}}",
|
||||
"bldgappr_location.date_sync": "{{currentTimestamp}}",
|
||||
"bldgappr_location.street": firstLoc.street,
|
||||
"bldgappr_location.barangay": firstLoc.barangay,
|
||||
"bldgappr_location.municipality": firstLoc.municipality,
|
||||
|
@ -161,6 +188,7 @@ class CrudBloc extends Bloc<CrudEvent, CrudState> {
|
|||
"bldgappr_location.gen_code": "5TH",
|
||||
"bldgappr_landref.date_created": "{{currentTimestamp}}",
|
||||
"bldgappr_landref.date_modified": "{{currentTimestamp}}",
|
||||
"bldgappr_landref.date_sync": "{{currentTimestamp}}",
|
||||
"bldgappr_landref.owner": firstLandRef.owner,
|
||||
"bldgappr_landref.cloa_no": firstLandRef.cloaNo,
|
||||
"bldgappr_landref.lot_no": firstLandRef.lotNo,
|
||||
|
@ -171,6 +199,7 @@ class CrudBloc extends Bloc<CrudEvent, CrudState> {
|
|||
"bldgappr_landref.gen_code": "5TH",
|
||||
"bldgappr_generaldesc.date_created": "{{currentTimestamp}}",
|
||||
"bldgappr_generaldesc.date_modified": "{{currentTimestamp}}",
|
||||
"bldgappr_generaldesc.date_sync": "{{currentTimestamp}}",
|
||||
"bldgappr_generaldesc.bldg_kind": firstGenDesc.bldgKind,
|
||||
"bldgappr_generaldesc.struc_type": firstGenDesc.strucType,
|
||||
"bldgappr_generaldesc.bldg_permit": firstGenDesc.bldgPermit,
|
||||
|
@ -198,6 +227,7 @@ class CrudBloc extends Bloc<CrudEvent, CrudState> {
|
|||
"bldgappr_generaldesc.gen_code": "5TH",
|
||||
"bldgappr_struct_materials.date_created": "{{currentTimestamp}}",
|
||||
"bldgappr_struct_materials.date_modified": "{{currentTimestamp}}",
|
||||
"bldgappr_struct_materials.date_sync": "{{currentTimestamp}}",
|
||||
"bldgappr_struct_materials.foundation": firstStructMat.foundation,
|
||||
"bldgappr_struct_materials.columns": firstStructMat.columns,
|
||||
"bldgappr_struct_materials.beams": firstStructMat.beams,
|
||||
|
@ -209,6 +239,7 @@ class CrudBloc extends Bloc<CrudEvent, CrudState> {
|
|||
"bldgappr_struct_materials.gen_code": "5TH",
|
||||
"bldgappr_property_assessment.date_created": "{{currentTimestamp}}",
|
||||
"bldgappr_property_assessment.date_modified": "{{currentTimestamp}}",
|
||||
"bldgappr_property_assessment.date_sync": "{{currentTimestamp}}",
|
||||
"bldgappr_property_assessment.actual_use": firstAssess.actualUse,
|
||||
"bldgappr_property_assessment.market_value": firstAssess.marketValue,
|
||||
"bldgappr_property_assessment.assessment_level":
|
||||
|
@ -248,23 +279,33 @@ class CrudBloc extends Bloc<CrudEvent, CrudState> {
|
|||
"bldgappr_property_assessment.entry_date_assessment":
|
||||
DateFormat("yyyy-MM-dd")
|
||||
.format(DateTime.parse(firstAssess.entryDateAssessment!)),
|
||||
"bldgappr_property_assessment.entry_date_by": " ",
|
||||
"bldgappr_property_assessment.entry_date_by": "ij",
|
||||
"bldgappr_property_assessment.gen_code": "5TH",
|
||||
"bldgappr_rec_supersededass.date_created": "{{currentTimestamp}}",
|
||||
"bldgappr_rec_supersededass.date_modified": "{{currentTimestamp}}",
|
||||
"bldgappr_rec_supersededass.date_sync": "{{currentTimestamp}}",
|
||||
"bldgappr_rec_supersededass.pin": " ",
|
||||
"bldgappr_rec_supersededass.tdn": " ",
|
||||
"bldgappr_rec_supersededass.total_assval": "0",
|
||||
"bldgappr_rec_supersededass.owner": " ",
|
||||
"bldgappr_rec_supersededass.effectivity_ass": null,
|
||||
"bldgappr_rec_supersededass.owner": "0",
|
||||
"bldgappr_rec_supersededass.effectivity_ass": "1992-09-08",
|
||||
"bldgappr_rec_supersededass.page_no": "0",
|
||||
"bldgappr_rec_supersededass.total_marketval": "0",
|
||||
"bldgappr_rec_supersededass.total_area": "0",
|
||||
"bldgappr_rec_supersededass.rec_assessment": null,
|
||||
"bldgappr_rec_supersededass.rec_taxmapping": " ",
|
||||
"bldgappr_rec_supersededass.rec_records": " ",
|
||||
"bldgappr_rec_supersededass.date": null,
|
||||
"bldgappr_rec_supersededass.gen_code": "5TH"
|
||||
"bldgappr_rec_supersededass.rec_assessment": "1992-09-08",
|
||||
"bldgappr_rec_supersededass.rec_taxmapping": "0",
|
||||
"bldgappr_rec_supersededass.rec_records": "1992-09-08",
|
||||
"bldgappr_rec_supersededass.date": "1992-09-08",
|
||||
"bldgappr_rec_supersededass.gen_code": "5TH",
|
||||
"bldgappr_swornstatement.citizenship":
|
||||
"firstSwornStatement.citizenship",
|
||||
"bldgappr_swornstatement.civil_status":
|
||||
"firstSwornStatement.civilStatus",
|
||||
"bldgappr_swornstatement.fname": 'firstSwornStatement.fname',
|
||||
"bldgappr_swornstatement.mname": 'firstSwornStatement.mname',
|
||||
"bldgappr_swornstatement.lname": 'firstSwornStatement.lname',
|
||||
"bldgappr_swornstatement.date_sync": "{{currentTimestamp}}",
|
||||
"bldgappr_swornstatement.gen_code": "5TH"
|
||||
};
|
||||
|
||||
return details;
|
||||
|
@ -272,14 +313,6 @@ class CrudBloc extends Bloc<CrudEvent, CrudState> {
|
|||
|
||||
Future<void> _postAdditionalItems(
|
||||
Map<String, dynamic> datas, PropertyInfo infos) async {
|
||||
String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z";
|
||||
String xClientKeySecret = "unitcYqAN7GGalyz";
|
||||
Map<String, String> headers = {
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'X-Client-Key': xClientKey,
|
||||
'X-Client-Secret': xClientKeySecret
|
||||
};
|
||||
|
||||
List<Map<String, dynamic>> addItems =
|
||||
await SQLServices.instance.getAdditionalItems(infos.id);
|
||||
|
||||
|
@ -309,8 +342,8 @@ class CrudBloc extends Bloc<CrudEvent, CrudState> {
|
|||
genCode: "5TH");
|
||||
Response addResponse = await post(
|
||||
Uri.parse(
|
||||
'https://${Url.instance.host()}/api/rptass_app/additional_items/'),
|
||||
headers: headers,
|
||||
'${Url.instance.prefixHost()}${Url.instance.host()}/api/rptass_app/additional_items/'),
|
||||
headers: getHeaders(),
|
||||
body: jsonEncode(addItems));
|
||||
print(addResponse.body);
|
||||
}
|
||||
|
@ -318,82 +351,60 @@ class CrudBloc extends Bloc<CrudEvent, CrudState> {
|
|||
|
||||
Future<void> _postBuildingStructures(
|
||||
Map<String, dynamic> datas, PropertyInfo infos) async {
|
||||
String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z";
|
||||
String xClientKeySecret = "unitcYqAN7GGalyz";
|
||||
Map<String, String> headers = {
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'X-Client-Key': xClientKey,
|
||||
'X-Client-Secret': xClientKeySecret
|
||||
};
|
||||
|
||||
List<Map<String, dynamic>> bldgStructures =
|
||||
await SQLServices.instance.getBuildingAndStructure(infos.id);
|
||||
|
||||
List<BldgAndStructure> bldgStructureList =
|
||||
bldgStructures.map((map) => BldgAndStructure.fromJson(map)).toList();
|
||||
for (BldgAndStructure structure in bldgStructureList) {
|
||||
final bldgStruc = BldgAndStructure(
|
||||
id: 1,
|
||||
bldgapprDetailsId: datas['data']['id'],
|
||||
bldgArea: structure.bldgArea,
|
||||
bldgType: structure.bldgType,
|
||||
structType: structure.structType,
|
||||
description: structure.description,
|
||||
actualUse: structure.actualUse,
|
||||
floorCount: structure.floorCount,
|
||||
unitValue: structure.unitValue,
|
||||
depRate: structure.depRate,
|
||||
marketValue: structure.marketValue,
|
||||
depAmount: structure.depAmount,
|
||||
adjustedMarketValue: structure.adjustedMarketValue,
|
||||
genCode: '5TH',
|
||||
buccPercentage: structure.buccPercentage);
|
||||
Response response = await post(
|
||||
// Create an instance of BldgAndStructure
|
||||
final bldgAndStructure = BldgAndStructure(
|
||||
id: 1,
|
||||
bldgapprDetailsId: datas['data']['id'],
|
||||
bldgArea: structure.bldgArea,
|
||||
bldgType: structure.bldgType,
|
||||
structType: structure.structType,
|
||||
description: structure.description,
|
||||
actualUse: structure.actualUse,
|
||||
floorCount: structure.floorCount,
|
||||
unitValue: structure.unitValue,
|
||||
depRate: structure.depRate,
|
||||
marketValue: structure.marketValue,
|
||||
depAmount: structure.depAmount,
|
||||
adjustedMarketValue: structure.adjustedMarketValue,
|
||||
genCode: '5TH',
|
||||
buccPercentage: structure.buccPercentage,
|
||||
);
|
||||
|
||||
// Send the POST request using the reusable function
|
||||
Response addResponse = await post(
|
||||
Uri.parse(
|
||||
'https://${Url.instance.host()}/api/rptass_app/bldgappr_structure/'),
|
||||
headers: headers,
|
||||
body: jsonEncode(bldgStruc));
|
||||
print(response.body);
|
||||
'${Url.instance.prefixHost()}${Url.instance.host()}${Url.instance.buildingStructure()}'),
|
||||
headers: getHeaders(),
|
||||
body: jsonEncode(bldgAndStructure));
|
||||
print(addResponse.body);
|
||||
}
|
||||
}
|
||||
|
||||
Future<Response> _postBuildingDetails(Map<String, dynamic> details) async {
|
||||
String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z";
|
||||
String xClientKeySecret = "unitcYqAN7GGalyz";
|
||||
Map<String, String> headers = {
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'X-Client-Key': xClientKey,
|
||||
'X-Client-Secret': xClientKeySecret
|
||||
};
|
||||
|
||||
return await post(
|
||||
Uri.parse(
|
||||
'https://${Url.instance.host()}/api/rptass_app/bldgappr_details/'),
|
||||
headers: headers,
|
||||
'${Url.instance.prefixHost()}${Url.instance.host()}${Url.instance.buildingDetails()}'),
|
||||
headers: getHeaders(),
|
||||
body: jsonEncode(details));
|
||||
}
|
||||
|
||||
Future<Response> _postFloorSketch(
|
||||
Map<String, dynamic> details, file) async {
|
||||
String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z";
|
||||
String xClientKeySecret = "unitcYqAN7GGalyz";
|
||||
|
||||
// Construct the headers for the request
|
||||
Map<String, String> headers = {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
'X-Client-Key': xClientKey,
|
||||
'X-Client-Secret': xClientKeySecret,
|
||||
};
|
||||
|
||||
// Create a MultipartRequest
|
||||
var request = MultipartRequest(
|
||||
'POST',
|
||||
Uri.parse(
|
||||
'https://${Url.instance.host()}/api/rptass_app/bldgappr_sketch/'),
|
||||
'${Url.instance.prefixHost()}${Url.instance.host()}/api/rptass_app/bldgappr_sketch/'),
|
||||
);
|
||||
|
||||
// Add the headers to the request
|
||||
request.headers.addAll(headers);
|
||||
request.headers.addAll(getHeaders());
|
||||
|
||||
// Add JSON data as a field
|
||||
// Add individual fields to the request
|
||||
|
@ -417,6 +428,72 @@ class CrudBloc extends Bloc<CrudEvent, CrudState> {
|
|||
return await Response.fromStream(streamedResponse);
|
||||
}
|
||||
|
||||
Future<Response> _postValidIds(Map<String, dynamic> details, file) async {
|
||||
// Create a MultipartRequest
|
||||
var request = MultipartRequest(
|
||||
'POST',
|
||||
Uri.parse(
|
||||
'${Url.instance.prefixHost()}${Url.instance.host()}/api/rptass_app/bldgappr_validid/'),
|
||||
);
|
||||
|
||||
// Add the headers to the request
|
||||
request.headers.addAll(getHeaders());
|
||||
|
||||
// Add JSON data as a field
|
||||
// Add individual fields to the request
|
||||
details.forEach((key, value) {
|
||||
request.fields[key] = value.toString();
|
||||
});
|
||||
|
||||
// Add the floor sketch image file, if it exists
|
||||
|
||||
var fileName = basename(file);
|
||||
request.files.add(
|
||||
await MultipartFile.fromPath(
|
||||
'id_attachment', // Field name in the API
|
||||
file,
|
||||
filename: fileName,
|
||||
),
|
||||
);
|
||||
|
||||
// Send the request and get the response
|
||||
var streamedResponse = await request.send();
|
||||
return await Response.fromStream(streamedResponse);
|
||||
}
|
||||
|
||||
Future<Response> _postESignature(Map<String, dynamic> details, file) async {
|
||||
// Create a MultipartRequest
|
||||
var request = MultipartRequest(
|
||||
'POST',
|
||||
Uri.parse(
|
||||
'${Url.instance.prefixHost()}${Url.instance.host()}/api/rptass_app/bldgappr_signatures/'),
|
||||
);
|
||||
|
||||
// Add the headers to the request
|
||||
request.headers.addAll(getHeaders());
|
||||
|
||||
// Add JSON data as a field
|
||||
// Add individual fields to the request
|
||||
details.forEach((key, value) {
|
||||
request.fields[key] = value.toString();
|
||||
});
|
||||
|
||||
// Add the floor sketch image file, if it exists
|
||||
|
||||
var fileName = basename(file);
|
||||
request.files.add(
|
||||
await MultipartFile.fromPath(
|
||||
'sign_attachment', // Field name in the API
|
||||
file,
|
||||
filename: fileName,
|
||||
),
|
||||
);
|
||||
|
||||
// Send the request and get the response
|
||||
var streamedResponse = await request.send();
|
||||
return await Response.fromStream(streamedResponse);
|
||||
}
|
||||
|
||||
Future<void> _uploadImage(data, infos) async {
|
||||
// Create a map with the required fields
|
||||
|
||||
|
@ -447,6 +524,93 @@ class CrudBloc extends Bloc<CrudEvent, CrudState> {
|
|||
}
|
||||
}
|
||||
|
||||
Future<void> _uploadValidIds(data, infos) async {
|
||||
// Fetch all valid IDs associated with the infos.id (bldgapprDetailsId)
|
||||
List<Map<String, dynamic>> floorSketchList =
|
||||
await SQLServices.instance.getValidIds(infos.id);
|
||||
|
||||
print('floor sketch lis lenght');
|
||||
print(floorSketchList.length);
|
||||
|
||||
// Check if the list is not empty
|
||||
if (floorSketchList.isEmpty) {
|
||||
print('No valid IDs found for bldgapprDetailsId: ${infos.id}');
|
||||
return;
|
||||
}
|
||||
|
||||
// Declare validIdRecord outside the loop so it's accessible in the catch block
|
||||
ValidIds? validIdRecord;
|
||||
|
||||
// Loop through each valid ID in the list
|
||||
for (var sketch in floorSketchList) {
|
||||
try {
|
||||
// Parse each record into a ValidIds object
|
||||
validIdRecord = ValidIds.fromJson(sketch);
|
||||
print('Processing Valid ID: ${validIdRecord.toJson()}');
|
||||
|
||||
// Read the image file associated with the valid ID
|
||||
var file = File(validIdRecord.validIds!);
|
||||
|
||||
// Construct the payload (detailsMap) for the API
|
||||
Map<String, dynamic> detailsMap = {
|
||||
"bldgappr_details_id": data['data']['id'], // int8 NOT NULL
|
||||
"date_created":
|
||||
DateTime.now().toIso8601String(), // timestamptz NULL
|
||||
"id_attachment":
|
||||
validIdRecord.validIds!, // Path to the valid ID image
|
||||
"gen_code": "5TH", // Fixed gen code
|
||||
};
|
||||
|
||||
// Send the data via POST request
|
||||
Response response = await _postValidIds(detailsMap, file.path);
|
||||
|
||||
// Check the response status
|
||||
if (response.statusCode == 201) {
|
||||
print('Upload successful for ID: ${validIdRecord.validIds!}');
|
||||
} else {
|
||||
print(
|
||||
'Upload failed for ID: ${validIdRecord.validIds!} with status: ${response.statusCode}');
|
||||
}
|
||||
} catch (e) {
|
||||
// Handle and log errors for each individual valid ID upload attempt
|
||||
print('Error uploading ID: ${validIdRecord?.validIds!} - Error: $e');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _uploadESignature(data, infos) async {
|
||||
// Create a map with the required fields
|
||||
|
||||
List<Map<String, dynamic>> floorSketch =
|
||||
await SQLServices.instance.getESignature(infos.id);
|
||||
|
||||
// Parse data
|
||||
ESignature firstFs = ESignature.fromJson(floorSketch.first);
|
||||
print('E Signature');
|
||||
print(firstFs.toJson());
|
||||
var file = File(firstFs.signAttachment!);
|
||||
Map<String, dynamic> detailsMap = {
|
||||
"bldgappr_details_id": data['data']['id'], // int8 NOT NULL
|
||||
"date_created": DateTime.now().toIso8601String(),
|
||||
"date_modified": DateTime.now().toIso8601String(), // timestamptz NULL
|
||||
"sign_attachment": firstFs.signAttachment!, // text NULL
|
||||
"gen_code": "5TH", // varchar(20) NOT NULL
|
||||
};
|
||||
|
||||
try {
|
||||
Response response = await _postESignature(detailsMap, file.path);
|
||||
print(response.body);
|
||||
|
||||
if (response.statusCode == 201) {
|
||||
print('Upload successful');
|
||||
} else {
|
||||
print('Upload failed with status: ${response.statusCode}');
|
||||
}
|
||||
} catch (e) {
|
||||
print('Error: $e');
|
||||
}
|
||||
}
|
||||
|
||||
on<UploadBuildingFaas>((event, emit) async {
|
||||
emit(UploadBuildingFaasLoading());
|
||||
try {
|
||||
|
@ -456,15 +620,18 @@ class CrudBloc extends Bloc<CrudEvent, CrudState> {
|
|||
for (PropertyInfo infos in propertyOwner) {
|
||||
if (infos.dateSynced == null) {
|
||||
final details = await _prepareBuildingDetails(event, infos);
|
||||
|
||||
print(details.toString());
|
||||
Response detailsResponse = await _postBuildingDetails(details);
|
||||
final datas = json.decode(detailsResponse.body);
|
||||
|
||||
print("Upload API response");
|
||||
print(datas);
|
||||
|
||||
await _postAdditionalItems(datas, infos);
|
||||
await _postBuildingStructures(datas, infos);
|
||||
await _uploadImage(datas, infos);
|
||||
await _uploadValidIds(datas, infos);
|
||||
await _uploadESignature(datas, infos);
|
||||
|
||||
if (detailsResponse.statusCode == 201) {
|
||||
final detailsInfo = PropertyInfo(
|
||||
|
|
|
@ -26,6 +26,8 @@ class AddTodo extends CrudEvent {
|
|||
final String dateCreated;
|
||||
final String dateModified;
|
||||
final String genCode;
|
||||
final String civilStatus;
|
||||
final String citizenship;
|
||||
|
||||
const AddTodo(
|
||||
{required this.id,
|
||||
|
@ -48,7 +50,9 @@ class AddTodo extends CrudEvent {
|
|||
required this.assessedByName,
|
||||
required this.dateCreated,
|
||||
required this.dateModified,
|
||||
required this.genCode});
|
||||
required this.genCode,
|
||||
required this.citizenship,
|
||||
required this.civilStatus});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
|
@ -72,7 +76,9 @@ class AddTodo extends CrudEvent {
|
|||
assessedByName,
|
||||
dateCreated,
|
||||
dateModified,
|
||||
genCode
|
||||
genCode,
|
||||
citizenship,
|
||||
civilStatus
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
import 'package:bloc/bloc.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:unit2/sevices/passo/building/structural_material_services.dart';
|
||||
|
||||
import '../../../../../model/passo/structural_materials_ii.dart';
|
||||
import '../../../../../model/passo/structureMaterial.dart';
|
||||
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||
|
||||
import 'package:http/http.dart';
|
||||
part 'structural_material_offline_event.dart';
|
||||
part 'structural_material_offline_state.dart';
|
||||
|
||||
|
@ -52,6 +54,24 @@ class StructuralMaterialOfflineBloc extends Bloc<StructuralMaterialOfflineEvent,
|
|||
on<UpdateStructuralMaterials>((event, emit) async {
|
||||
await SQLServices.instance
|
||||
.updateStructuralMaterial(event.id, event.materials);
|
||||
|
||||
final state = this.state;
|
||||
emit(StructuralMaterialOfflineState());
|
||||
try {
|
||||
final tempID = await SharedPreferences.getInstance();
|
||||
print(tempID.getInt('tempid')! - 1);
|
||||
Response response = (await StrucMaterialServices.instance
|
||||
.update(event.materials, event.materials.id))!;
|
||||
print('struc Material');
|
||||
print(response.body);
|
||||
if (response.statusCode == 200) {
|
||||
emit(StructuralMaterialErrorState(errorMessage: '200'));
|
||||
} else {
|
||||
emit(StructuralMaterialErrorState(errorMessage: 'not 200'));
|
||||
}
|
||||
} catch (e) {
|
||||
emit(StructuralMaterialErrorState(errorMessage: e.toString()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,12 @@ class StructuralMaterialOfflineInitial extends StructuralMaterialOfflineState {
|
|||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class StructuralMaterialLoading extends StructuralMaterialOfflineState {
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
|
||||
class StructuralMaterialLoaded extends StructuralMaterialOfflineState {
|
||||
final List<StructureMaterials> materials;
|
||||
|
||||
|
@ -27,3 +33,10 @@ class SpecificStructuralMaterialLoaded extends StructuralMaterialOfflineState {
|
|||
@override
|
||||
List<Object> get props => [materials];
|
||||
}
|
||||
|
||||
class StructuralMaterialErrorState extends StructuralMaterialOfflineState {
|
||||
final String errorMessage;
|
||||
const StructuralMaterialErrorState({required this.errorMessage});
|
||||
@override
|
||||
List<Object> get props => [errorMessage];
|
||||
}
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
import 'package:bloc/bloc.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:unit2/model/passo/sworn_statement.dart';
|
||||
|
||||
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||
|
||||
part 'sworn_statement_event.dart';
|
||||
part 'sworn_statement_state.dart';
|
||||
|
||||
class SwornStatementBloc
|
||||
extends Bloc<SwornStatementEvent, SwornStatementState> {
|
||||
SwornStatementBloc() : super(SwornStatementInitial()) {
|
||||
on<AddSwornStatement>((event, emit) async {
|
||||
try {
|
||||
final sworn = await SQLServices.instance.createSwornStatement(
|
||||
SwornStatement(
|
||||
bldgapprDetailsId: event.bldgapprDetailsId,
|
||||
citizenship: event.citizenship,
|
||||
civilStatus: event.civilStatus,
|
||||
fname: event.fname,
|
||||
mname: event.mname,
|
||||
lname: event.lname,
|
||||
genCode: event.genCode));
|
||||
|
||||
// Emit success state with the created sworn statement
|
||||
print(sworn.toJson());
|
||||
} catch (error) {
|
||||
// Emit failure state if something goes wrong
|
||||
print(error.toString());
|
||||
}
|
||||
});
|
||||
|
||||
on<FetchSingleSwornStatement>((event, emit) async {
|
||||
List<Map<String, dynamic>> result =
|
||||
await SQLServices.instance.getSwornStatement(event.id);
|
||||
|
||||
if (result.isNotEmpty) {
|
||||
List<SwornStatement> swornList =
|
||||
result.map((map) => SwornStatement.fromJson(map)).toList();
|
||||
|
||||
// Choose a specific element from locationList
|
||||
SwornStatement firstSworn =
|
||||
swornList.first; // You can change this to select a specific item
|
||||
|
||||
print('sworn test result');
|
||||
print(firstSworn);
|
||||
emit(SpecificSwornStatementLoaded(swornStatement: firstSworn));
|
||||
} else {
|
||||
print('No data found.');
|
||||
}
|
||||
});
|
||||
on<UpdateSwornStatement>((event, emit) async {
|
||||
await SQLServices.instance.updateSwornStatement(event.id, event.sworn);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
part of 'sworn_statement_bloc.dart';
|
||||
|
||||
class SwornStatementEvent extends Equatable {
|
||||
const SwornStatementEvent();
|
||||
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class AddSwornStatement extends SwornStatementEvent {
|
||||
final int bldgapprDetailsId;
|
||||
final String citizenship;
|
||||
final String civilStatus;
|
||||
final String fname;
|
||||
final String mname;
|
||||
final String lname;
|
||||
final String genCode;
|
||||
|
||||
const AddSwornStatement(
|
||||
{required this.bldgapprDetailsId,
|
||||
required this.citizenship,
|
||||
required this.civilStatus,
|
||||
required this.fname,
|
||||
required this.mname,
|
||||
required this.lname,
|
||||
required this.genCode});
|
||||
|
||||
@override
|
||||
List<Object> get props => [
|
||||
bldgapprDetailsId,
|
||||
citizenship,
|
||||
civilStatus,
|
||||
fname,
|
||||
mname,
|
||||
lname,
|
||||
genCode
|
||||
];
|
||||
}
|
||||
|
||||
class FetchSingleSwornStatement extends SwornStatementEvent {
|
||||
final int id;
|
||||
const FetchSingleSwornStatement({required this.id});
|
||||
|
||||
@override
|
||||
List<Object> get props => [id];
|
||||
}
|
||||
|
||||
class UpdateSwornStatement extends SwornStatementEvent {
|
||||
final SwornStatement sworn;
|
||||
final int id;
|
||||
|
||||
UpdateSwornStatement({required this.id, required this.sworn});
|
||||
|
||||
@override
|
||||
List<Object> get props => [id, sworn];
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
part of 'sworn_statement_bloc.dart';
|
||||
|
||||
class SwornStatementState extends Equatable {
|
||||
const SwornStatementState();
|
||||
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class SwornStatementLoaded extends SwornStatementState {
|
||||
final List<SwornStatement> swornStatement;
|
||||
|
||||
const SwornStatementLoaded({required this.swornStatement});
|
||||
@override
|
||||
List<Object> get props => [swornStatement];
|
||||
}
|
||||
|
||||
class SwornStatementInitial extends SwornStatementState {}
|
||||
|
||||
class SpecificSwornStatementLoaded extends SwornStatementState {
|
||||
final SwornStatement swornStatement;
|
||||
|
||||
const SpecificSwornStatementLoaded({required this.swornStatement});
|
||||
@override
|
||||
List<Object> get props => [swornStatement];
|
||||
}
|
|
@ -42,18 +42,18 @@ class PropertyAssessmentEditBloc
|
|||
emit(PropertyAssessmentEditLoaded(globalPropertyAssessmentEdit));
|
||||
}
|
||||
});
|
||||
on<UpdatePropertyAssessmentEdit>((event, emit) async {
|
||||
final tempID = await SharedPreferences.getInstance();
|
||||
final tempID2 = tempID.getInt('tempid')! - 1;
|
||||
http.Response response = (await PropertyAssessmentServices.instance
|
||||
.updateEdit(event.assessmentsEdit, tempID2))!;
|
||||
print('assessment');
|
||||
print(response.statusCode);
|
||||
print(response.body);
|
||||
// if (response.statusCode == 201) {
|
||||
// final faas = await PropertyInfoRepository.getUsers();
|
||||
// emit(FaasLoaded(faas));
|
||||
// }
|
||||
});
|
||||
// on<UpdatePropertyAssessmentEdit>((event, emit) async {
|
||||
// final tempID = await SharedPreferences.getInstance();
|
||||
// final tempID2 = tempID.getInt('tempid')! - 1;
|
||||
// http.Response response = (await PropertyAssessmentServices.instance
|
||||
// .updateEdit(event.assessmentsEdit, tempID2))!;
|
||||
// print('assessment');
|
||||
// print(response.statusCode);
|
||||
// print(response.body);
|
||||
// // if (response.statusCode == 201) {
|
||||
// // final faas = await PropertyInfoRepository.getUsers();
|
||||
// // emit(FaasLoaded(faas));
|
||||
// // }
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import 'package:unit2/model/passo/general_description.dart';
|
|||
import 'package:unit2/model/passo/land_ref.dart';
|
||||
import 'package:unit2/model/passo/property_info.dart';
|
||||
import 'package:unit2/model/passo/structural_materials_ii.dart';
|
||||
import 'package:unit2/sevices/passo/building/general_description_services.dart';
|
||||
import 'package:unit2/sevices/passo/building/property_info_services.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
|
@ -141,7 +140,7 @@ class PropertyInfoBloc extends Bloc<PropertyInfoEvent, PropertyInfoState> {
|
|||
(await PropertyInfoService.instance.remove(event.id));
|
||||
print(response.statusCode);
|
||||
if (response.statusCode == 200) {
|
||||
emit(BuildingFaasDeletedState(success: true));
|
||||
emit(const BuildingFaasDeletedState(success: true));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ import 'dart:async';
|
|||
import 'dart:io';
|
||||
import 'package:barcode_scan2/barcode_scan2.dart';
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:unit2/model/login_data/user_info/assigned_area.dart';
|
||||
|
@ -86,11 +87,14 @@ class UserBloc extends Bloc<UserEvent, UserState> {
|
|||
password = event.password;
|
||||
bool? availableOffline;
|
||||
List<OfflineModules> offlineCards = [];
|
||||
|
||||
try {
|
||||
Map<dynamic, dynamic> response = await AuthService.instance
|
||||
.webLogin(username: event.username, password: event.password);
|
||||
|
||||
if (response['status'] == true) {
|
||||
UserData userData = UserData.fromJson(response['data']);
|
||||
print('test');
|
||||
Role? estPointPerson;
|
||||
if (userData.user?.login?.user?.roles != null &&
|
||||
userData.user!.login!.user!.roles!.isNotEmpty) {
|
||||
|
|
|
@ -15,14 +15,14 @@ class Department {
|
|||
String? code;
|
||||
Head? head;
|
||||
String? name;
|
||||
int? acronym;
|
||||
String? acronym;
|
||||
int? parentStationId;
|
||||
String? fullCode;
|
||||
|
||||
factory Department.fromJson(Map<String, dynamic> json) => Department(
|
||||
id: json["id"],
|
||||
code: json["code"],
|
||||
head:json["head"]==null?null:Head.fromJson(json["head"]),
|
||||
head: json["head"] == null ? null : Head.fromJson(json["head"]),
|
||||
name: json["name"],
|
||||
acronym: json["acronym"],
|
||||
parentStationId: json["parent_station_id"],
|
||||
|
|
|
@ -25,8 +25,9 @@ class EmployeeInfo {
|
|||
empid: json["empid"],
|
||||
classid: json["classid"],
|
||||
uuid: json["uuid"],
|
||||
office: json["office"]==null?null:Office.fromJson(json["office"]),
|
||||
profile: json["profile"]==null?null:Profile.fromJson(json["profile"]),
|
||||
office: json["office"] == null ? null : Office.fromJson(json["office"]),
|
||||
profile:
|
||||
json["profile"] == null ? null : Profile.fromJson(json["profile"]),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
|
@ -38,4 +39,3 @@ class EmployeeInfo {
|
|||
"profile": profile!.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
// To parse this JSON data, do
|
||||
//
|
||||
// final assessmentLevel = assessmentLevelFromMap(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
AssessmentLevel assessmentLevelFromMap(String str) =>
|
||||
AssessmentLevel.fromMap(json.decode(str));
|
||||
|
||||
String assessmentLevelToMap(AssessmentLevel data) => json.encode(data.toMap());
|
||||
|
||||
class AssessmentLevel {
|
||||
final int? id;
|
||||
final int? classificationId;
|
||||
final String? over;
|
||||
final String? notOver;
|
||||
final String? assessmentLevels;
|
||||
final String? genCode;
|
||||
|
||||
AssessmentLevel({
|
||||
this.id,
|
||||
this.classificationId,
|
||||
this.over,
|
||||
this.notOver,
|
||||
this.assessmentLevels,
|
||||
this.genCode,
|
||||
});
|
||||
|
||||
AssessmentLevel copyWith({
|
||||
int? id,
|
||||
int? classificationId,
|
||||
String? over,
|
||||
String? notOver,
|
||||
String? assessmentLevels,
|
||||
String? genCode,
|
||||
}) {
|
||||
return AssessmentLevel(
|
||||
id: id ?? this.id,
|
||||
classificationId: classificationId ?? this.classificationId,
|
||||
over: over ?? this.over,
|
||||
notOver: notOver ?? this.notOver,
|
||||
assessmentLevels: assessmentLevels ?? this.assessmentLevels,
|
||||
genCode: genCode ?? this.genCode,
|
||||
);
|
||||
}
|
||||
|
||||
factory AssessmentLevel.fromMap(Map<String, dynamic> json) => AssessmentLevel(
|
||||
id: json["id"],
|
||||
classificationId: json["classification_id"],
|
||||
over: json["over"],
|
||||
notOver: json["not_over"],
|
||||
assessmentLevels: json["assessment_levels"],
|
||||
genCode: json["gen_code"],
|
||||
);
|
||||
|
||||
factory AssessmentLevel.fromJson(Map<String, dynamic> json) =>
|
||||
AssessmentLevel(
|
||||
id: json["id"],
|
||||
classificationId: json["classification_id"],
|
||||
over: json["over"],
|
||||
notOver: json["not_over"],
|
||||
assessmentLevels: json["assessment_levels"],
|
||||
genCode: json["gen_code"],
|
||||
);
|
||||
|
||||
factory AssessmentLevel.fromJson2(Map<String, dynamic> json) =>
|
||||
AssessmentLevel(
|
||||
id: json["id"],
|
||||
classificationId: json["classificationId"],
|
||||
over: json["over"],
|
||||
notOver: json["notOver"],
|
||||
assessmentLevels: json["assessmentLevels"],
|
||||
genCode: json["genCode"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toMap() => {
|
||||
"id": id,
|
||||
"classification_id": classificationId,
|
||||
"over": over,
|
||||
"not_over": notOver,
|
||||
"assessment_levels": assessmentLevels,
|
||||
"gen_code": genCode,
|
||||
};
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
// To parse this JSON data, do
|
||||
//
|
||||
// final eSignature = eSignatureFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
ESignature eSignatureFromJson(String str) =>
|
||||
ESignature.fromJson(json.decode(str));
|
||||
|
||||
String eSignatureToJson(ESignature data) => json.encode(data.toJson());
|
||||
|
||||
class ESignature {
|
||||
int? bldgapprDetailsId;
|
||||
String? signAttachment;
|
||||
String? dateCreated;
|
||||
String? dateModified;
|
||||
String? genCode;
|
||||
|
||||
ESignature({
|
||||
this.bldgapprDetailsId,
|
||||
this.signAttachment,
|
||||
this.dateCreated,
|
||||
this.dateModified,
|
||||
this.genCode,
|
||||
});
|
||||
|
||||
ESignature copy({
|
||||
int? bldgapprDetailsId,
|
||||
String? signAttachment,
|
||||
String? dateCreated,
|
||||
String? dateModified,
|
||||
String? genCode,
|
||||
}) {
|
||||
return ESignature(
|
||||
bldgapprDetailsId: bldgapprDetailsId ?? this.bldgapprDetailsId,
|
||||
signAttachment: signAttachment ?? this.signAttachment,
|
||||
dateCreated: dateCreated ?? this.dateCreated,
|
||||
dateModified: dateModified ?? this.dateModified,
|
||||
genCode: genCode ?? this.genCode,
|
||||
);
|
||||
}
|
||||
|
||||
ESignature copyWith({
|
||||
int? bldgapprDetailsId,
|
||||
String? signAttachment,
|
||||
String? dateCreated,
|
||||
String? dateModified,
|
||||
String? genCode,
|
||||
}) =>
|
||||
ESignature(
|
||||
bldgapprDetailsId: bldgapprDetailsId ?? this.bldgapprDetailsId,
|
||||
signAttachment: signAttachment ?? this.signAttachment,
|
||||
dateCreated: dateCreated ?? this.dateCreated,
|
||||
dateModified: dateModified ?? this.dateModified,
|
||||
genCode: genCode ?? this.genCode,
|
||||
);
|
||||
|
||||
factory ESignature.fromJson(Map<String, dynamic> json) => ESignature(
|
||||
bldgapprDetailsId: json["bldgappr_details_id"],
|
||||
signAttachment: json["sign_attachment"],
|
||||
dateCreated: json["date_created"],
|
||||
dateModified: json["date_modified"],
|
||||
genCode: json["gen_code"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"bldgappr_details_id": bldgapprDetailsId,
|
||||
"sign_attachment": signAttachment,
|
||||
"date_created": dateCreated,
|
||||
"date_modified": dateModified,
|
||||
"gen_code": genCode,
|
||||
};
|
||||
|
||||
// Define the fromMap method to convert a Map into an ESignature object
|
||||
factory ESignature.fromMap(Map<String, dynamic> map) {
|
||||
return ESignature(
|
||||
bldgapprDetailsId: map['bldgapprDetailsId'] as int?,
|
||||
signAttachment: map['signAttachment'] as String?,
|
||||
dateCreated: map['dateCreated'] as String?,
|
||||
dateModified: map['dateModified'] as String?,
|
||||
genCode: map['genCode'] as String?,
|
||||
);
|
||||
}
|
||||
|
||||
// You can also add a toMap method if needed for converting back to Map
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'bldgapprDetailsId': bldgapprDetailsId,
|
||||
'signAttachment': signAttachment,
|
||||
'dateCreated': dateCreated,
|
||||
'dateModified': dateModified,
|
||||
'genCode': genCode,
|
||||
};
|
||||
}
|
||||
}
|
|
@ -32,6 +32,8 @@ class PropertyInfo {
|
|||
final String? faasType;
|
||||
final String? genCode;
|
||||
final String? dateSynced;
|
||||
final String? civilStatus;
|
||||
final String? citizenship;
|
||||
|
||||
PropertyInfo(
|
||||
{this.id,
|
||||
|
@ -55,7 +57,9 @@ class PropertyInfo {
|
|||
this.adminTin,
|
||||
this.faasType,
|
||||
this.genCode,
|
||||
this.dateSynced});
|
||||
this.dateSynced,
|
||||
this.citizenship,
|
||||
this.civilStatus});
|
||||
|
||||
PropertyInfo copy(
|
||||
{int? id,
|
||||
|
@ -76,7 +80,9 @@ class PropertyInfo {
|
|||
String? adminTin,
|
||||
String? faasType,
|
||||
String? genCode,
|
||||
String? dateSynced}) =>
|
||||
String? dateSynced,
|
||||
String? civilStatus,
|
||||
String? citizenship}) =>
|
||||
PropertyInfo(
|
||||
id: id ?? this.id,
|
||||
assessedById: assessedById ?? this.assessedById,
|
||||
|
@ -99,7 +105,9 @@ class PropertyInfo {
|
|||
adminTin: adminTin ?? this.adminTin,
|
||||
faasType: faasType ?? this.faasType,
|
||||
genCode: genCode ?? this.genCode,
|
||||
dateSynced: dateSynced ?? this.dateSynced);
|
||||
dateSynced: dateSynced ?? this.dateSynced,
|
||||
citizenship: citizenship ?? this.citizenship,
|
||||
civilStatus: civilStatus ?? this.civilStatus);
|
||||
|
||||
factory PropertyInfo.fromJson(Map<String, dynamic> json) => PropertyInfo(
|
||||
id: json["id"],
|
||||
|
@ -155,7 +163,9 @@ class PropertyInfo {
|
|||
adminTin: json["adminTin"],
|
||||
faasType: json["faasType"],
|
||||
genCode: json["genCode"],
|
||||
dateSynced: json["dateSynced"]);
|
||||
dateSynced: json["dateSynced"],
|
||||
citizenship: json["citizenship"],
|
||||
civilStatus: json["civil_status"]);
|
||||
|
||||
factory PropertyInfo.fromMap(Map<String, dynamic> map) => PropertyInfo(
|
||||
id: map["id"],
|
||||
|
@ -179,7 +189,9 @@ class PropertyInfo {
|
|||
adminTin: map["adminTin"],
|
||||
faasType: map["faasType"],
|
||||
genCode: map["genCode"],
|
||||
dateSynced: map["dateSynced"]);
|
||||
dateSynced: map["dateSynced"],
|
||||
citizenship: map["citizenship"],
|
||||
civilStatus: map["civilStatus"]);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
|
@ -203,6 +215,8 @@ class PropertyInfo {
|
|||
"admin_tin": adminTin,
|
||||
"faas_type": faasType,
|
||||
"gen_code": genCode,
|
||||
"dateSynced": dateSynced
|
||||
"dateSynced": dateSynced,
|
||||
"civilStatus": civilStatus,
|
||||
"citizenship": citizenship
|
||||
};
|
||||
}
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
// To parse this JSON data, do
|
||||
//
|
||||
// final swornStatement = swornStatementFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
SwornStatement swornStatementFromJson(String str) =>
|
||||
SwornStatement.fromJson(json.decode(str));
|
||||
|
||||
String swornStatementToJson(SwornStatement data) => json.encode(data.toJson());
|
||||
|
||||
class SwornStatement {
|
||||
final int? bldgapprDetailsId;
|
||||
final String? citizenship;
|
||||
final String? civilStatus;
|
||||
final String? fname;
|
||||
final String? mname;
|
||||
final String? lname;
|
||||
final String? genCode;
|
||||
|
||||
SwornStatement({
|
||||
this.bldgapprDetailsId,
|
||||
this.citizenship,
|
||||
this.civilStatus,
|
||||
this.fname,
|
||||
this.mname,
|
||||
this.lname,
|
||||
this.genCode,
|
||||
});
|
||||
|
||||
SwornStatement copyWith({
|
||||
int? bldgapprDetailsId,
|
||||
String? citizenship,
|
||||
String? civilStatus,
|
||||
String? fname,
|
||||
String? mname,
|
||||
String? lname,
|
||||
String? genCode,
|
||||
}) =>
|
||||
SwornStatement(
|
||||
bldgapprDetailsId: bldgapprDetailsId ?? this.bldgapprDetailsId,
|
||||
citizenship: citizenship ?? this.citizenship,
|
||||
civilStatus: civilStatus ?? this.civilStatus,
|
||||
fname: fname ?? this.fname,
|
||||
mname: mname ?? this.mname,
|
||||
lname: lname ?? this.lname,
|
||||
genCode: genCode ?? this.genCode,
|
||||
);
|
||||
|
||||
SwornStatement copy({
|
||||
final int? bldgapprDetailsId,
|
||||
final String? citizenship,
|
||||
final String? civilStatus,
|
||||
final String? fname,
|
||||
final String? mname,
|
||||
final String? lname,
|
||||
final String? genCode,
|
||||
}) =>
|
||||
SwornStatement(
|
||||
bldgapprDetailsId: bldgapprDetailsId ?? this.bldgapprDetailsId,
|
||||
citizenship: citizenship ?? this.citizenship,
|
||||
civilStatus: civilStatus ?? this.civilStatus,
|
||||
fname: fname ?? this.fname,
|
||||
mname: mname ?? this.mname,
|
||||
lname: lname ?? this.lname,
|
||||
genCode: genCode ?? this.genCode,
|
||||
);
|
||||
|
||||
factory SwornStatement.fromJson(Map<String, dynamic> json) => SwornStatement(
|
||||
bldgapprDetailsId: json["bldgappr_details_id"],
|
||||
citizenship: json["citizenship"],
|
||||
civilStatus: json["civil"],
|
||||
fname: json["fname"],
|
||||
mname: json["mname"],
|
||||
lname: json["lname"],
|
||||
genCode: json["gen_code"],
|
||||
);
|
||||
|
||||
factory SwornStatement.fromJson2(Map<String, dynamic> json) => SwornStatement(
|
||||
bldgapprDetailsId: json["bldgappr_details_id"],
|
||||
citizenship: json["citizenship"],
|
||||
civilStatus: json["civil"],
|
||||
fname: json["fname"],
|
||||
mname: json["mname"],
|
||||
lname: json["lname"],
|
||||
genCode: json["gen_code"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"bldgappr_details_id": bldgapprDetailsId,
|
||||
"citizenship": citizenship,
|
||||
"civil": civilStatus,
|
||||
"fname": fname,
|
||||
"mname": mname,
|
||||
"lname": lname,
|
||||
"gen_code": genCode,
|
||||
};
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
// To parse this JSON data, do
|
||||
//
|
||||
// final floorSketch = floorSketchFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
ValidIds floorSketchFromJson(String str) => ValidIds.fromJson(json.decode(str));
|
||||
|
||||
String floorSketchToJson(ValidIds data) => json.encode(data.toJson());
|
||||
|
||||
class ValidIds {
|
||||
int? bldgapprDetailsId;
|
||||
String? dateCreated;
|
||||
String? validIds;
|
||||
String? genCode;
|
||||
|
||||
ValidIds({
|
||||
this.bldgapprDetailsId,
|
||||
this.dateCreated,
|
||||
this.validIds,
|
||||
this.genCode,
|
||||
});
|
||||
|
||||
ValidIds copy(
|
||||
{int? bldgapprDetailsId,
|
||||
String? dateCreated,
|
||||
String? validIds,
|
||||
String? genCode}) {
|
||||
return ValidIds(
|
||||
bldgapprDetailsId: bldgapprDetailsId ?? this.bldgapprDetailsId,
|
||||
dateCreated: dateCreated ?? this.dateCreated,
|
||||
validIds: validIds ?? this.validIds,
|
||||
genCode: genCode ?? this.genCode,
|
||||
);
|
||||
}
|
||||
|
||||
ValidIds copyWith({
|
||||
int? bldgapprDetailsId,
|
||||
String? dateCreated,
|
||||
String? validIds,
|
||||
String? genCode,
|
||||
}) =>
|
||||
ValidIds(
|
||||
bldgapprDetailsId: bldgapprDetailsId ?? this.bldgapprDetailsId,
|
||||
dateCreated: dateCreated ?? this.dateCreated,
|
||||
validIds: validIds ?? this.validIds,
|
||||
genCode: genCode ?? this.genCode,
|
||||
);
|
||||
|
||||
factory ValidIds.fromJson(Map<String, dynamic> json) => ValidIds(
|
||||
bldgapprDetailsId: json["bldgappr_details_id"],
|
||||
dateCreated: json["date_created"],
|
||||
validIds: json["id_attachment"],
|
||||
genCode: json["gen_code"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"bldgappr_details_id": bldgapprDetailsId,
|
||||
"date_created": dateCreated,
|
||||
"valid_ids": validIds,
|
||||
"gen_code": genCode,
|
||||
};
|
||||
|
||||
// Define the fromMap method to convert a Map into a ValidIds object
|
||||
factory ValidIds.fromMap(Map<String, dynamic> map) {
|
||||
return ValidIds(
|
||||
bldgapprDetailsId: map['bldgapprDetailsId'] as int?,
|
||||
validIds: map['validIds'] as String?,
|
||||
dateCreated: map['dateCreated'] as String?,
|
||||
genCode: map['genCode'] as String?,
|
||||
);
|
||||
}
|
||||
|
||||
// You can also add a toMap method if needed for converting back to Map
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'bldgapprDetailsId': bldgapprDetailsId,
|
||||
'validIds': validIds,
|
||||
'dateCreated': dateCreated,
|
||||
'genCode': genCode,
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:fluttericon/elusive_icons.dart';
|
||||
import 'package:unit2/bloc/offline/offline_passo/admin/assessment_level/assessment_level_bloc.dart';
|
||||
import 'package:unit2/bloc/offline/offline_passo/admin/barangay_admin/barangay_admin_bloc.dart';
|
||||
import 'package:unit2/bloc/offline/offline_passo/admin/class_components_admin.dart/class_components_admin_bloc.dart';
|
||||
import 'package:unit2/bloc/offline/offline_passo/admin/land_subclassification/land_subclassification_bloc.dart';
|
||||
|
@ -12,6 +13,7 @@ import 'package:unit2/bloc/offline/offline_passo/admin/type_of_location/type_of_
|
|||
import 'package:unit2/bloc/offline/offline_passo/admin/type_of_road/type_of_road_bloc.dart';
|
||||
import 'package:unit2/bloc/offline/offline_passo/admin/unit_construction/unit_construction_admin_bloc.dart';
|
||||
import 'package:unit2/bloc/offline/offline_passo/admin/value_adjustments/value_adjustments_bloc.dart';
|
||||
import 'package:unit2/screens/offline/passo/admin/assessment_level.dart';
|
||||
import 'package:unit2/screens/offline/passo/admin/barangay.dart';
|
||||
import 'package:unit2/screens/offline/passo/admin/class_components.dart';
|
||||
import 'package:unit2/screens/offline/passo/admin/globalSyncService.dart';
|
||||
|
@ -65,6 +67,20 @@ class _AdminMainScreen extends State<AdminMainScreen> {
|
|||
),
|
||||
body: ListView(
|
||||
children: [
|
||||
MainMenu(
|
||||
icon: Elusive.wrench,
|
||||
title: "Assessment Levels",
|
||||
onTap: () {
|
||||
Navigator.push(context,
|
||||
MaterialPageRoute(builder: (BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) =>
|
||||
AssessmentLevelBloc()..add(LoadAssessmentLevel()),
|
||||
child: AssessmentLevelAdminPage(),
|
||||
);
|
||||
}));
|
||||
}),
|
||||
const Divider(),
|
||||
MainMenu(
|
||||
icon: Elusive.wrench,
|
||||
title: "Municipalities",
|
||||
|
|
|
@ -0,0 +1,120 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:unit2/bloc/offline/offline_passo/admin/assessment_level/assessment_level_bloc.dart';
|
||||
import 'package:unit2/sevices/offline/offline_passo/admin/api_services/assessment_level_api_services.dart';
|
||||
import 'package:unit2/theme-data.dart/colors.dart';
|
||||
|
||||
import '../../../../model/passo/assessment_level.dart';
|
||||
import '../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||
|
||||
class AssessmentLevelAdminPage extends StatefulWidget {
|
||||
const AssessmentLevelAdminPage();
|
||||
|
||||
@override
|
||||
_AssessmentLevelAdminPage createState() => _AssessmentLevelAdminPage();
|
||||
}
|
||||
|
||||
class _AssessmentLevelAdminPage extends State<AssessmentLevelAdminPage> {
|
||||
final items = [];
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: primary,
|
||||
title: const Text("Assessment Levels"),
|
||||
centerTitle: true,
|
||||
actions: [
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
textStyle: const TextStyle(fontSize: 15),
|
||||
),
|
||||
onPressed: () async {
|
||||
// try {
|
||||
final result = await AssessmentLevelApiServices.instance.fetch();
|
||||
|
||||
// Assuming result is a List of JSON objects, convert them to AssessmentLevel objects.
|
||||
final assessmentLevels =
|
||||
result.map((json) => AssessmentLevel.fromJson(json)).toList();
|
||||
|
||||
// Insert each AssessmentLevel object into the local database.
|
||||
for (AssessmentLevel level in assessmentLevels) {
|
||||
print(level.assessmentLevels);
|
||||
print(level.genCode);
|
||||
await SQLServices.instance.createAssessmentLevel(level);
|
||||
}
|
||||
|
||||
context.read<AssessmentLevelBloc>().add(LoadAssessmentLevel());
|
||||
// } catch (e) {
|
||||
// // Handle any errors that might occur during the API call or database insertion.
|
||||
// print("Error: $e");
|
||||
// }
|
||||
},
|
||||
child: const Text('SYNC'),
|
||||
),
|
||||
],
|
||||
),
|
||||
body: BlocConsumer<AssessmentLevelBloc, AssessmentLevelState>(
|
||||
listener: (context, state) {
|
||||
// TODO: implement listener if needed
|
||||
},
|
||||
builder: (context, state) {
|
||||
if (state is AssessmentLevelLoaded) {
|
||||
return Column(children: [
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(15.0),
|
||||
child: Column(
|
||||
children: [
|
||||
SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: DataTable(
|
||||
columns: [
|
||||
const DataColumn(
|
||||
label: Text('Classification ID'),
|
||||
),
|
||||
const DataColumn(
|
||||
label: Text('Over'),
|
||||
),
|
||||
const DataColumn(
|
||||
label: Text('Not Over'),
|
||||
),
|
||||
const DataColumn(
|
||||
label: Text('Assessment Levels'),
|
||||
),
|
||||
const DataColumn(
|
||||
label: Text('Gen Code'),
|
||||
),
|
||||
],
|
||||
rows: state.assLevel.map((dataRow) {
|
||||
return DataRow(
|
||||
cells: [
|
||||
DataCell(Text(dataRow.classificationId
|
||||
.toString())), // Display classificationId
|
||||
DataCell(Text(dataRow.over ??
|
||||
'N/A')), // Use a default value if 'over' is null
|
||||
DataCell(Text(dataRow.notOver ??
|
||||
'N/A')), // Use a default value if 'notOver' is null
|
||||
DataCell(Text(dataRow.assessmentLevels ??
|
||||
'N/A')), // Use a default value if 'assessmentLevels' is null
|
||||
DataCell(Text(dataRow.genCode ??
|
||||
'N/A')), // Use a default value if 'genCode' is null
|
||||
],
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
]);
|
||||
}
|
||||
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -14,7 +14,6 @@ import 'package:unit2/model/passo/building_and_structure.dart';
|
|||
|
||||
import '../../../../../model/passo/unit_construct.dart';
|
||||
import '../../../../../theme-data.dart/form-style.dart';
|
||||
import '../../../../../widgets/passo/custom_formBuilder_fields.dart';
|
||||
|
||||
// Function to get stored building type
|
||||
Future<UnitConstruct> getStoredBldgType() async {
|
||||
|
@ -30,7 +29,7 @@ Future<UnitConstruct> getStoredBldgType() async {
|
|||
|
||||
class AddBuildingAndStructureOffline extends StatefulWidget {
|
||||
final OfflineProfile offlineProfile;
|
||||
AddBuildingAndStructureOffline(this.offlineProfile);
|
||||
const AddBuildingAndStructureOffline(this.offlineProfile);
|
||||
|
||||
@override
|
||||
_AddBuildingAndStructureOffline createState() =>
|
||||
|
@ -176,9 +175,7 @@ class _AddBuildingAndStructureOffline
|
|||
errorText: "This field is required"),
|
||||
|
||||
searchInputDecoration: normalTextFieldStyle(
|
||||
_unitConstruct!.bldgType +
|
||||
' - ' +
|
||||
_unitConstruct!.building,
|
||||
'${_unitConstruct.bldgType} - ${_unitConstruct!.building}',
|
||||
"")
|
||||
.copyWith(
|
||||
suffixIcon:
|
||||
|
@ -196,20 +193,18 @@ class _AddBuildingAndStructureOffline
|
|||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
child: FormBuilderTextField(
|
||||
name: 'unit_value',
|
||||
decoration: normalTextFieldStyle("Unit Value", ""),
|
||||
validator: FormBuilderValidators.compose([]),
|
||||
keyboardType: TextInputType.phone,
|
||||
onChanged: (value) {
|
||||
// setState(() {
|
||||
// _areaValue = int.parse(value!);
|
||||
// });
|
||||
},
|
||||
),
|
||||
FormBuilderTextField(
|
||||
name: 'unit_value',
|
||||
decoration: normalTextFieldStyle("Unit Value", ""),
|
||||
validator: FormBuilderValidators.compose([]),
|
||||
keyboardType: TextInputType.phone,
|
||||
onChanged: (value) {
|
||||
// setState(() {
|
||||
// _areaValue = int.parse(value!);
|
||||
// });
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
|
|
|
@ -12,13 +12,9 @@ import 'package:unit2/bloc/offline/offline_passo/admin/class_components_admin.da
|
|||
import 'package:unit2/bloc/offline/offline_passo/admin/unit_construction/unit_construction_admin_bloc.dart';
|
||||
import 'package:unit2/bloc/offline/offline_passo/building/additional_items_offline/additional_items_offline_bloc.dart';
|
||||
import 'package:unit2/model/offline/offline_profile.dart';
|
||||
import 'package:unit2/model/passo/additional_items.dart';
|
||||
import 'package:unit2/model/passo/class_components%20_offline.dart';
|
||||
import 'package:unit2/model/passo/class_components.dart';
|
||||
import 'package:unit2/model/passo/unit_construct.dart';
|
||||
import 'package:unit2/theme-data.dart/form-style.dart';
|
||||
import 'package:unit2/utils/text_container.dart';
|
||||
import 'package:unit2/widgets/error_state.dart';
|
||||
|
||||
// Function to get stored building type
|
||||
Future<UnitConstruct> getStoredBldgType() async {
|
||||
|
@ -392,15 +388,11 @@ class _AddExtraItemsOffline extends State<AddExtraItemsOffline> {
|
|||
suggestions: state.unit
|
||||
.map((UnitConstruct unit) =>
|
||||
SearchFieldListItem(
|
||||
_unitConstruct.bldgType +
|
||||
' - ' +
|
||||
_unitConstruct.building,
|
||||
'${_unitConstruct.bldgType} - ${_unitConstruct.building}',
|
||||
item: unit,
|
||||
child: ListTile(
|
||||
title: Text(
|
||||
_unitConstruct.bldgType +
|
||||
' - ' +
|
||||
_unitConstruct.building,
|
||||
'${_unitConstruct.bldgType} - ${_unitConstruct.building}',
|
||||
overflow:
|
||||
TextOverflow.ellipsis,
|
||||
),
|
||||
|
@ -411,9 +403,7 @@ class _AddExtraItemsOffline extends State<AddExtraItemsOffline> {
|
|||
errorText: "This field is required"),
|
||||
|
||||
searchInputDecoration: normalTextFieldStyle(
|
||||
_unitConstruct.bldgType +
|
||||
' - ' +
|
||||
_unitConstruct.building,
|
||||
'${_unitConstruct.bldgType} - ${_unitConstruct.building}',
|
||||
"")
|
||||
.copyWith(
|
||||
suffixIcon: const Icon(
|
||||
|
@ -473,7 +463,7 @@ class _AddExtraItemsOffline extends State<AddExtraItemsOffline> {
|
|||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
|
@ -503,44 +493,40 @@ class _AddExtraItemsOffline extends State<AddExtraItemsOffline> {
|
|||
const SizedBox(height: 10),
|
||||
const Text('Building is not painted?'),
|
||||
const SizedBox(height: 5),
|
||||
Container(
|
||||
child: Row(
|
||||
children: [
|
||||
Checkbox(
|
||||
value: isPainted,
|
||||
onChanged: (bool? value) {
|
||||
setState(() {
|
||||
isPainted = value!;
|
||||
if (value == false) {
|
||||
_notPaintedUnitVal = 0;
|
||||
} else {
|
||||
_notPaintedUnitVal = 10;
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Container(
|
||||
height: 40.0,
|
||||
width: 100,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
border: Border.all(
|
||||
color: Colors.grey,
|
||||
width: 1.0,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(5.0),
|
||||
Row(
|
||||
children: [
|
||||
Checkbox(
|
||||
value: isPainted,
|
||||
onChanged: (bool? value) {
|
||||
setState(() {
|
||||
isPainted = value!;
|
||||
if (value == false) {
|
||||
_notPaintedUnitVal = 0;
|
||||
} else {
|
||||
_notPaintedUnitVal = 10;
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Container(
|
||||
height: 40.0,
|
||||
width: 100,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
border: Border.all(
|
||||
color: Colors.grey,
|
||||
width: 1.0,
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(' - ' +
|
||||
_notPaintedUnitVal
|
||||
.toString() +
|
||||
'%')),
|
||||
borderRadius:
|
||||
BorderRadius.circular(5.0),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
' - $_notPaintedUnitVal%')),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
const Text('Uses second hand materials?'),
|
||||
|
|
|
@ -1,24 +1,20 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
import 'package:im_stepper/stepper.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:unit2/model/offline/offline_profile.dart';
|
||||
import 'package:unit2/screens/offline/passo/building/add/building_and_structure.dart';
|
||||
import 'package:unit2/screens/offline/passo/building/add/drawing_pad.dart';
|
||||
import 'package:unit2/screens/offline/passo/building/add/flutter_painter.dart';
|
||||
import 'package:unit2/screens/offline/passo/building/add/imagePicker.dart';
|
||||
import 'package:unit2/screens/offline/passo/building/add/property_appraisal.dart';
|
||||
import 'package:unit2/screens/offline/passo/building/add/property_assessment.dart';
|
||||
import 'package:unit2/screens/offline/passo/building/add/property_owner_info.dart';
|
||||
import 'package:unit2/screens/offline/passo/building/add/additional_items.dart';
|
||||
import 'package:unit2/screens/offline/passo/building/add/general_description.dart';
|
||||
import 'package:unit2/screens/offline/passo/building/add/landref_location.dart';
|
||||
import 'package:unit2/screens/offline/passo/building/add/signature_and_ids.dart';
|
||||
import 'package:unit2/screens/offline/passo/building/add/structural_material.dart';
|
||||
import 'package:unit2/theme-data.dart/colors.dart';
|
||||
|
||||
import '../../../../../bloc/offline/offline_passo/building/owner_info_bloc/crud_bloc.dart';
|
||||
import '../../../../../model/passo/property_info.dart';
|
||||
import '../../../../../utils/alerts.dart';
|
||||
|
||||
GlobalKey<FormBuilderState> offlineBldgKey = GlobalKey<FormBuilderState>();
|
||||
|
@ -33,7 +29,7 @@ class AddBuilding extends StatefulWidget {
|
|||
|
||||
class _AddBuilding extends State<AddBuilding> {
|
||||
int activeStep = 0; // Initial step set to 5.
|
||||
int upperBound = 7;
|
||||
int upperBound = 8;
|
||||
|
||||
List<String> foundation = [];
|
||||
List<String> column = [];
|
||||
|
@ -67,6 +63,12 @@ class _AddBuilding extends State<AddBuilding> {
|
|||
});
|
||||
}
|
||||
|
||||
void Skipto9() {
|
||||
setState(() {
|
||||
activeStep = 8; // Set activeStep directly to 9
|
||||
});
|
||||
}
|
||||
|
||||
void updateFoundation(List<String> updatedList) {
|
||||
setState(() {
|
||||
foundation = updatedList;
|
||||
|
@ -190,10 +192,10 @@ class _AddBuilding extends State<AddBuilding> {
|
|||
),
|
||||
body: Column(children: [
|
||||
NumberStepper(
|
||||
numbers: [1, 2, 3, 4, 5, 6, 7, 8, 9],
|
||||
numbers: const [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
||||
stepPadding: 5,
|
||||
activeStepColor: primary,
|
||||
numberStyle: TextStyle(color: Colors.white),
|
||||
numberStyle: const TextStyle(color: Colors.white),
|
||||
lineColor: primary,
|
||||
// activeStep property set to activeStep variable defined above.
|
||||
activeStep: activeStep,
|
||||
|
@ -217,7 +219,7 @@ class _AddBuilding extends State<AddBuilding> {
|
|||
},
|
||||
autovalidateMode: AutovalidateMode.disabled,
|
||||
child: Container(
|
||||
child: content(PrevBtn, NextBtn),
|
||||
child: content(PrevBtn, NextBtn, Skipto9),
|
||||
),
|
||||
);
|
||||
}),
|
||||
|
@ -227,7 +229,7 @@ class _AddBuilding extends State<AddBuilding> {
|
|||
);
|
||||
}
|
||||
|
||||
Widget content(PrevBtn, NextBtn) {
|
||||
Widget content(PrevBtn, NextBtn, Skipto9) {
|
||||
switch (activeStep) {
|
||||
case 0:
|
||||
return PropertyInfoOfflinePage(NextBtn, widget.offlineProfile);
|
||||
|
@ -248,18 +250,15 @@ class _AddBuilding extends State<AddBuilding> {
|
|||
updatedBldgKind,
|
||||
updatedBldgType);
|
||||
case 3:
|
||||
return FlutterDraw();
|
||||
return const FlutterDraw();
|
||||
|
||||
case 4:
|
||||
return BuildingAndStructureOfflinePage(
|
||||
PrevBtn, NextBtn, widget.offlineProfile);
|
||||
|
||||
case 5:
|
||||
return StatefulBuilder(
|
||||
builder: (context, StateSetter setInnerState) =>
|
||||
StructuralMaterialsOfflinePage(
|
||||
PrevBtn,
|
||||
NextBtn,
|
||||
Skipto9,
|
||||
foundationOthers: foundationOthers,
|
||||
columOthers: columOthers,
|
||||
beamsOthers: beamsOthers,
|
||||
|
@ -289,7 +288,9 @@ class _AddBuilding extends State<AddBuilding> {
|
|||
updateFlooringOthers: updateFlooringOthers,
|
||||
updateWpOthers: updateWpOthers,
|
||||
));
|
||||
|
||||
case 5:
|
||||
return BuildingAndStructureOfflinePage(
|
||||
PrevBtn, NextBtn, widget.offlineProfile);
|
||||
case 6:
|
||||
return AdditionalItemOfflinePage(
|
||||
PrevBtn, NextBtn, widget.offlineProfile);
|
||||
|
@ -300,10 +301,16 @@ class _AddBuilding extends State<AddBuilding> {
|
|||
|
||||
case 8:
|
||||
return PropertyAssessmentOfflinePage(
|
||||
onCloseTransaction, widget.offlineProfile);
|
||||
onCloseTransaction,
|
||||
widget.offlineProfile,
|
||||
PrevBtn,
|
||||
NextBtn,
|
||||
);
|
||||
case 9:
|
||||
return SignatureAndIds(widget.offlineProfile, onCloseTransaction);
|
||||
|
||||
default:
|
||||
return Text("Property Info");
|
||||
return const Text("Property Info");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:ui' as ui;
|
||||
|
||||
|
@ -10,8 +9,6 @@ import 'package:flutter_drawing_board/flutter_drawing_board.dart';
|
|||
import 'package:flutter_drawing_board/paint_contents.dart';
|
||||
import 'package:flutter_drawing_board/paint_extension.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:unit2/utils/request_permission.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:unit2/utils/urls.dart'; // Removed 'as http'
|
||||
|
||||
|
|
|
@ -2,12 +2,12 @@ import 'dart:async';
|
|||
import 'dart:io';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:http/http.dart'; // Removed 'as http'
|
||||
import 'package:path/path.dart'; // For basename function
|
||||
import 'dart:convert';
|
||||
// Removed 'as http'
|
||||
// For basename function
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_painter_v2/flutter_painter.dart';
|
||||
import 'package:flutter_painter_v2/flutter_painter_extensions.dart';
|
||||
import 'package:flutter_painter_v2/flutter_painter_pure.dart';
|
||||
|
@ -20,8 +20,6 @@ import 'package:phosphor_flutter/phosphor_flutter.dart';
|
|||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:unit2/model/passo/floor_sketch.dart';
|
||||
|
||||
import 'package:unit2/utils/urls.dart';
|
||||
|
||||
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||
|
||||
class FlutterDraw extends StatefulWidget {
|
||||
|
@ -47,34 +45,8 @@ class _FlutterPainterExampleState extends State<FlutterDraw> {
|
|||
final String imagePath = '/data/user/0/com.app.rpass/cache/182.png';
|
||||
|
||||
static const List<String> imageLinks = [
|
||||
"https://i.imgur.com/btoI5OX.png",
|
||||
"https://i.imgur.com/EXTQFt7.png",
|
||||
"https://i.imgur.com/EDNjJYL.png",
|
||||
"https://i.imgur.com/uQKD6NL.png",
|
||||
"https://i.imgur.com/cMqVRbl.png",
|
||||
"https://i.imgur.com/1cJBAfI.png",
|
||||
"https://i.imgur.com/eNYfHKL.png",
|
||||
"https://i.imgur.com/c4Ag5yt.png",
|
||||
"https://i.imgur.com/GhpCJuf.png",
|
||||
"https://i.imgur.com/XVMeluF.png",
|
||||
"https://i.imgur.com/mt2yO6Z.png",
|
||||
"https://i.imgur.com/rw9XP1X.png",
|
||||
"https://i.imgur.com/pD7foZ8.png",
|
||||
"https://i.imgur.com/13Y3vp2.png",
|
||||
"https://i.imgur.com/ojv3yw1.png",
|
||||
"https://i.imgur.com/f8ZNJJ7.png",
|
||||
"https://i.imgur.com/BiYkHzw.png",
|
||||
"https://i.imgur.com/snJOcEz.png",
|
||||
"https://i.imgur.com/b61cnhi.png",
|
||||
"https://i.imgur.com/FkDFzYe.png",
|
||||
"https://i.imgur.com/P310x7d.png",
|
||||
"https://i.imgur.com/5AHZpua.png",
|
||||
"https://i.imgur.com/tmvJY4r.png",
|
||||
"https://i.imgur.com/PdVfGkV.png",
|
||||
"https://i.imgur.com/1PRzwBf.png",
|
||||
"https://i.imgur.com/VeeMfBS.png",
|
||||
"assets/pngs/broken_lines.png", // Ensure the file path is correct
|
||||
];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
@ -103,6 +75,19 @@ class _FlutterPainterExampleState extends State<FlutterDraw> {
|
|||
initBackground();
|
||||
}
|
||||
|
||||
Future<bool> _fileExists(String path) async {
|
||||
return File(path).exists();
|
||||
}
|
||||
|
||||
Future<ui.Image> _loadImageFromAsset(String assetPath) async {
|
||||
final Completer<ui.Image> completer = Completer();
|
||||
final ByteData data = await rootBundle.load(assetPath);
|
||||
ui.decodeImageFromList(data.buffer.asUint8List(), (ui.Image img) {
|
||||
completer.complete(img);
|
||||
});
|
||||
return completer.future;
|
||||
}
|
||||
|
||||
/// Fetches image from an [ImageProvider] (in this example, [NetworkImage])
|
||||
/// to use it as a background
|
||||
void initBackground() async {
|
||||
|
@ -110,21 +95,37 @@ class _FlutterPainterExampleState extends State<FlutterDraw> {
|
|||
final floorSketchSaved = prefs.getBool('floorSketchSaved') ?? false;
|
||||
final tempID = prefs.getInt('tempid');
|
||||
|
||||
print(floorSketchSaved);
|
||||
print('FloorSketchSaved: $floorSketchSaved, TempID: $tempID');
|
||||
|
||||
ui.Image image;
|
||||
|
||||
if (floorSketchSaved && tempID != null) {
|
||||
final String imagePath = '/data/user/0/com.app.rpass/cache/$tempID.png';
|
||||
image = await _loadImageFromPath(imagePath);
|
||||
} else {
|
||||
image = await const AssetImage('assets/pngs/white_bg.png').image;
|
||||
}
|
||||
try {
|
||||
if (floorSketchSaved && tempID != null) {
|
||||
final String imagePath = '/data/user/0/com.app.rpass/cache/$tempID.png';
|
||||
print('Checking file: $imagePath');
|
||||
if (await _fileExists(imagePath)) {
|
||||
print('File exists. Loading from path.');
|
||||
image = await _loadImageFromPath(imagePath);
|
||||
} else {
|
||||
print('File does not exist. Falling back to default.');
|
||||
image = await _loadImageFromAsset('assets/pngs/white_bg.png');
|
||||
}
|
||||
} else {
|
||||
print('Loading default background from assets.');
|
||||
image = await _loadImageFromAsset('assets/pngs/white_bg.png');
|
||||
}
|
||||
|
||||
setState(() {
|
||||
backgroundImage = image;
|
||||
controller.background = image.backgroundDrawable;
|
||||
});
|
||||
setState(() {
|
||||
backgroundImage = image;
|
||||
controller.background = image.backgroundDrawable;
|
||||
print('Background image set successfully.');
|
||||
});
|
||||
} catch (e) {
|
||||
print('Error loading background image: $e');
|
||||
setState(() {
|
||||
backgroundImage = null; // Fallback for rendering
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// Updates UI when the focus changes
|
||||
|
@ -226,7 +227,7 @@ class _FlutterPainterExampleState extends State<FlutterDraw> {
|
|||
child: FloatingActionButton(
|
||||
heroTag: 'btn1',
|
||||
child: const Icon(
|
||||
PhosphorIcons.imageFill,
|
||||
PhosphorIcons.download,
|
||||
),
|
||||
onPressed: () => renderAndDisplayImage(context),
|
||||
),
|
||||
|
@ -448,7 +449,7 @@ class _FlutterPainterExampleState extends State<FlutterDraw> {
|
|||
),
|
||||
],
|
||||
),
|
||||
]
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -594,14 +595,30 @@ class _FlutterPainterExampleState extends State<FlutterDraw> {
|
|||
}
|
||||
|
||||
void addSticker(BuildContext context) async {
|
||||
// Select the image link from the dialog
|
||||
final imageLink = await showDialog<String>(
|
||||
context: context,
|
||||
builder: (context) => const SelectStickerImageDialog(
|
||||
imagesLinks: imageLinks,
|
||||
));
|
||||
context: context,
|
||||
builder: (context) => const SelectStickerImageDialog(
|
||||
imagesLinks: imageLinks,
|
||||
),
|
||||
);
|
||||
|
||||
if (imageLink == null) return;
|
||||
controller.addImage(
|
||||
await NetworkImage(imageLink).image, const Size(100, 100));
|
||||
|
||||
// Use AssetImage for the asset
|
||||
final AssetImage assetImage = AssetImage(imageLink);
|
||||
|
||||
// Resolve the ImageProvider to get the actual image
|
||||
final ImageStream stream = assetImage.resolve(const ImageConfiguration());
|
||||
final Completer<ImageInfo> completer = Completer();
|
||||
stream.addListener(ImageStreamListener((ImageInfo info, bool _) {
|
||||
completer.complete(info);
|
||||
}));
|
||||
|
||||
final ImageInfo imageInfo = await completer.future;
|
||||
|
||||
// Add the image to the controller
|
||||
controller.addImage(imageInfo.image, const Size(100, 100));
|
||||
}
|
||||
|
||||
void setFreeStyleStrokeWidth(double value) {
|
||||
|
@ -816,3 +833,32 @@ class SelectStickerImageDialog extends StatelessWidget {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
class GridPainter extends CustomPainter {
|
||||
final double gridSize;
|
||||
final Paint gridPaint;
|
||||
|
||||
GridPainter(this.gridSize)
|
||||
: gridPaint = Paint()
|
||||
..color = Colors.grey.withOpacity(0.5)
|
||||
..strokeWidth = 1;
|
||||
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
for (double x = 0; x < size.width; x += gridSize) {
|
||||
canvas.drawLine(Offset(x, 0), Offset(x, size.height), gridPaint);
|
||||
}
|
||||
for (double y = 0; y < size.height; y += gridSize) {
|
||||
canvas.drawLine(Offset(0, y), Offset(size.width, y), gridPaint);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldRepaint(covariant CustomPainter oldDelegate) => false;
|
||||
}
|
||||
|
||||
Offset snapToGrid(Offset point, double gridSize) {
|
||||
final x = (point.dx / gridSize).round() * gridSize;
|
||||
final y = (point.dy / gridSize).round() * gridSize;
|
||||
return Offset(x, y);
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@ import 'dart:convert';
|
|||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:form_builder_validators/form_builder_validators.dart';
|
||||
import 'package:searchfield/searchfield.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
@ -12,7 +10,6 @@ import 'package:unit2/bloc/offline/offline_passo/building/general_description/ge
|
|||
import 'package:unit2/model/offline/offline_profile.dart';
|
||||
import 'package:unit2/screens/offline/passo/building/add/add_building.dart';
|
||||
|
||||
import '../../../../../model/passo/general_description.dart';
|
||||
import '../../../../../model/passo/unit_construct.dart';
|
||||
import '../../../../../theme-data.dart/form-style.dart';
|
||||
import '../../../../../widgets/passo/custom_button.dart';
|
||||
|
|
|
@ -2,10 +2,8 @@ import 'package:flutter/material.dart';
|
|||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:http/http.dart'; // Removed 'as http'
|
||||
import 'package:path/path.dart'; // For basename function
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:unit2/model/location/purok.dart';
|
||||
import 'package:unit2/utils/urls.dart';
|
||||
|
||||
class ImagePickerScreen extends StatefulWidget {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:unit2/bloc/offline/offline_passo/admin/barangay_admin/barangay_admin_bloc.dart';
|
||||
import 'package:unit2/bloc/offline/offline_passo/admin/municipalities_admin/municipalities_admin_bloc.dart';
|
||||
|
@ -145,46 +144,46 @@ class _LandRefLocationOfflinePage extends State<LandRefLocationOfflinePage> {
|
|||
fontWeight: FontWeight.bold, fontSize: 18),
|
||||
textAlign: TextAlign.left),
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 50, // Adjust the width as needed
|
||||
height: 50, // Adjust the height as needed
|
||||
child: Checkbox(
|
||||
checkColor: Colors.white,
|
||||
value: sameOwner,
|
||||
onChanged: (bool? value) {
|
||||
setState(() {
|
||||
sameOwner = value!;
|
||||
offlineBldgKey.currentState!
|
||||
.patchValue({
|
||||
'l_owner': offlineBldgKey.currentState
|
||||
?.value['fname'] +
|
||||
' ' +
|
||||
offlineBldgKey.currentState
|
||||
?.value['mname'] +
|
||||
' ' +
|
||||
offlineBldgKey
|
||||
.currentState?.value['lname']
|
||||
});
|
||||
offlineBldgKey.currentState!
|
||||
.patchValue({
|
||||
'l_td_arp': offlineBldgKey
|
||||
.currentState?.value['arp_td']
|
||||
});
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
Text('Same building owner')
|
||||
],
|
||||
),
|
||||
// Other widgets in the column
|
||||
],
|
||||
),
|
||||
// Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// children: [
|
||||
// Row(
|
||||
// children: [
|
||||
// SizedBox(
|
||||
// width: 50, // Adjust the width as needed
|
||||
// height: 50, // Adjust the height as needed
|
||||
// child: Checkbox(
|
||||
// checkColor: Colors.white,
|
||||
// value: sameOwner,
|
||||
// onChanged: (bool? value) {
|
||||
// setState(() {
|
||||
// sameOwner = value!;
|
||||
// offlineBldgKey.currentState!
|
||||
// .patchValue({
|
||||
// 'l_owner': offlineBldgKey.currentState
|
||||
// ?.value['fname'] +
|
||||
// ' ' +
|
||||
// offlineBldgKey.currentState
|
||||
// ?.value['mname'] +
|
||||
// ' ' +
|
||||
// offlineBldgKey
|
||||
// .currentState?.value['lname']
|
||||
// });
|
||||
// offlineBldgKey.currentState!
|
||||
// .patchValue({
|
||||
// 'l_td_arp': offlineBldgKey
|
||||
// .currentState?.value['arp_td']
|
||||
// });
|
||||
// });
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// Text('Same building owner')
|
||||
// ],
|
||||
// ),
|
||||
// // Other widgets in the column
|
||||
// ],
|
||||
// ),
|
||||
customTextField(
|
||||
"Land Owner", "", 'l_owner', TextInputType.text),
|
||||
Row(
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,15 +1,13 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
import 'package:form_builder_validators/form_builder_validators.dart';
|
||||
import 'package:searchfield/searchfield.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:unit2/bloc/offline/offline_passo/admin/memoranda/memoranda_admin_bloc.dart';
|
||||
import 'package:unit2/bloc/offline/offline_passo/admin/signatories/signatories_admin_bloc.dart';
|
||||
import 'package:unit2/bloc/offline/offline_passo/building/swornstatement/sworn_statement_bloc.dart';
|
||||
import 'package:unit2/model/offline/offline_profile.dart';
|
||||
import 'package:unit2/screens/offline/passo/building/add/add_building.dart';
|
||||
import 'package:accordion/accordion.dart';
|
||||
import 'package:accordion/controllers.dart';
|
||||
import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart';
|
||||
|
||||
import '../../../../../bloc/offline/offline_passo/building/additional_items_offline/additional_items_offline_bloc.dart';
|
||||
|
@ -19,15 +17,17 @@ import '../../../../../model/passo/additional_items.dart';
|
|||
import '../../../../../model/passo/building_and_structure.dart';
|
||||
import '../../../../../model/passo/memoranda.dart';
|
||||
import '../../../../../model/passo/signatories.dart';
|
||||
import '../../../../../theme-data.dart/colors.dart';
|
||||
import '../../../../../theme-data.dart/form-style.dart';
|
||||
import 'package:intl/intl.dart'; // Import the intl package
|
||||
|
||||
import '../../../../../widgets/passo/custom_button.dart'; // Import the intl package
|
||||
|
||||
class PropertyAssessmentOfflinePage extends StatefulWidget {
|
||||
Function function;
|
||||
final OfflineProfile offlineProfile;
|
||||
final VoidCallback NextBtn;
|
||||
final VoidCallback PrevBtn;
|
||||
|
||||
PropertyAssessmentOfflinePage(this.function, this.offlineProfile);
|
||||
PropertyAssessmentOfflinePage(
|
||||
this.function, this.offlineProfile, this.NextBtn, this.PrevBtn);
|
||||
|
||||
@override
|
||||
_PropertyAssessmentOfflinePage createState() =>
|
||||
|
@ -39,6 +39,8 @@ class _PropertyAssessmentOfflinePage
|
|||
double assessment_level = 0;
|
||||
bool isTaxable = false;
|
||||
bool isExempt = false;
|
||||
bool isOwner = false;
|
||||
bool isRepresentative = false;
|
||||
String _memoranda = "";
|
||||
String _notes = "";
|
||||
String appraised_by = "";
|
||||
|
@ -52,7 +54,7 @@ class _PropertyAssessmentOfflinePage
|
|||
final appraisedByFocus = FocusNode();
|
||||
final recByFocus = FocusNode();
|
||||
final apprvdByFocus = FocusNode();
|
||||
|
||||
final civilStatus = ["Single", "Married", "Divorced", "Separated", "Widowed"];
|
||||
final quarter = ['1st', '2nd', '3rd', '4th'];
|
||||
|
||||
TextEditingController memorandaController = TextEditingController();
|
||||
|
@ -496,6 +498,7 @@ class _PropertyAssessmentOfflinePage
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var width = MediaQuery.of(context).size.width;
|
||||
|
||||
return BlocConsumer<MemorandaAdminBloc, MemorandaAdminState>(
|
||||
listener: (context, state) {
|
||||
// TODO: implement listener
|
||||
|
@ -632,14 +635,128 @@ class _PropertyAssessmentOfflinePage
|
|||
.number)),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.spaceAround,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Text('Owner'),
|
||||
Checkbox(
|
||||
checkColor:
|
||||
Colors.white,
|
||||
value: isOwner,
|
||||
onChanged:
|
||||
(bool? value) {
|
||||
setState(() {
|
||||
isOwner = value!;
|
||||
});
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
const Text(
|
||||
'Representative'),
|
||||
Checkbox(
|
||||
checkColor:
|
||||
Colors.white,
|
||||
value: isRepresentative,
|
||||
onChanged:
|
||||
(bool? value) {
|
||||
setState(() {
|
||||
isRepresentative =
|
||||
value!;
|
||||
});
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Visibility(
|
||||
visible: isRepresentative,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: customTextField(
|
||||
'First Name',
|
||||
'',
|
||||
'r_fname',
|
||||
TextInputType.text),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
child: customTextField(
|
||||
'Middle Name',
|
||||
'',
|
||||
'r_mname',
|
||||
TextInputType.text),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
child: customTextField(
|
||||
'Last Name',
|
||||
'',
|
||||
'r_lname',
|
||||
TextInputType.text),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Visibility(
|
||||
visible: isRepresentative,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: customDropDownField(
|
||||
"Civil Status",
|
||||
"",
|
||||
"r_civilStatus",
|
||||
civilStatus),
|
||||
),
|
||||
const SizedBox(width: 10.0),
|
||||
Expanded(
|
||||
// optional flex property if flex is 1 because the default flex is 1
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"Citizenship",
|
||||
"",
|
||||
'r_citizenship',
|
||||
TextInputType.text),
|
||||
),
|
||||
]),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
const Divider(
|
||||
thickness: 2,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
|
@ -1340,122 +1457,235 @@ class _PropertyAssessmentOfflinePage
|
|||
const SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
final tempID =
|
||||
await SharedPreferences
|
||||
.getInstance();
|
||||
print(
|
||||
tempID.getInt('tempid')! - 1);
|
||||
// final List<PropertyAssessment>
|
||||
// propertyAssessments = [];
|
||||
DateTime? appDate = offlineBldgKey
|
||||
.currentState!
|
||||
.value['app_date'];
|
||||
DateTime? recDate = offlineBldgKey
|
||||
.currentState!
|
||||
.value['rec_date'];
|
||||
DateTime? approveDate =
|
||||
offlineBldgKey.currentState!
|
||||
.value['approve_date'];
|
||||
DateTime? dateReceived =
|
||||
offlineBldgKey.currentState!
|
||||
.value['date_received'];
|
||||
DateTime? entryDate =
|
||||
offlineBldgKey.currentState!
|
||||
.value['date_of_entry'];
|
||||
String appDateString =
|
||||
appDate != null
|
||||
? appDate.toString()
|
||||
: '';
|
||||
String recDateString =
|
||||
recDate != null
|
||||
? recDate.toString()
|
||||
: '';
|
||||
String approveDateString =
|
||||
approveDate != null
|
||||
? approveDate.toString()
|
||||
: '';
|
||||
String receivedDateString =
|
||||
recDate != null
|
||||
? recDate.toString()
|
||||
: '';
|
||||
String entryDateString =
|
||||
recDate != null
|
||||
? recDate.toString()
|
||||
: '';
|
||||
context.read<BldgAssessmentOfflineBloc>().add(
|
||||
AddBldgAssessment(
|
||||
id: 1,
|
||||
bldgapprDetailsId: tempID
|
||||
.getInt('tempid')!,
|
||||
assessedById: widget
|
||||
.offlineProfile.id
|
||||
.toString(),
|
||||
assessedByName: widget
|
||||
.offlineProfile
|
||||
.firstName!,
|
||||
dateCreated: '',
|
||||
dateModified: '',
|
||||
actualUse: offlineBldgKey.currentState!.value['actual_use'] ??
|
||||
'', // Replace null with an empty string
|
||||
marketValue:
|
||||
_calculateMarketValue(addItem, state.bldgAndStructure)
|
||||
.toString(),
|
||||
assessmentLevel: assessmentLevel(
|
||||
_calculateMarketValue(
|
||||
addItem,
|
||||
state
|
||||
.bldgAndStructure),
|
||||
offlineBldgKey
|
||||
.currentState
|
||||
?.value['actual_use']),
|
||||
assessedValue: assessmentValue(_calculateMarketValue(addItem, state.bldgAndStructure), offlineBldgKey.currentState?.value['actual_use']).toString(),
|
||||
taxable: isTaxable == true ? '1' : '0',
|
||||
exempt: isExempt == true ? '1' : '0',
|
||||
qtr: offlineBldgKey.currentState!.value['qtr'] ?? '0', // Replace null with '0'
|
||||
yr: int.parse(offlineBldgKey.currentState!.value['yr'] ?? '0'), // Replace null with '0'
|
||||
appraisedbyName: appraised_by,
|
||||
appraisedbyDate: appDateString, // Replace null with current date
|
||||
recommendapprName: rec_by,
|
||||
recommendapprDate: recDateString, // Replace null with current date
|
||||
approvedbyName: approved_by,
|
||||
approvedbyDate: approveDateString,
|
||||
memoranda: _memoranda,
|
||||
note: _notes,
|
||||
swornstatementNo: offlineBldgKey.currentState!.value['sworn_statement'] ?? " ", // Replace null with an empty string
|
||||
dateReceived: receivedDateString,
|
||||
// Replace null with current date
|
||||
entryDateAssessment: entryDateString,
|
||||
// Replace null with current date
|
||||
entryDateBy: widget.offlineProfile.firstName!,
|
||||
genCode: '5th',
|
||||
appraisedbyDesignation: appraised_by_designation,
|
||||
approvedbyDesignation: approved_by_designation,
|
||||
recommendapprDesignation: rec_by_designation
|
||||
// Replace null with an empty string
|
||||
));
|
||||
// print('assess');
|
||||
// print((asses));
|
||||
|
||||
widget.function();
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: primary,
|
||||
foregroundColor: Colors.red),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(15.0),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'Save',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
CustomButton(
|
||||
icon: const Icon(
|
||||
Icons.chevron_left_rounded,
|
||||
color: Colors.white),
|
||||
onPressed: () {
|
||||
{
|
||||
widget.NextBtn();
|
||||
}
|
||||
;
|
||||
},
|
||||
),
|
||||
),
|
||||
CustomButton(
|
||||
icon: const Icon(
|
||||
Icons.chevron_right_rounded,
|
||||
color: Colors.white),
|
||||
onPressed: () async {
|
||||
final prefs =
|
||||
await SharedPreferences
|
||||
.getInstance();
|
||||
final tempID =
|
||||
prefs.getInt('tempid')!;
|
||||
|
||||
// Simplified date retrieval
|
||||
Map<String, DateTime?>
|
||||
dateFields = {
|
||||
'app_date': offlineBldgKey
|
||||
.currentState!
|
||||
.value['app_date'],
|
||||
'rec_date': offlineBldgKey
|
||||
.currentState!
|
||||
.value['rec_date'],
|
||||
'approve_date':
|
||||
offlineBldgKey
|
||||
.currentState!
|
||||
.value[
|
||||
'approve_date'],
|
||||
'date_received':
|
||||
offlineBldgKey
|
||||
.currentState!
|
||||
.value[
|
||||
'date_received'],
|
||||
'date_of_entry':
|
||||
offlineBldgKey
|
||||
.currentState!
|
||||
.value[
|
||||
'date_of_entry'],
|
||||
};
|
||||
|
||||
String formatDate(
|
||||
DateTime? date) =>
|
||||
date?.toString() ?? '';
|
||||
|
||||
// Extracted Strings for date fields
|
||||
String appDateString =
|
||||
formatDate(dateFields[
|
||||
'app_date']);
|
||||
String recDateString =
|
||||
formatDate(dateFields[
|
||||
'rec_date']);
|
||||
String approveDateString =
|
||||
formatDate(dateFields[
|
||||
'approve_date']);
|
||||
String receivedDateString =
|
||||
formatDate(dateFields[
|
||||
'date_received']);
|
||||
String entryDateString =
|
||||
formatDate(dateFields[
|
||||
'date_of_entry']);
|
||||
|
||||
// Assessment Calculation
|
||||
double calculatedMarketValue =
|
||||
_calculateMarketValue(
|
||||
addItem,
|
||||
state
|
||||
.bldgAndStructure);
|
||||
String marketValue =
|
||||
calculatedMarketValue
|
||||
.toString();
|
||||
String assessedValue =
|
||||
assessmentValue(
|
||||
calculatedMarketValue,
|
||||
offlineBldgKey
|
||||
.currentState
|
||||
?.value[
|
||||
'actual_use'])
|
||||
.toString();
|
||||
String assessmentLevelString =
|
||||
assessmentLevel(
|
||||
calculatedMarketValue,
|
||||
offlineBldgKey
|
||||
.currentState
|
||||
?.value[
|
||||
'actual_use']);
|
||||
|
||||
context
|
||||
.read<
|
||||
BldgAssessmentOfflineBloc>()
|
||||
.add(AddBldgAssessment(
|
||||
id: 1,
|
||||
bldgapprDetailsId:
|
||||
tempID,
|
||||
assessedById: widget
|
||||
.offlineProfile.id
|
||||
.toString(),
|
||||
assessedByName: widget
|
||||
.offlineProfile
|
||||
.firstName!,
|
||||
dateCreated: '',
|
||||
dateModified: '',
|
||||
actualUse: offlineBldgKey
|
||||
.currentState!
|
||||
.value[
|
||||
'actual_use'] ??
|
||||
'',
|
||||
marketValue:
|
||||
marketValue,
|
||||
assessmentLevel:
|
||||
assessmentLevelString,
|
||||
assessedValue:
|
||||
assessedValue,
|
||||
taxable: isTaxable
|
||||
? '1'
|
||||
: '0',
|
||||
exempt: isExempt
|
||||
? '1'
|
||||
: '0',
|
||||
qtr: offlineBldgKey
|
||||
.currentState!
|
||||
.value['qtr'] ??
|
||||
'0',
|
||||
yr: int.parse(offlineBldgKey
|
||||
.currentState!
|
||||
.value['yr'] ??
|
||||
'0'),
|
||||
appraisedbyName:
|
||||
appraised_by,
|
||||
appraisedbyDate:
|
||||
appDateString,
|
||||
recommendapprName:
|
||||
rec_by,
|
||||
recommendapprDate:
|
||||
recDateString,
|
||||
approvedbyName:
|
||||
approved_by,
|
||||
approvedbyDate:
|
||||
approveDateString,
|
||||
memoranda: _memoranda,
|
||||
note: _notes,
|
||||
swornstatementNo: offlineBldgKey
|
||||
.currentState!
|
||||
.value[
|
||||
'sworn_statement'] ??
|
||||
" ",
|
||||
dateReceived:
|
||||
receivedDateString,
|
||||
entryDateAssessment:
|
||||
entryDateString,
|
||||
entryDateBy: widget
|
||||
.offlineProfile
|
||||
.firstName!,
|
||||
genCode: '5th',
|
||||
appraisedbyDesignation:
|
||||
appraised_by_designation,
|
||||
approvedbyDesignation:
|
||||
approved_by_designation,
|
||||
recommendapprDesignation:
|
||||
rec_by_designation,
|
||||
));
|
||||
|
||||
context
|
||||
.read<
|
||||
SwornStatementBloc>()
|
||||
.add(
|
||||
AddSwornStatement(
|
||||
bldgapprDetailsId:
|
||||
tempID,
|
||||
fname: isRepresentative
|
||||
? offlineBldgKey
|
||||
.currentState!
|
||||
.value[
|
||||
'r_fname']
|
||||
: offlineBldgKey
|
||||
.currentState!
|
||||
.value['fname'],
|
||||
mname: isRepresentative
|
||||
? offlineBldgKey
|
||||
.currentState!
|
||||
.value[
|
||||
'r_mname']
|
||||
: offlineBldgKey
|
||||
.currentState!
|
||||
.value['mname'],
|
||||
lname: isRepresentative
|
||||
? offlineBldgKey
|
||||
.currentState!
|
||||
.value[
|
||||
'r_lname']
|
||||
: offlineBldgKey
|
||||
.currentState!
|
||||
.value['lname'],
|
||||
citizenship: isRepresentative
|
||||
? offlineBldgKey
|
||||
.currentState!
|
||||
.value[
|
||||
'r_citizenship']
|
||||
: offlineBldgKey
|
||||
.currentState!
|
||||
.value[
|
||||
'citizenship'],
|
||||
civilStatus: isRepresentative
|
||||
? offlineBldgKey
|
||||
.currentState!
|
||||
.value[
|
||||
'r_civilStatus']
|
||||
: offlineBldgKey
|
||||
.currentState!
|
||||
.value[
|
||||
'civil_status'],
|
||||
genCode: '5TH',
|
||||
),
|
||||
);
|
||||
widget.PrevBtn;
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -21,6 +21,7 @@ class PropertyInfoOfflinePage extends StatefulWidget {
|
|||
class _PropertyInfoPage extends State<PropertyInfoOfflinePage> {
|
||||
int tempId = 0;
|
||||
final transaction_codes = ['New', 'Revision'];
|
||||
final civilStatus = ["Single", "Married", "Divorced", "Separated", "Widowed"];
|
||||
final DateTime now;
|
||||
final String formatter;
|
||||
bool isOptional = false;
|
||||
|
@ -86,6 +87,22 @@ class _PropertyInfoPage extends State<PropertyInfoOfflinePage> {
|
|||
"Last Name", "", 'lname', TextInputType.text),
|
||||
)
|
||||
]),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: customDropDownField(
|
||||
"Civil Status", "", "civil_status", civilStatus),
|
||||
),
|
||||
const SizedBox(width: 10.0),
|
||||
Expanded(
|
||||
// optional flex property if flex is 1 because the default flex is 1
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"Citizenship", "", 'citizenship', TextInputType.text),
|
||||
),
|
||||
]),
|
||||
customDatTimePicker("Birthday", "", "bday"),
|
||||
customTextField("Address", "", 'address', TextInputType.text),
|
||||
Column(
|
||||
|
@ -218,6 +235,8 @@ class _PropertyInfoPage extends State<PropertyInfoOfflinePage> {
|
|||
assessedByName: widget.offlineProfile.firstName!,
|
||||
dateCreated: formatter,
|
||||
dateModified: ' ',
|
||||
citizenship: offlineBldgKey.currentState!.value['citizenship'] ?? ' ',
|
||||
civilStatus: offlineBldgKey.currentState!.value['civil_status'] ?? ' ',
|
||||
genCode: '5th'),
|
||||
);
|
||||
widget.handleButtonPress();
|
||||
|
|
|
@ -0,0 +1,335 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'dart:io';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:signature/signature.dart';
|
||||
import 'package:unit2/model/offline/offline_profile.dart';
|
||||
import 'package:unit2/model/passo/esignature.dart';
|
||||
import 'package:unit2/model/passo/valid_ids.dart';
|
||||
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||
import 'dart:ui' as ui;
|
||||
import 'dart:typed_data';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
class SignatureAndIds extends StatefulWidget {
|
||||
final OfflineProfile offlineProfile;
|
||||
Function function;
|
||||
SignatureAndIds(this.offlineProfile, this.function);
|
||||
|
||||
@override
|
||||
_SignatureAndIds createState() => _SignatureAndIds();
|
||||
}
|
||||
|
||||
class _SignatureAndIds extends State<SignatureAndIds> {
|
||||
List<File> _images = []; // List to hold multiple images
|
||||
final ImagePicker _picker = ImagePicker();
|
||||
SignatureController? _signatureController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_signatureController = SignatureController(
|
||||
penStrokeWidth: 3,
|
||||
penColor: Colors.black87,
|
||||
);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_signatureController!.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
// Function to pick multiple images from the gallery
|
||||
Future<void> _pickImages() async {
|
||||
final List<XFile>? pickedFiles = await _picker.pickMultiImage();
|
||||
|
||||
// Ensure picked files are within the limit
|
||||
if (pickedFiles != null && pickedFiles.length + _images.length <= 6) {
|
||||
// Convert to unique File instances and add to _images
|
||||
List<File> newImages =
|
||||
pickedFiles.map((pickedFile) => File(pickedFile.path)).toList();
|
||||
|
||||
setState(() {
|
||||
_images.addAll(newImages);
|
||||
});
|
||||
|
||||
// Save each image individually
|
||||
for (var imageFile in newImages) {
|
||||
await _saveImageToDatabase(imageFile);
|
||||
}
|
||||
} else {
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||
content: Text('You can only select up to 6 images.'),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
// Function to save image information to the database
|
||||
Future<void> _saveImageToDatabase(File imageFile) async {
|
||||
int? bldgapprDetailsId = await _getBldgapprDetailsId();
|
||||
String dateNw = DateTime.now().toIso8601String();
|
||||
|
||||
ValidIds validID = ValidIds(
|
||||
bldgapprDetailsId: bldgapprDetailsId,
|
||||
validIds: imageFile.path, // Image path
|
||||
dateCreated: dateNw, // Current date
|
||||
genCode: "5TH", // Fixed gen code
|
||||
);
|
||||
|
||||
await _saveOrUpdateValidIds(bldgapprDetailsId!, validID);
|
||||
}
|
||||
|
||||
// Function to check whether to create or update the database record
|
||||
Future<void> _saveOrUpdateValidIds(
|
||||
int bldgapprDetailsId, ValidIds validID) async {
|
||||
final List<Map<String, dynamic>> existingIds =
|
||||
await SQLServices.instance.getValidIds(bldgapprDetailsId);
|
||||
|
||||
print('existng IDS');
|
||||
print(existingIds.length);
|
||||
|
||||
await SQLServices.instance.createValidIds(validID);
|
||||
}
|
||||
|
||||
// Function to capture multiple images (up to 5) from the camera
|
||||
Future<void> _captureImage() async {
|
||||
if (_images.length < 6) {
|
||||
final XFile? image = await _picker.pickImage(source: ImageSource.camera);
|
||||
|
||||
if (image != null) {
|
||||
setState(() {
|
||||
_images.add(File(image.path));
|
||||
});
|
||||
|
||||
await _saveImageToDatabase(File(image.path));
|
||||
}
|
||||
} else {
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||
content: Text('You can only select up to 6 images.'),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
// Function to save image information to the database
|
||||
// Future<void> _saveImageToDatabase(File imageFile) async {
|
||||
// int? bldgapprDetailsId = await _getBldgapprDetailsId();
|
||||
// String dateNw = DateTime.now().toIso8601String();
|
||||
|
||||
// ValidIds validID = ValidIds(
|
||||
// bldgapprDetailsId: bldgapprDetailsId,
|
||||
// validIds: imageFile.path, // Image path
|
||||
// dateCreated: dateNw, // Current date
|
||||
// genCode: "5TH", // Fixed gen code
|
||||
// );
|
||||
|
||||
// await _saveOrUpdateValidIds(bldgapprDetailsId!, validID);
|
||||
// }
|
||||
|
||||
// // Function to check whether to create or update the database record
|
||||
// Future<void> _saveOrUpdateValidIds(
|
||||
// int bldgapprDetailsId, ValidIds validID) async {
|
||||
// final List<Map<String, dynamic>> existingIds =
|
||||
// await SQLServices.instance.getValidIds(bldgapprDetailsId);
|
||||
|
||||
// await SQLServices.instance.createValidIds(validID);
|
||||
|
||||
// }
|
||||
|
||||
Future<int?> _getBldgapprDetailsId() async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
final tempID = prefs.getInt('tempid');
|
||||
return tempID;
|
||||
}
|
||||
|
||||
Future<String?> _saveSignature() async {
|
||||
if (_signatureController!.isNotEmpty) {
|
||||
try {
|
||||
final ui.Image? image = await _signatureController?.toImage();
|
||||
final ByteData? byteData =
|
||||
await image?.toByteData(format: ui.ImageByteFormat.png);
|
||||
final Uint8List pngBytes = byteData!.buffer.asUint8List();
|
||||
|
||||
final directory = await getApplicationDocumentsDirectory();
|
||||
final String path = '${directory.path}/signature.png';
|
||||
|
||||
final File imgFile = File(path);
|
||||
await imgFile.writeAsBytes(pngBytes);
|
||||
print('Signature saved at: $path');
|
||||
|
||||
int? bldgapprDetailsId = await _getBldgapprDetailsId();
|
||||
String dateNw = DateTime.now().toIso8601String();
|
||||
|
||||
final ESignature eSignature = ESignature(
|
||||
bldgapprDetailsId: bldgapprDetailsId,
|
||||
signAttachment: path, // Use the saved signature path
|
||||
dateCreated: dateNw,
|
||||
dateModified: dateNw,
|
||||
genCode: "5TH",
|
||||
);
|
||||
|
||||
await SQLServices.instance.createESignature(eSignature);
|
||||
return path;
|
||||
} catch (e) {
|
||||
print('Error saving signature: $e');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
margin:
|
||||
const EdgeInsets.only(left: 0, top: 20, right: 0, bottom: 10),
|
||||
child: const Text(
|
||||
'ID AND SIGNATUREs',
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18),
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.45,
|
||||
height: MediaQuery.of(context).size.height * 0.6,
|
||||
child: _images.isNotEmpty
|
||||
? ListView.builder(
|
||||
itemCount: _images.length,
|
||||
itemBuilder: (context, index) {
|
||||
return Image.file(_images[index]);
|
||||
},
|
||||
)
|
||||
: Image.asset('assets/pngs/id-card.png'),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
_pickImages();
|
||||
},
|
||||
icon: const Icon(Icons.image, color: Colors.red),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
_captureImage();
|
||||
},
|
||||
icon:
|
||||
const Icon(Icons.camera_alt, color: Colors.red),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.45,
|
||||
height: MediaQuery.of(context).size.height * 0.6,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
border: Border.all(
|
||||
color: Colors.black,
|
||||
width: 0.1,
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.5),
|
||||
spreadRadius: 1,
|
||||
blurRadius: 5,
|
||||
offset: Offset(0, 1),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Signature(
|
||||
controller: _signatureController!,
|
||||
backgroundColor: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(8.0),
|
||||
color: Colors.grey[300],
|
||||
child: const Text(
|
||||
'Signature',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
_saveSignature();
|
||||
},
|
||||
icon: const Icon(Icons.check, color: Colors.red),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
_signatureController?.undo();
|
||||
},
|
||||
icon: const Icon(Icons.undo, color: Colors.red),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
_signatureController?.redo();
|
||||
},
|
||||
icon: const Icon(Icons.redo, color: Colors.red),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
_signatureController?.clear();
|
||||
},
|
||||
icon: const Icon(Icons.clear_rounded,
|
||||
color: Colors.red),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Center(
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 30.0),
|
||||
width: MediaQuery.of(context).size.width * 0.75,
|
||||
height: 50,
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
widget.function();
|
||||
},
|
||||
child: Text("SUBMIT"),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,11 +1,8 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:multiselect/multiselect.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:unit2/bloc/offline/offline_passo/building/structural_materials_offline.dart/structural_material_offline_bloc.dart';
|
||||
import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart';
|
||||
import 'package:unit2/model/passo/structural_materials_ii.dart';
|
||||
import 'package:unit2/screens/offline/passo/building/add/add_building.dart';
|
||||
import 'package:unit2/widgets/passo/custom_button.dart';
|
||||
import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart';
|
||||
|
@ -20,6 +17,7 @@ class MaterialOption {
|
|||
class StructuralMaterialsOfflinePage extends StatefulWidget {
|
||||
final VoidCallback PrevBtn;
|
||||
final VoidCallback NextBtn;
|
||||
final VoidCallback Skipto9;
|
||||
|
||||
final List<String> foundation;
|
||||
final List<String> column;
|
||||
|
@ -55,7 +53,8 @@ class StructuralMaterialsOfflinePage extends StatefulWidget {
|
|||
|
||||
StructuralMaterialsOfflinePage(
|
||||
this.PrevBtn,
|
||||
this.NextBtn, {
|
||||
this.NextBtn,
|
||||
this.Skipto9, {
|
||||
Key? key,
|
||||
required this.foundation,
|
||||
required this.column,
|
||||
|
@ -127,6 +126,43 @@ class _StructuralMaterialsOfflinePage
|
|||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18),
|
||||
textAlign: TextAlign.left),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Positioned(
|
||||
top: 40, // Adjust as needed to place it below the Text widget
|
||||
right: 10, // Aligns to the right
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
widget.Skipto9();
|
||||
},
|
||||
style: TextButton.styleFrom(
|
||||
backgroundColor: Colors.red, // Button background color
|
||||
primary: Colors.white, // Text color
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 20, vertical: 10),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(8), // Rounded corners
|
||||
),
|
||||
),
|
||||
child: const Row(
|
||||
mainAxisSize: MainAxisSize
|
||||
.min, // Ensures button size adjusts to content
|
||||
children: [
|
||||
Text(
|
||||
'Skip to step 9',
|
||||
style: TextStyle(
|
||||
fontSize: 16, fontWeight: FontWeight.bold),
|
||||
),
|
||||
SizedBox(width: 8), // Space between text and icon
|
||||
Icon(Icons.skip_next),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||
Text(
|
||||
'FOUNDATION',
|
||||
|
|
|
@ -7,8 +7,6 @@ import 'package:searchfield/searchfield.dart';
|
|||
import 'package:unit2/bloc/offline/offline_passo/building/additional_items_offline/additional_items_offline_bloc.dart';
|
||||
import 'package:unit2/model/passo/class_components%20_offline.dart';
|
||||
|
||||
import '../../../../../model/passo/additional_items.dart';
|
||||
import '../../../../../model/passo/class_components.dart';
|
||||
import '../../../../../model/passo/unit_construct.dart';
|
||||
import '../../../../../theme-data.dart/form-style.dart';
|
||||
|
||||
|
|
|
@ -10,12 +10,8 @@ import 'package:unit2/bloc/offline/offline_passo/admin/class_components_admin.da
|
|||
import 'package:unit2/bloc/offline/offline_passo/admin/unit_construction/unit_construction_admin_bloc.dart';
|
||||
import 'package:unit2/bloc/offline/offline_passo/building/additional_items_offline/additional_items_offline_bloc.dart';
|
||||
import 'package:unit2/model/offline/offline_profile.dart';
|
||||
import 'package:unit2/model/passo/additional_items.dart';
|
||||
import 'package:unit2/model/passo/class_components.dart';
|
||||
import 'package:unit2/model/passo/unit_construct.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 AddExtraItemsOffline extends StatefulWidget {
|
||||
final OfflineProfile offlineProfile;
|
||||
|
|
|
@ -8,7 +8,6 @@ import 'package:unit2/screens/offline/passo/building/edit/AddExtraItemsEdit.dart
|
|||
|
||||
import '../../../../../bloc/offline/offline_passo/building/additional_items_offline/additional_items_offline_bloc.dart';
|
||||
import '../../../../../model/passo/additional_items.dart';
|
||||
import '../../../../../model/passo/class_components.dart';
|
||||
import '../../../../../model/passo/unit_construct.dart';
|
||||
import '../../../../../utils/alerts.dart';
|
||||
import '../../../../../widgets/passo/custom_button.dart';
|
||||
|
@ -82,32 +81,40 @@ class _AdditionalItemEditPageOffline
|
|||
fontSize: 18),
|
||||
textAlign: TextAlign.left),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.topRight,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
onPressed: () {
|
||||
context
|
||||
.read<AdditionalItemsOfflineBloc>()
|
||||
.add(ShowAdditionalItems());
|
||||
},
|
||||
child: const Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text('ADD ITEM'), // <-- Text
|
||||
SizedBox(
|
||||
width: 5,
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Align(
|
||||
alignment: Alignment.topRight,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
Icon(
|
||||
// <-- Icon
|
||||
Icons.add,
|
||||
size: 24.0,
|
||||
onPressed: () {
|
||||
context
|
||||
.read<AdditionalItemsOfflineBloc>()
|
||||
.add(ShowAdditionalItems());
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text('ADD ITEM'), // <-- Text
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Icon(
|
||||
// <-- Icon
|
||||
Icons.add,
|
||||
size: 24.0,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width:
|
||||
10), // Adjust the width to control spacing between buttons
|
||||
],
|
||||
),
|
||||
SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
|
|
|
@ -92,7 +92,7 @@ class _BuildingAndStructureOfflinePage
|
|||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
]))))
|
||||
]);
|
||||
}
|
||||
|
@ -113,32 +113,40 @@ class _BuildingAndStructureOfflinePage
|
|||
fontWeight: FontWeight.bold, fontSize: 18),
|
||||
textAlign: TextAlign.left),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.topRight,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
onPressed: () {
|
||||
context
|
||||
.read<BuildingAndStructureBloc>()
|
||||
.add(ShowBuildingAndStructure());
|
||||
},
|
||||
child: const Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text('ADD ITEM'), // <-- Text
|
||||
SizedBox(
|
||||
width: 5,
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Align(
|
||||
alignment: Alignment.topRight,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
Icon(
|
||||
// <-- Icon
|
||||
Icons.add,
|
||||
size: 24.0,
|
||||
onPressed: () {
|
||||
context
|
||||
.read<BuildingAndStructureBloc>()
|
||||
.add(ShowBuildingAndStructure());
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text('ADD ITEM'), // <-- Text
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Icon(
|
||||
// <-- Icon
|
||||
Icons.add,
|
||||
size: 24.0,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width:
|
||||
10), // Adjust the width to control spacing between buttons
|
||||
],
|
||||
),
|
||||
SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
|
|
|
@ -15,6 +15,7 @@ import 'package:unit2/screens/offline/passo/building/edit/landref_location_edit.
|
|||
import 'package:unit2/screens/offline/passo/building/edit/property_appraisal_edit.dart';
|
||||
import 'package:unit2/screens/offline/passo/building/edit/property_assessment_edit.dart';
|
||||
import 'package:unit2/screens/offline/passo/building/edit/property_owner_info_edit.dart';
|
||||
import 'package:unit2/screens/offline/passo/building/edit/signature_and_ids_edit.dart';
|
||||
import 'package:unit2/screens/offline/passo/building/edit/structural_materials_edit.dart';
|
||||
import 'package:unit2/utils/alerts.dart';
|
||||
|
||||
|
@ -46,7 +47,7 @@ class _EditBuildingOffline extends State<EditBuildingOffline> {
|
|||
// THE FOLLOWING TWO VARIABLES ARE REQUIRED TO CONTROL THE STEPPER.
|
||||
int activeStep = 0; // Initial step set to 5.
|
||||
|
||||
int upperBound = 8; // upperBound MUST BE total number of icons minus 1.
|
||||
int upperBound = 9; // upperBound MUST BE total number of icons minus 1.
|
||||
|
||||
void PrevBtn() {
|
||||
setState(() {
|
||||
|
@ -171,7 +172,8 @@ class _EditBuildingOffline extends State<EditBuildingOffline> {
|
|||
6,
|
||||
7,
|
||||
8,
|
||||
9
|
||||
9,
|
||||
10
|
||||
],
|
||||
activeStepColor: primary,
|
||||
numberStyle:
|
||||
|
@ -255,7 +257,12 @@ class _EditBuildingOffline extends State<EditBuildingOffline> {
|
|||
case 8:
|
||||
return PropertyAssessmentEditOfflinePage(
|
||||
widget.faas.id!, onSAveAll, widget.offlineProfile);
|
||||
|
||||
case 9:
|
||||
return EditSignatureAndIds(
|
||||
widget.offlineProfile,
|
||||
onSAveAll,
|
||||
widget.faas.id!,
|
||||
);
|
||||
default:
|
||||
return Container();
|
||||
// return PropertyOwnerInfoEdit(
|
||||
|
|
|
@ -2,9 +2,8 @@ import 'dart:async';
|
|||
import 'dart:io';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:http/http.dart'; // Removed 'as http'
|
||||
import 'package:path/path.dart'; // For basename function
|
||||
import 'dart:convert';
|
||||
// Removed 'as http'
|
||||
// For basename function
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -20,8 +19,6 @@ import 'package:phosphor_flutter/phosphor_flutter.dart';
|
|||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:unit2/model/passo/floor_sketch.dart';
|
||||
|
||||
import 'package:unit2/utils/urls.dart';
|
||||
|
||||
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||
|
||||
class FlutterDrawEdit extends StatefulWidget {
|
||||
|
|
|
@ -1,18 +1,11 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:unit2/bloc/offline/offline_passo/admin/unit_construction/unit_construction_admin_bloc.dart';
|
||||
import 'package:unit2/bloc/offline/offline_passo/building/general_description/general_description_bloc.dart';
|
||||
import 'package:unit2/screens/offline/passo/building/edit/edit_building.dart';
|
||||
import 'package:unit2/screens/offline/passo/building/edit/property_owner_info_edit.dart';
|
||||
|
||||
import '../../../../../model/passo/general_description.dart';
|
||||
import '../../../../../model/passo/unit_construct.dart';
|
||||
import '../../../../../theme-data.dart/form-style.dart';
|
||||
import '../../../../../widgets/passo/custom_button.dart';
|
||||
import '../../../../../widgets/passo/custom_formBuilder_fields.dart';
|
||||
|
@ -113,6 +106,7 @@ class _GeneralDescriptionEditOffline
|
|||
fontWeight: FontWeight.bold, fontSize: 18),
|
||||
textAlign: TextAlign.left),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
Container(
|
||||
margin: const EdgeInsets.only(
|
||||
left: 0, top: 10, right: 0, bottom: 0),
|
||||
|
|
|
@ -8,7 +8,6 @@ import 'package:unit2/bloc/offline/offline_passo/admin/municipalities_admin/muni
|
|||
import 'package:unit2/bloc/offline/offline_passo/building/landref/landref_location_bloc.dart';
|
||||
import 'package:unit2/bloc/offline/offline_passo/building/location/location_bloc.dart';
|
||||
import 'package:unit2/screens/offline/passo/building/edit/edit_building.dart';
|
||||
import 'package:unit2/screens/offline/passo/building/edit/property_owner_info_edit.dart';
|
||||
import 'package:unit2/theme-data.dart/form-style.dart';
|
||||
|
||||
import '../../../../../model/passo/barangay.dart';
|
||||
|
@ -53,438 +52,373 @@ class _BldgLocLandRefEditOffline extends State<BldgLocLandRefEditOffline> {
|
|||
if (state is SpecificLocationLoaded) {
|
||||
final bldgloc = state.location;
|
||||
return BlocConsumer<LandrefLocationBloc, LandrefLocationState>(
|
||||
listener: (context, state) {
|
||||
// if (state is LandrefLoading) {
|
||||
// final progress = ProgressHUD.of(context);
|
||||
// progress!.showWithText("Please wait...");
|
||||
// }
|
||||
// if (state is LandrefErrorState) {
|
||||
// final progress = ProgressHUD.of(context);
|
||||
// progress?.dismiss();
|
||||
// }
|
||||
},
|
||||
listener: (context, state) {},
|
||||
builder: (context, state) {
|
||||
if (state is SpecificLandrefLoaded) {
|
||||
final landRef = state.landref;
|
||||
return BlocConsumer<MunicipalitiesAdminBloc,
|
||||
MunicipalitiesAdminState>(listener: (context, state) {
|
||||
// if (state is MunicipalityLoading) {
|
||||
// final progress = ProgressHUD.of(context);
|
||||
// progress!.showWithText("Please wait...");
|
||||
// }
|
||||
// if (state is MunicipalityErrorState) {
|
||||
// final progress = ProgressHUD.of(context);
|
||||
// progress?.dismiss();
|
||||
// }
|
||||
}, builder: (context, state) {
|
||||
if (state is MunicipalitiesLoaded) {
|
||||
final cityList = state.city;
|
||||
Set<City> uniqueItems = {};
|
||||
MunicipalitiesAdminState>(
|
||||
listener: (context, state) {},
|
||||
builder: (context, state) {
|
||||
if (state is MunicipalitiesLoaded) {
|
||||
final cityList = state.city;
|
||||
Set<City> uniqueItems = {};
|
||||
|
||||
// Iterate through the dropdownItems list to filter out duplicates
|
||||
for (var item in cityList) {
|
||||
uniqueItems.add(item);
|
||||
}
|
||||
return BlocConsumer<BarangayAdminBloc,
|
||||
BarangayAdminState>(listener: (context, state) {
|
||||
if (state is BarangayLoaded) {
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress!.showWithText("Please wait...");
|
||||
}
|
||||
if (state is BarangayLoaded) {
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress?.dismiss();
|
||||
}
|
||||
// if (state is BarangayErrorState) {
|
||||
// final progress = ProgressHUD.of(context);
|
||||
// progress?.dismiss();
|
||||
// }
|
||||
}, builder: (context, state) {
|
||||
if (state is BarangayLoaded) {
|
||||
List<Brgy> brgyList = state.brgy;
|
||||
List<String> brgyNAmes = brgyList
|
||||
.map((brgy) => brgy.barangayDescription)
|
||||
.toList()
|
||||
.cast<String>();
|
||||
return FormBuilder(
|
||||
key: offlineBldgEditKey,
|
||||
initialValue: {
|
||||
'street': bldgloc.street ?? "",
|
||||
'province': bldgloc.province ?? "",
|
||||
'l_owner': landRef.owner,
|
||||
'oct_tct_cloa': landRef.cloaNo ?? "no",
|
||||
'survey_no': landRef.surveyNo ?? "",
|
||||
'lot_no': landRef.lotNo ?? "",
|
||||
'blk_no': landRef.blkNo ?? "",
|
||||
'l_td_arp': landRef.tdn ?? "",
|
||||
'area': landRef.area ?? ""
|
||||
},
|
||||
enabled: true,
|
||||
onChanged: () {
|
||||
offlineBldgEditKey.currentState!.save();
|
||||
debugPrint(offlineBldgEditKey
|
||||
.currentState!.value
|
||||
.toString());
|
||||
},
|
||||
autovalidateMode: AutovalidateMode.disabled,
|
||||
skipDisabled: true,
|
||||
child: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: ListView(
|
||||
shrinkWrap: true,
|
||||
children: [
|
||||
Container(
|
||||
margin: const EdgeInsets.only(
|
||||
left: 0,
|
||||
top: 20,
|
||||
right: 0,
|
||||
bottom: 20),
|
||||
child: const Text('BUILDING LOCATION',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 18),
|
||||
textAlign: TextAlign.center),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Container(
|
||||
height: 45.0,
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
border: Border.all(
|
||||
color: Colors.grey,
|
||||
width: 1.0,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
5.0),
|
||||
),
|
||||
child: const Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
"AGUSAN DEL NORTE",
|
||||
style:
|
||||
TextStyle(fontSize: 15),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10.0),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: FormBuilderDropdown<City>(
|
||||
name: 'municipality',
|
||||
autofocus: false,
|
||||
decoration:
|
||||
normalTextFieldStyle(
|
||||
bldgloc.municipality ??
|
||||
"Municipality",
|
||||
"",
|
||||
),
|
||||
items: uniqueItems
|
||||
.map(
|
||||
(city) =>
|
||||
DropdownMenuItem<
|
||||
City>(
|
||||
value: city,
|
||||
child: Text(
|
||||
city.cityDescription ??
|
||||
''),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
// onChanged: (selectedCityCode) {
|
||||
// // Find the corresponding City object using selectedCityCode
|
||||
// final selectedCity = cityList
|
||||
// .firstWhere((city) =>
|
||||
// city.cityCode ==
|
||||
// selectedCityCode);
|
||||
|
||||
// final barangayBloc = context
|
||||
// .read<BarangayAdminBloc>();
|
||||
// barangayBloc.add(LoadBarangay(
|
||||
// id: selectedCityCode!
|
||||
// .cityCode!));
|
||||
// },
|
||||
),
|
||||
),
|
||||
]),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
// optional flex property if flex is 1 because the default flex is 1
|
||||
flex: 1,
|
||||
child: customDropDownField(
|
||||
bldgloc.barangay,
|
||||
"",
|
||||
'brgy',
|
||||
brgyNAmes)),
|
||||
const SizedBox(width: 10.0),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"No. / Street",
|
||||
"",
|
||||
'street',
|
||||
TextInputType.text),
|
||||
),
|
||||
|
||||
// Expanded(
|
||||
// // optional flex property if flex is 1 because the default flex is 1
|
||||
// flex: 1,
|
||||
// child: customDropDownField(
|
||||
// bldgloc.barangay ?? "",
|
||||
// "Barangay",
|
||||
// 'brgy',
|
||||
// brgyNAmes))
|
||||
]),
|
||||
Container(
|
||||
margin: const EdgeInsets.only(
|
||||
left: 0,
|
||||
top: 20,
|
||||
right: 0,
|
||||
bottom: 20),
|
||||
child: const Text('LAND REFERENCE',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 18),
|
||||
textAlign: TextAlign.center),
|
||||
),
|
||||
customTextField("Land Owner", "",
|
||||
'l_owner', TextInputType.text),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"OCT/TCT/CLOA No.",
|
||||
"",
|
||||
'oct_tct_cloa',
|
||||
TextInputType.phone),
|
||||
),
|
||||
const SizedBox(width: 10.0),
|
||||
Expanded(
|
||||
// optional flex property if flex is 1 because the default flex is 1
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"Survey No.",
|
||||
"",
|
||||
'survey_no',
|
||||
TextInputType.phone))
|
||||
]),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"Lot No.",
|
||||
"",
|
||||
'lot_no',
|
||||
TextInputType.phone),
|
||||
),
|
||||
const SizedBox(width: 10.0),
|
||||
Expanded(
|
||||
// optional flex property if flex is 1 because the default flex is 1
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"Blk No.",
|
||||
"",
|
||||
'blk_no',
|
||||
TextInputType.phone))
|
||||
]),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"TD / ARP No.",
|
||||
"",
|
||||
'l_td_arp',
|
||||
TextInputType.phone),
|
||||
),
|
||||
const SizedBox(width: 10.0),
|
||||
Expanded(
|
||||
// optional flex property if flex is 1 because the default flex is 1
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"Area",
|
||||
"",
|
||||
'area',
|
||||
TextInputType.phone))
|
||||
]),
|
||||
SizedBox(
|
||||
height: 50,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
// Iterate through the dropdownItems list to filter out duplicates
|
||||
for (var item in cityList) {
|
||||
uniqueItems.add(item);
|
||||
}
|
||||
return BlocConsumer<BarangayAdminBloc,
|
||||
BarangayAdminState>(listener: (context, state) {
|
||||
if (state is BarangayLoaded) {
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress!.showWithText("Please wait...");
|
||||
}
|
||||
if (state is BarangayLoaded) {
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress?.dismiss();
|
||||
}
|
||||
}, builder: (context, state) {
|
||||
if (state is BarangayLoaded) {
|
||||
List<Brgy> brgyList = state.brgy;
|
||||
List<String> brgyNAmes = brgyList
|
||||
.map((brgy) => brgy.barangayDescription)
|
||||
.toList()
|
||||
.cast<String>();
|
||||
return FormBuilder(
|
||||
key: offlineBldgEditKey,
|
||||
initialValue: {
|
||||
'street': bldgloc.street ?? "",
|
||||
'province': bldgloc.province ?? "",
|
||||
'l_owner': landRef.owner,
|
||||
'oct_tct_cloa': landRef.cloaNo ?? "no",
|
||||
'survey_no': landRef.surveyNo ?? "",
|
||||
'lot_no': landRef.lotNo ?? "",
|
||||
'blk_no': landRef.blkNo ?? "",
|
||||
'l_td_arp': landRef.tdn ?? "",
|
||||
'area': landRef.area ?? ""
|
||||
},
|
||||
enabled: true,
|
||||
onChanged: () {
|
||||
offlineBldgEditKey.currentState!.save();
|
||||
debugPrint(offlineBldgEditKey
|
||||
.currentState!.value
|
||||
.toString());
|
||||
},
|
||||
autovalidateMode: AutovalidateMode.disabled,
|
||||
skipDisabled: true,
|
||||
child: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: ListView(
|
||||
shrinkWrap: true,
|
||||
children: [
|
||||
CustomButton(
|
||||
icon: const Icon(
|
||||
Icons.chevron_left_rounded,
|
||||
color: Colors.white),
|
||||
onPressed: () {
|
||||
{
|
||||
widget.PrevBtn();
|
||||
}
|
||||
;
|
||||
},
|
||||
Container(
|
||||
margin: const EdgeInsets.only(
|
||||
left: 0,
|
||||
top: 20,
|
||||
right: 0,
|
||||
bottom: 20),
|
||||
child: const Text(
|
||||
'BUILDING LOCATION',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 18),
|
||||
textAlign: TextAlign.center),
|
||||
),
|
||||
CustomButton(
|
||||
icon: const Icon(
|
||||
Icons.chevron_right_rounded,
|
||||
color: Colors.white),
|
||||
onPressed: () {
|
||||
{
|
||||
var bldgLocData = BldgLoc(
|
||||
id: widget.tempId,
|
||||
bldgapprDetailsId:
|
||||
widget.tempId,
|
||||
assessedById: '1',
|
||||
assessedByName: 'cyril',
|
||||
street: offlineBldgEditKey
|
||||
.currentState
|
||||
?.value['street'] ??
|
||||
bldgloc.street,
|
||||
barangay: offlineBldgEditKey
|
||||
.currentState
|
||||
?.value['brgy'] ??
|
||||
bldgloc.barangay,
|
||||
municipality: offlineBldgEditKey
|
||||
.currentState
|
||||
?.value[
|
||||
'municipality']
|
||||
?.cityDescription ??
|
||||
bldgloc.municipality,
|
||||
province: offlineBldgEditKey
|
||||
.currentState
|
||||
?.value['province'] ??
|
||||
bldgloc.province,
|
||||
);
|
||||
var landRefData = LandRef(
|
||||
id: widget.tempId,
|
||||
bldgapprDetailsId:
|
||||
widget.tempId,
|
||||
assessedById: '1',
|
||||
assessedByName: 'cyril',
|
||||
owner: offlineBldgEditKey
|
||||
.currentState
|
||||
?.value['l_owner'] ??
|
||||
landRef.owner,
|
||||
cloaNo: offlineBldgEditKey
|
||||
const SizedBox(height: 15),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Container(
|
||||
height: 45.0,
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
border: Border.all(
|
||||
color: Colors.grey,
|
||||
width: 1.0,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
5.0),
|
||||
),
|
||||
child: const Align(
|
||||
alignment:
|
||||
Alignment.center,
|
||||
child: Text(
|
||||
"AGUSAN DEL NORTE",
|
||||
style: TextStyle(
|
||||
fontSize: 15),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10.0),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child:
|
||||
FormBuilderDropdown<City>(
|
||||
name: 'municipality',
|
||||
autofocus: false,
|
||||
decoration:
|
||||
normalTextFieldStyle(
|
||||
bldgloc.municipality ??
|
||||
"Municipality",
|
||||
"",
|
||||
),
|
||||
items: uniqueItems
|
||||
.map(
|
||||
(city) =>
|
||||
DropdownMenuItem<
|
||||
City>(
|
||||
value: city,
|
||||
child: Text(
|
||||
city.cityDescription ??
|
||||
''),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
]),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
// optional flex property if flex is 1 because the default flex is 1
|
||||
flex: 1,
|
||||
child: customDropDownField(
|
||||
bldgloc.barangay,
|
||||
"",
|
||||
'brgy',
|
||||
brgyNAmes)),
|
||||
const SizedBox(width: 10.0),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"No. / Street",
|
||||
"",
|
||||
'street',
|
||||
TextInputType.text),
|
||||
),
|
||||
]),
|
||||
Container(
|
||||
margin: const EdgeInsets.only(
|
||||
left: 0,
|
||||
top: 20,
|
||||
right: 0,
|
||||
bottom: 20),
|
||||
child: const Text('LAND REFERENCE',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 18),
|
||||
textAlign: TextAlign.center),
|
||||
),
|
||||
customTextField("Land Owner", "",
|
||||
'l_owner', TextInputType.text),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"OCT/TCT/CLOA No.",
|
||||
"",
|
||||
'oct_tct_cloa',
|
||||
TextInputType.phone),
|
||||
),
|
||||
const SizedBox(width: 10.0),
|
||||
Expanded(
|
||||
// optional flex property if flex is 1 because the default flex is 1
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"Survey No.",
|
||||
"",
|
||||
'survey_no',
|
||||
TextInputType.phone))
|
||||
]),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"Lot No.",
|
||||
"",
|
||||
'lot_no',
|
||||
TextInputType.phone),
|
||||
),
|
||||
const SizedBox(width: 10.0),
|
||||
Expanded(
|
||||
// optional flex property if flex is 1 because the default flex is 1
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"Blk No.",
|
||||
"",
|
||||
'blk_no',
|
||||
TextInputType.phone))
|
||||
]),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"TD / ARP No.",
|
||||
"",
|
||||
'l_td_arp',
|
||||
TextInputType.phone),
|
||||
),
|
||||
const SizedBox(width: 10.0),
|
||||
Expanded(
|
||||
// optional flex property if flex is 1 because the default flex is 1
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"Area",
|
||||
"",
|
||||
'area',
|
||||
TextInputType.phone))
|
||||
]),
|
||||
SizedBox(
|
||||
height: 50,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
CustomButton(
|
||||
icon: const Icon(
|
||||
Icons.chevron_left_rounded,
|
||||
color: Colors.white),
|
||||
onPressed: () {
|
||||
{
|
||||
widget.PrevBtn();
|
||||
}
|
||||
;
|
||||
},
|
||||
),
|
||||
CustomButton(
|
||||
icon: const Icon(
|
||||
Icons.chevron_right_rounded,
|
||||
color: Colors.white),
|
||||
onPressed: () {
|
||||
{
|
||||
var bldgLocData = BldgLoc(
|
||||
id: widget.tempId,
|
||||
bldgapprDetailsId:
|
||||
widget.tempId,
|
||||
assessedById: '1',
|
||||
assessedByName: 'cyril',
|
||||
street: offlineBldgEditKey
|
||||
.currentState
|
||||
?.value[
|
||||
'street'] ??
|
||||
bldgloc.street,
|
||||
barangay: offlineBldgEditKey
|
||||
.currentState
|
||||
?.value['brgy'] ??
|
||||
bldgloc.barangay,
|
||||
municipality: offlineBldgEditKey
|
||||
.currentState
|
||||
?.value[
|
||||
'oct_tct_cloa'] ??
|
||||
landRef.cloaNo,
|
||||
lotNo: offlineBldgEditKey
|
||||
.currentState
|
||||
?.value['lot_no'] ??
|
||||
landRef.lotNo,
|
||||
tdn: offlineBldgEditKey
|
||||
.currentState
|
||||
?.value['l_td_arp'] ??
|
||||
landRef.tdn,
|
||||
area: offlineBldgEditKey
|
||||
.currentState
|
||||
?.value['area'] ??
|
||||
landRef.area,
|
||||
surveyNo: offlineBldgEditKey
|
||||
'municipality']
|
||||
?.cityDescription ??
|
||||
bldgloc.municipality,
|
||||
province: offlineBldgEditKey
|
||||
.currentState
|
||||
?.value[
|
||||
'province'] ??
|
||||
bldgloc.province,
|
||||
);
|
||||
var landRefData = LandRef(
|
||||
id: widget.tempId,
|
||||
bldgapprDetailsId:
|
||||
widget.tempId,
|
||||
assessedById: '1',
|
||||
assessedByName: 'cyril',
|
||||
owner: offlineBldgEditKey
|
||||
.currentState
|
||||
?.value[
|
||||
'l_owner'] ??
|
||||
landRef.owner,
|
||||
cloaNo: offlineBldgEditKey
|
||||
.currentState
|
||||
?.value[
|
||||
'oct_tct_cloa'] ??
|
||||
landRef.cloaNo,
|
||||
lotNo: offlineBldgEditKey
|
||||
.currentState
|
||||
?.value[
|
||||
'lot_no'] ??
|
||||
landRef.lotNo,
|
||||
tdn: offlineBldgEditKey
|
||||
.currentState
|
||||
?.value[
|
||||
'l_td_arp'] ??
|
||||
landRef.tdn,
|
||||
area: offlineBldgEditKey
|
||||
.currentState
|
||||
?.value[
|
||||
'survey_no'] ??
|
||||
landRef.surveyNo,
|
||||
blkNo: offlineBldgEditKey
|
||||
.currentState
|
||||
?.value['blk_no'] ??
|
||||
landRef.blkNo,
|
||||
);
|
||||
context
|
||||
.read<LocationBloc>()
|
||||
.add(UpdateBldgLoc(
|
||||
id: widget.tempId,
|
||||
bldgLoc: bldgLocData));
|
||||
context
|
||||
.read<LandrefLocationBloc>()
|
||||
.add(UpdateBldgLandRef(
|
||||
id: widget.tempId,
|
||||
landRef: landRefData));
|
||||
?.value['area'] ??
|
||||
landRef.area,
|
||||
surveyNo: offlineBldgEditKey
|
||||
.currentState
|
||||
?.value[
|
||||
'survey_no'] ??
|
||||
landRef.surveyNo,
|
||||
blkNo: offlineBldgEditKey
|
||||
.currentState
|
||||
?.value[
|
||||
'blk_no'] ??
|
||||
landRef.blkNo,
|
||||
);
|
||||
context
|
||||
.read<LocationBloc>()
|
||||
.add(UpdateBldgLoc(
|
||||
id: widget.tempId,
|
||||
bldgLoc:
|
||||
bldgLocData));
|
||||
context
|
||||
.read<
|
||||
LandrefLocationBloc>()
|
||||
.add(UpdateBldgLandRef(
|
||||
id: widget.tempId,
|
||||
landRef:
|
||||
landRefData));
|
||||
|
||||
widget.NextBtn();
|
||||
}
|
||||
;
|
||||
},
|
||||
widget.NextBtn();
|
||||
}
|
||||
;
|
||||
},
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
return Container();
|
||||
});
|
||||
}
|
||||
// if (state is BarangayErrorState) {
|
||||
// return SomethingWentWrong(
|
||||
// message: onError,
|
||||
// onpressed: () {
|
||||
// context
|
||||
// .read<BarangayBloc>()
|
||||
// .add(LoadBarangay(id: '01'));
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
|
||||
return Container();
|
||||
});
|
||||
}
|
||||
// if (state is MunicipalityErrorState) {
|
||||
// return SomethingWentWrong(
|
||||
// message: onError,
|
||||
// onpressed: () {
|
||||
// context
|
||||
// .read<MunicipalityBloc>()
|
||||
// .add(LoadMunicipality());
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
return Container();
|
||||
});
|
||||
}
|
||||
// if (state is LandrefErrorState) {
|
||||
// return SomethingWentWrong(
|
||||
// message: onError,
|
||||
// onpressed: () {
|
||||
// context.read<LandrefBloc>().add(
|
||||
// LoadLandref(id: widget.tempId, landRef: LandRef()));
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
|
||||
return Container();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// if (state is LocationErrorState) {
|
||||
// return SomethingWentWrong(
|
||||
// message: onError,
|
||||
// onpressed: () {
|
||||
// context
|
||||
// .read<LocationBloc>()
|
||||
// .add(LoadLocation(id: widget.tempId, bldgloc: BldgLoc()));
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -42,7 +42,8 @@ class _PropertyOwnerInfoEditOffline
|
|||
Map<String, dynamic> myMap = {'zero': 0, 'one': 1, 'two': 2};
|
||||
|
||||
final transaction_codes = ['New', 'Revision'];
|
||||
|
||||
final civilStatus = ["Single", "Married", "Divorced", "Separated", "Widowed"];
|
||||
bool isOptional = false;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SingleChildScrollView(
|
||||
|
@ -67,6 +68,8 @@ class _PropertyOwnerInfoEditOffline
|
|||
'benificiary_telno': widget.faas.adminTelno,
|
||||
'benificiary_address': widget.faas.adminAddress,
|
||||
'benificiary_tin': widget.faas.adminTin,
|
||||
'citizenship': widget.faas.citizenship,
|
||||
"civil_status": widget.faas.civilStatus
|
||||
},
|
||||
enabled: true,
|
||||
onChanged: () {
|
||||
|
@ -81,10 +84,10 @@ class _PropertyOwnerInfoEditOffline
|
|||
Container(
|
||||
margin: const EdgeInsets.only(
|
||||
left: 0, top: 20, right: 0, bottom: 10),
|
||||
child: Row(
|
||||
child: const Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: const Text(
|
||||
child: Text(
|
||||
'PROPERTY OWNER INFO',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold, fontSize: 18),
|
||||
|
@ -94,29 +97,6 @@ class _PropertyOwnerInfoEditOffline
|
|||
],
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.topRight,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
onPressed: () {},
|
||||
child: const Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text('SAVE'), // <-- Text
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Icon(
|
||||
// <-- Icon
|
||||
Icons.save,
|
||||
size: 24.0,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
customDropDownField(
|
||||
widget.faas.transCode ?? "Transaction Code",
|
||||
|
@ -162,57 +142,119 @@ class _PropertyOwnerInfoEditOffline
|
|||
"Last Name", "", 'lname', TextInputType.text),
|
||||
)
|
||||
]),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: customDropDownField(
|
||||
widget.faas.civilStatus ??
|
||||
"Civil Status", // Use empty string if null
|
||||
"",
|
||||
"civil_status",
|
||||
civilStatus),
|
||||
),
|
||||
const SizedBox(width: 10.0),
|
||||
Expanded(
|
||||
// optional flex property if flex is 1 because the default flex is 1
|
||||
flex: 1,
|
||||
child: customTextField("Citizenship", "",
|
||||
'citizenship', TextInputType.text),
|
||||
),
|
||||
]),
|
||||
customDatTimePicker("Birthday", "", "bday"),
|
||||
customTextField(
|
||||
"Address", "", 'address', TextInputType.text),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"Tel No.", "", 'tel_no', TextInputType.phone),
|
||||
),
|
||||
const SizedBox(width: 10.0),
|
||||
Expanded(
|
||||
// optional flex property if flex is 1 because the default flex is 1
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"TIN", "", 'tin', TextInputType.phone))
|
||||
]),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"Administrator / Benificial User",
|
||||
"",
|
||||
'benificiary',
|
||||
TextInputType.text),
|
||||
),
|
||||
const SizedBox(width: 10.0),
|
||||
Expanded(
|
||||
// optional flex property if flex is 1 because the default flex is 1
|
||||
flex: 1,
|
||||
child: customTextField("TIN", "",
|
||||
'benificiary_tin', TextInputType.phone))
|
||||
]),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: customTextField("Address", "",
|
||||
'benificiary_address', TextInputType.text),
|
||||
),
|
||||
const SizedBox(width: 10.0),
|
||||
Expanded(
|
||||
// optional flex property if flex is 1 because the default flex is 1
|
||||
flex: 1,
|
||||
child: customTextField("Tel No.", "",
|
||||
'benificiary_telno', TextInputType.phone))
|
||||
]),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 50, // Adjust the width as needed
|
||||
height: 50, // Adjust the height as needed
|
||||
child: Checkbox(
|
||||
checkColor: Colors.white,
|
||||
value: isOptional,
|
||||
onChanged: (bool? value) {
|
||||
setState(() {
|
||||
isOptional = value!;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
Text('Show optional information')
|
||||
],
|
||||
),
|
||||
// Other widgets in the column
|
||||
],
|
||||
),
|
||||
Visibility(
|
||||
visible: isOptional,
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: customTextField("Tel No.", "",
|
||||
'tel_no', TextInputType.phone),
|
||||
),
|
||||
const SizedBox(width: 10.0),
|
||||
Expanded(
|
||||
// optional flex property if flex is 1 because the default flex is 1
|
||||
flex: 1,
|
||||
child: customTextField("TIN", "", 'tin',
|
||||
TextInputType.phone))
|
||||
]),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"Administrator / Benificial User",
|
||||
"",
|
||||
'benificiary',
|
||||
TextInputType.text),
|
||||
),
|
||||
const SizedBox(width: 10.0),
|
||||
Expanded(
|
||||
// optional flex property if flex is 1 because the default flex is 1
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"TIN",
|
||||
"",
|
||||
'benificiary_tin',
|
||||
TextInputType.phone))
|
||||
]),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"Address",
|
||||
"",
|
||||
'benificiary_address',
|
||||
TextInputType.text),
|
||||
),
|
||||
const SizedBox(width: 10.0),
|
||||
Expanded(
|
||||
// optional flex property if flex is 1 because the default flex is 1
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"Tel No.",
|
||||
"",
|
||||
'benificiary_telno',
|
||||
TextInputType.phone))
|
||||
]),
|
||||
],
|
||||
)),
|
||||
const SizedBox(height: 25),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
|
|
|
@ -0,0 +1,262 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'dart:io';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:signature/signature.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:unit2/model/offline/offline_profile.dart';
|
||||
import 'package:unit2/model/passo/esignature.dart';
|
||||
import 'package:unit2/model/passo/valid_ids.dart';
|
||||
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||
import 'dart:ui' as ui;
|
||||
import 'dart:typed_data';
|
||||
|
||||
class EditSignatureAndIds extends StatefulWidget {
|
||||
final OfflineProfile offlineProfile;
|
||||
final Function function;
|
||||
final int faasId; // Assuming widget.faas.id! is of type int
|
||||
|
||||
EditSignatureAndIds(this.offlineProfile, this.function, this.faasId);
|
||||
|
||||
@override
|
||||
_EditSignatureAndIds createState() => _EditSignatureAndIds();
|
||||
}
|
||||
|
||||
class _EditSignatureAndIds extends State<EditSignatureAndIds> {
|
||||
bool _isEditingSignature = false; // State for editing signature
|
||||
File? _image;
|
||||
SignatureController? _signatureController;
|
||||
final ImagePicker _picker = ImagePicker();
|
||||
|
||||
ValidIds? _validIds; // For storing fetched ValidIds record
|
||||
ESignature? _eSignature; // For storing fetched ESignature record
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_signatureController = SignatureController(
|
||||
penStrokeWidth: 3,
|
||||
penColor: Colors.black87,
|
||||
exportBackgroundColor: Colors.white,
|
||||
);
|
||||
|
||||
_loadValidIdsAndSignature(widget.faasId);
|
||||
}
|
||||
|
||||
Future<void> _loadValidIdsAndSignature(int faasId) async {
|
||||
try {
|
||||
// Fetch ValidIds using faasId
|
||||
List<Map<String, dynamic>> validIdsList =
|
||||
await SQLServices.instance.getValidIds(faasId);
|
||||
if (validIdsList.isNotEmpty) {
|
||||
setState(() {
|
||||
_validIds = ValidIds.fromJson(validIdsList.first);
|
||||
_image = File(_validIds!.validIds!); // Load the image if it exists
|
||||
});
|
||||
}
|
||||
|
||||
// Fetch ESignature using faasId
|
||||
List<Map<String, dynamic>> signatureList =
|
||||
await SQLServices.instance.getESignature(faasId);
|
||||
if (signatureList.isNotEmpty) {
|
||||
setState(() {
|
||||
_eSignature = ESignature.fromJson(signatureList.first);
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
print("Error loading ValidIds or Signature: $e");
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _pickImage() async {
|
||||
final XFile? image = await _picker.pickImage(source: ImageSource.gallery);
|
||||
|
||||
if (image != null) {
|
||||
setState(() {
|
||||
_image = File(image.path);
|
||||
});
|
||||
|
||||
// Update the ValidIds record
|
||||
if (_validIds != null) {
|
||||
_validIds!.validIds = image.path;
|
||||
|
||||
// You may also want to update the database at this point
|
||||
await SQLServices.instance
|
||||
.updateValidIds(_validIds!.bldgapprDetailsId ?? 0, _validIds!);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _captureImage() async {
|
||||
final XFile? image = await _picker.pickImage(source: ImageSource.camera);
|
||||
|
||||
if (image != null) {
|
||||
setState(() {
|
||||
_image = File(image.path);
|
||||
});
|
||||
|
||||
// Update the ValidIds record
|
||||
if (_validIds != null) {
|
||||
_validIds!.validIds = image.path;
|
||||
|
||||
// You may also want to update the database at this point
|
||||
await SQLServices.instance
|
||||
.updateValidIds(_validIds!.bldgapprDetailsId ?? 0, _validIds!);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _saveSignature() async {
|
||||
if (_signatureController!.isNotEmpty) {
|
||||
try {
|
||||
final ui.Image? image = await _signatureController?.toImage();
|
||||
final ByteData? byteData =
|
||||
await image?.toByteData(format: ui.ImageByteFormat.png);
|
||||
final Uint8List pngBytes = byteData!.buffer.asUint8List();
|
||||
|
||||
final directory = await getApplicationDocumentsDirectory();
|
||||
final String path = '${directory.path}/signature_${widget.faasId}.png';
|
||||
|
||||
final File imgFile = File(path);
|
||||
await imgFile.writeAsBytes(pngBytes);
|
||||
|
||||
// Update or create the signature record in the database
|
||||
if (_eSignature != null) {
|
||||
_eSignature!.signAttachment = path; // Update existing signature
|
||||
await SQLServices.instance
|
||||
.updateESignature(widget.faasId, _eSignature!);
|
||||
} else {
|
||||
// Create a new signature if not exists
|
||||
final ESignature newSignature = ESignature(
|
||||
bldgapprDetailsId: widget.faasId,
|
||||
signAttachment: path,
|
||||
dateCreated: DateTime.now().toIso8601String(),
|
||||
dateModified: DateTime.now().toIso8601String(),
|
||||
genCode: "5TH",
|
||||
);
|
||||
await SQLServices.instance.createESignature(newSignature);
|
||||
}
|
||||
} catch (e) {
|
||||
print('Error saving signature: $e');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
margin:
|
||||
const EdgeInsets.only(left: 0, top: 20, right: 0, bottom: 10),
|
||||
child: const Text(
|
||||
'EDIT ID AND SIGNATURE',
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18),
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
// ID section
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.45,
|
||||
height: MediaQuery.of(context).size.height * 0.6,
|
||||
child: _image != null
|
||||
? Image.file(_image!)
|
||||
: Image.asset('assets/pngs/id-card.png'),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: _pickImage,
|
||||
icon: const Icon(Icons.image, color: Colors.red),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: _captureImage,
|
||||
icon:
|
||||
const Icon(Icons.camera_alt, color: Colors.red),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
// Signature section
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.45,
|
||||
height: MediaQuery.of(context).size.height * 0.6,
|
||||
child: _isEditingSignature
|
||||
? Signature(
|
||||
controller: _signatureController!,
|
||||
backgroundColor: Colors.white,
|
||||
)
|
||||
: (_eSignature != null &&
|
||||
_eSignature!.signAttachment != null)
|
||||
? Image.file(File(_eSignature!.signAttachment!))
|
||||
: Container(
|
||||
color: Colors.grey[300],
|
||||
child: const Center(
|
||||
child: Text('No Signature Available'),
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
if (_isEditingSignature) {
|
||||
_saveSignature(); // Save the signature if editing
|
||||
}
|
||||
setState(() {
|
||||
_isEditingSignature =
|
||||
!_isEditingSignature; // Toggle editing state
|
||||
if (!_isEditingSignature) {
|
||||
_signatureController
|
||||
?.clear(); // Clear the signature pad
|
||||
}
|
||||
});
|
||||
},
|
||||
icon: const Icon(Icons.edit, color: Colors.red),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
_signatureController
|
||||
?.clear(); // Clear the signature pad
|
||||
},
|
||||
icon: const Icon(Icons.clear, color: Colors.red),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Center(
|
||||
child: Container(
|
||||
margin: const EdgeInsets.only(top: 30.0),
|
||||
width: MediaQuery.of(context).size.width * 0.75,
|
||||
height: 50,
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
widget.function(); // Call the passed function
|
||||
},
|
||||
child: const Text("SUBMIT"),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -5,7 +5,6 @@ import 'package:unit2/bloc/offline/offline_passo/building/structural_materials_o
|
|||
import 'package:unit2/model/passo/structural_materials_ii.dart';
|
||||
import 'package:unit2/screens/offline/passo/building/edit/edit_building.dart';
|
||||
|
||||
import '../../../../../model/passo/structureMaterial.dart';
|
||||
import '../../../../../widgets/passo/custom_button.dart';
|
||||
import '../../../../../widgets/passo/custom_formBuilder_fields.dart';
|
||||
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:unit2/bloc/offline/offline_passo/admin/assessment_level/assessment_level_bloc.dart';
|
||||
import 'package:unit2/bloc/offline/offline_passo/admin/barangay_admin/barangay_admin_bloc.dart';
|
||||
import 'package:unit2/bloc/offline/offline_passo/admin/class_components_admin.dart/class_components_admin_bloc.dart';
|
||||
import 'package:unit2/bloc/offline/offline_passo/admin/memoranda/memoranda_admin_bloc.dart';
|
||||
|
@ -21,18 +18,13 @@ import 'package:unit2/bloc/offline/offline_passo/building/general_description/ge
|
|||
import 'package:unit2/bloc/offline/offline_passo/building/landref/landref_location_bloc.dart';
|
||||
import 'package:unit2/bloc/offline/offline_passo/building/location/location_bloc.dart';
|
||||
import 'package:unit2/bloc/offline/offline_passo/building/structural_materials_offline.dart/structural_material_offline_bloc.dart';
|
||||
import 'package:unit2/bloc/offline/offline_passo/building/swornstatement/sworn_statement_bloc.dart';
|
||||
import 'package:unit2/model/offline/offline_profile.dart';
|
||||
import 'package:unit2/model/passo/additional_items.dart';
|
||||
import 'package:unit2/model/passo/bldg_loc.dart';
|
||||
import 'package:unit2/model/passo/building_and_structure.dart';
|
||||
import 'package:unit2/model/passo/building_details.dart';
|
||||
import 'package:unit2/model/passo/land_ref.dart';
|
||||
import 'package:unit2/model/passo/property_appraisal.dart';
|
||||
import 'package:unit2/model/passo/property_assessment.dart';
|
||||
import 'package:unit2/model/passo/property_info.dart';
|
||||
import 'package:unit2/screens/offline/passo/building/add/add_building.dart';
|
||||
import 'package:unit2/screens/offline/passo/building/add/drawing_pad.dart';
|
||||
import 'package:unit2/screens/offline/passo/building/add/flutter_painter.dart';
|
||||
import 'package:unit2/screens/offline/passo/building/edit/edit_building.dart';
|
||||
import 'package:unit2/screens/offline/passo/land/add/add_land.dart';
|
||||
import 'package:unit2/theme-data.dart/colors.dart';
|
||||
|
@ -52,14 +44,7 @@ import '../../../bloc/offline/offline_passo/land/land_property_owner_bloc/land_p
|
|||
import '../../../bloc/offline/offline_passo/land/land_property_signture/land_property_signature_bloc.dart';
|
||||
import '../../../bloc/offline/offline_passo/land/other_improvements/other_improvements_bloc.dart';
|
||||
import '../../../bloc/offline/offline_passo/land/value_adjustment/value_adjustment_bloc.dart';
|
||||
import '../../../model/passo/general_description.dart';
|
||||
import '../../../model/passo/structureMaterial.dart';
|
||||
import '../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||
import '../../../utils/alerts.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:date_format/date_format.dart';
|
||||
|
||||
import '../../../utils/urls.dart';
|
||||
|
||||
class BuildingHomeOffline extends StatelessWidget {
|
||||
final OfflineProfile offlineProfile;
|
||||
|
@ -91,17 +76,6 @@ class BuildingHomeOffline extends StatelessWidget {
|
|||
final progress = ProgressHUD.of(context);
|
||||
progress!.showWithText("Syncing data please wait...");
|
||||
}
|
||||
// if (state is GenDescLoaded) {
|
||||
// final progress = ProgressHUD.of(context);
|
||||
// progress?.dismiss();
|
||||
|
||||
// final tempID = await SharedPreferences.getInstance();
|
||||
// await tempID.setInt(
|
||||
// 'totalValue', int.parse(state.gendesc.totalFloorArea!));
|
||||
// await tempID.setString(
|
||||
// 'actualUse', state.gendesc.actualUse!);
|
||||
|
||||
// }
|
||||
if (state is PropertyInfoLoaded) {
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress?.dismiss();
|
||||
|
@ -195,7 +169,8 @@ class BuildingHomeOffline extends StatelessWidget {
|
|||
const LoadBarangayInMunicipality(cityCode: '01')),
|
||||
),
|
||||
BlocProvider(
|
||||
create: (context) => BuildingAndStructureBloc()),
|
||||
create: (context) => BuildingAndStructureBloc()
|
||||
..add(const LoadBuildingAndStructure())),
|
||||
BlocProvider(
|
||||
create: (context) => ClassComponentsAdminBloc()
|
||||
..add(const LoadClassComponents()),
|
||||
|
@ -225,6 +200,13 @@ class BuildingHomeOffline extends StatelessWidget {
|
|||
create: (context) => BldgAppraisalOfflineBloc()),
|
||||
BlocProvider(
|
||||
create: (context) => BldgAssessmentOfflineBloc()),
|
||||
BlocProvider(
|
||||
create: (context) => SwornStatementBloc(),
|
||||
),
|
||||
BlocProvider(
|
||||
create: (context) => AssessmentLevelBloc()
|
||||
..add(const LoadAssessmentLevel()),
|
||||
),
|
||||
], child: AddBuilding(triggerLoadBldgFaas, offlineProfile));
|
||||
}));
|
||||
}),
|
||||
|
@ -355,7 +337,7 @@ Card _listCard(PropertyInfo property_info, context, index, deleteItem,
|
|||
return MultiBlocProvider(
|
||||
providers: [
|
||||
BlocProvider(
|
||||
create: (context) => CrudBloc()..add(FetchTodos()),
|
||||
create: (context) => CrudBloc()..add(const FetchTodos()),
|
||||
),
|
||||
BlocProvider(
|
||||
create: (context) => MunicipalitiesAdminBloc()
|
||||
|
@ -412,6 +394,14 @@ Card _listCard(PropertyInfo property_info, context, index, deleteItem,
|
|||
..add(LoadBuildingAndStructureEdit(
|
||||
bldgAndStructure: const <BldgAndStructure>[],
|
||||
id: property_info.id!))),
|
||||
BlocProvider(
|
||||
create: (context) => SwornStatementBloc()
|
||||
..add(FetchSingleSwornStatement(id: property_info.id!)),
|
||||
),
|
||||
BlocProvider(
|
||||
create: (context) =>
|
||||
AssessmentLevelBloc()..add(const LoadAssessmentLevel()),
|
||||
)
|
||||
],
|
||||
child: EditBuildingOffline(
|
||||
index: index,
|
||||
|
@ -455,17 +445,17 @@ Card _listCard(PropertyInfo property_info, context, index, deleteItem,
|
|||
),
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
const SizedBox(height: 5),
|
||||
Text(
|
||||
'TDN: ${property_info.tdn}',
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
),
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
Text(
|
||||
'Uploaded on: ${property_info.dateSynced == null ? '--' : property_info.dateSynced}',
|
||||
style: TextStyle(
|
||||
'Uploaded on: ${property_info.dateSynced ?? '--'}',
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
),
|
||||
textAlign: TextAlign.left,
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||
import 'package:flutter_zoom_drawer/flutter_zoom_drawer.dart';
|
||||
import 'package:fluttericon/font_awesome5_icons.dart';
|
||||
import 'package:unit2/model/offline/offline_profile.dart';
|
||||
import 'package:unit2/screens/offline/passo/admin/admin_main_screen.dart';
|
||||
|
|
|
@ -51,9 +51,9 @@ class AuthService {
|
|||
}
|
||||
}
|
||||
|
||||
Future<Map<dynamic,dynamic>> qrLogin({String? uuid, String? password}) async {
|
||||
|
||||
Map<dynamic, dynamic> responseStatus = {};
|
||||
Future<Map<dynamic, dynamic>> qrLogin(
|
||||
{String? uuid, String? password}) async {
|
||||
Map<dynamic, dynamic> responseStatus = {};
|
||||
Map<String, dynamic> body = {
|
||||
'uuid': uuid!,
|
||||
'password': password!,
|
||||
|
@ -67,9 +67,8 @@ class AuthService {
|
|||
http.Response response = await Request.instance
|
||||
.postRequest(path: path, param: {}, headers: baseHeaders, body: body);
|
||||
|
||||
Map data = jsonDecode(response.body);
|
||||
responseStatus = data;
|
||||
|
||||
Map data = jsonDecode(response.body);
|
||||
responseStatus = data;
|
||||
} catch (e) {
|
||||
throw (e.toString());
|
||||
}
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:core';
|
||||
|
||||
import 'package:unit2/model/passo/assessment_level.dart';
|
||||
import 'package:unit2/sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||
import 'package:unit2/utils/request.dart';
|
||||
import 'package:unit2/utils/urls.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
class AssessmentLevelApiServices {
|
||||
static final AssessmentLevelApiServices _instance =
|
||||
AssessmentLevelApiServices();
|
||||
static AssessmentLevelApiServices get instance => _instance;
|
||||
|
||||
String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z";
|
||||
String xClientKeySecret = "unitcYqAN7GGalyz";
|
||||
|
||||
Future<List<Map<String, dynamic>>> fetch() async {
|
||||
String path = Url.instance.getAssessmentLevel();
|
||||
Map<String, String> headers = {
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'X-Client-Key': xClientKey,
|
||||
'X-Client-Secret': xClientKeySecret
|
||||
};
|
||||
|
||||
try {
|
||||
http.Response response = await Request.instance
|
||||
.getRequest(param: {}, path: path, headers: headers);
|
||||
|
||||
print(response.statusCode);
|
||||
print(response.body); // Print for debugging
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
// Directly parse the JSON as a list of maps
|
||||
final List<Map<String, dynamic>> result =
|
||||
List<Map<String, dynamic>>.from(jsonDecode(response.body));
|
||||
print(result); // Print result for debugging
|
||||
return result;
|
||||
} else {
|
||||
throw Exception(response.reasonPhrase);
|
||||
}
|
||||
} catch (e) {
|
||||
throw Exception(e.toString());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@ import 'package:path/path.dart';
|
|||
import 'package:unit2/model/passo/bldg_loc.dart';
|
||||
import 'package:unit2/model/passo/city.dart';
|
||||
import 'package:unit2/model/passo/class_components.dart';
|
||||
import 'package:unit2/model/passo/esignature.dart';
|
||||
import 'package:unit2/model/passo/land_property_assessment.dart';
|
||||
import 'package:unit2/model/passo/land_property_boundaries.dart';
|
||||
import 'package:unit2/model/passo/land_ref.dart';
|
||||
|
@ -14,11 +15,13 @@ import 'package:unit2/model/passo/signatories.dart';
|
|||
import 'package:unit2/model/passo/structural_materials_ii.dart';
|
||||
import 'package:unit2/model/passo/type_of_road.dart';
|
||||
import 'package:unit2/model/passo/unit_construct.dart';
|
||||
import 'package:unit2/model/passo/valid_ids.dart';
|
||||
import 'package:unit2/utils/request.dart';
|
||||
import 'package:unit2/utils/urls.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../../../../../model/passo/additional_items.dart';
|
||||
import '../../../../../model/passo/assessment_level.dart';
|
||||
import '../../../../../model/passo/barangay.dart';
|
||||
import '../../../../../model/passo/building_and_structure.dart';
|
||||
import '../../../../../model/passo/class_components _offline.dart';
|
||||
|
@ -36,6 +39,7 @@ import '../../../../../model/passo/property_appraisal.dart';
|
|||
import '../../../../../model/passo/property_assessment.dart';
|
||||
import '../../../../../model/passo/property_info.dart';
|
||||
import '../../../../../model/passo/structureMaterial.dart';
|
||||
import '../../../../../model/passo/sworn_statement.dart';
|
||||
import '../../../../../model/passo/trees_improvements.dart';
|
||||
import '../../../../../model/passo/type_of_location.dart';
|
||||
|
||||
|
@ -129,6 +133,17 @@ class SQLServices {
|
|||
)
|
||||
''');
|
||||
|
||||
await db.execute('''
|
||||
CREATE TABLE assessment_level (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
classificationId INTEGER NOT NULL,
|
||||
over TEXT NOT NULL,
|
||||
notOver TEXT NOT NULL,
|
||||
assessmentLevels TEXT NOT NULL,
|
||||
genCode TEXT NOT NULL
|
||||
)
|
||||
''');
|
||||
|
||||
await db.execute('''
|
||||
CREATE TABLE land_classification (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
|
@ -189,6 +204,27 @@ class SQLServices {
|
|||
)
|
||||
''');
|
||||
|
||||
await db.execute('''
|
||||
CREATE TABLE bldg_valid_ids (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
bldgappr_details_id INTEGER NOT NULL,
|
||||
date_created TEXT NOT NULL,
|
||||
id_attachment TEXT NOT NULL,
|
||||
gen_code TEXT NOT NULL
|
||||
)
|
||||
''');
|
||||
|
||||
await db.execute('''
|
||||
CREATE TABLE e_signature (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
bldgappr_details_id INTEGER NOT NULL,
|
||||
sign_attachment TEXT NOT NULL,
|
||||
date_created TEXT NOT NULL,
|
||||
date_modified TEXT NOT NULL,
|
||||
gen_code TEXT NOT NULL
|
||||
)
|
||||
''');
|
||||
|
||||
await db.execute('''
|
||||
CREATE TABLE value_adjustments (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
|
@ -225,7 +261,9 @@ class SQLServices {
|
|||
dateCreated TEXT NOT NULL,
|
||||
dateModified TEXT NOT NULL,
|
||||
gen_code TEXT,
|
||||
dateSynced TEXT
|
||||
dateSynced TEXT,
|
||||
citizenship TEXT,
|
||||
civil_status TEXT
|
||||
)
|
||||
''');
|
||||
|
||||
|
@ -397,6 +435,19 @@ class SQLServices {
|
|||
)
|
||||
''');
|
||||
|
||||
await db.execute('''
|
||||
CREATE TABLE sworn_statement (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
bldgapprDetailsId INTEGER NOT NULL,
|
||||
citizenship TEXT NOT NULL,
|
||||
civil TEXT NOT NULL,
|
||||
fname TEXT NOT NULL,
|
||||
mname TEXT NOT NULL,
|
||||
lname TEXT NOT NULL,
|
||||
gen_code TEXT
|
||||
)
|
||||
''');
|
||||
|
||||
await db.execute('''
|
||||
CREATE TABLE additionalitems (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
|
@ -576,6 +627,34 @@ class SQLServices {
|
|||
|
||||
return result.map((json) => City.fromJson2(json)).toList();
|
||||
}
|
||||
//Assessment Level
|
||||
|
||||
Future<AssessmentLevel> createAssessmentLevel(
|
||||
AssessmentLevel assessmentLevel) async {
|
||||
final db = await instance.database;
|
||||
|
||||
final data = {
|
||||
"classificationId": assessmentLevel.classificationId,
|
||||
"over": assessmentLevel.over,
|
||||
"notOver": assessmentLevel.notOver,
|
||||
"assessmentLevels": assessmentLevel.assessmentLevels,
|
||||
"genCode": assessmentLevel.genCode,
|
||||
};
|
||||
|
||||
final id = await db.insert('assessment_level', data);
|
||||
return assessmentLevel.copyWith(id: id);
|
||||
}
|
||||
|
||||
Future<List<AssessmentLevel>> readAllAssessmentLevels() async {
|
||||
final db = await instance.database;
|
||||
const orderBy = 'id';
|
||||
|
||||
final result = await db.query('assessment_level', orderBy: orderBy);
|
||||
print('result');
|
||||
print(result.toString());
|
||||
|
||||
return result.map((json) => AssessmentLevel.fromJson2(json)).toList();
|
||||
}
|
||||
|
||||
//Barangay
|
||||
|
||||
|
@ -908,6 +987,8 @@ class SQLServices {
|
|||
"assessedByName": propertyInfo.assessedByName,
|
||||
"dateCreated": "000",
|
||||
"dateModified": "000",
|
||||
"citizenship": propertyInfo.citizenship,
|
||||
"civil_status": propertyInfo.civilStatus
|
||||
};
|
||||
final id = await db.insert('bldg_owner', data);
|
||||
final tempID = await SharedPreferences.getInstance();
|
||||
|
@ -946,7 +1027,9 @@ class SQLServices {
|
|||
"assessedByName": propertyInfo.assessedByName,
|
||||
"dateCreated": "000",
|
||||
"dateModified": "000",
|
||||
"dateSynced": propertyInfo.dateSynced
|
||||
"dateSynced": propertyInfo.dateSynced,
|
||||
"citizenship": propertyInfo.citizenship,
|
||||
"civil_status": propertyInfo.civilStatus
|
||||
};
|
||||
|
||||
final result =
|
||||
|
@ -1219,6 +1302,131 @@ class SQLServices {
|
|||
|
||||
return results;
|
||||
}
|
||||
//E signature
|
||||
|
||||
Future<ESignature> createESignature(ESignature eSignature) async {
|
||||
final db = await instance.database;
|
||||
|
||||
final data = {
|
||||
"bldgappr_details_id": eSignature.bldgapprDetailsId,
|
||||
"sign_attachment": eSignature.signAttachment,
|
||||
"date_created": eSignature.dateCreated,
|
||||
"date_modified": eSignature.dateModified,
|
||||
"gen_code": eSignature.genCode,
|
||||
};
|
||||
|
||||
final id = await db.insert('e_signature', data);
|
||||
return eSignature.copy(bldgapprDetailsId: id);
|
||||
}
|
||||
|
||||
Future<List<Map<String, dynamic>>> getESignature(bldgapprDetailsId) async {
|
||||
final db = await instance.database;
|
||||
final results = await db.query(
|
||||
'e_signature',
|
||||
where: "bldgappr_details_id = ?",
|
||||
whereArgs: [bldgapprDetailsId],
|
||||
limit: 1,
|
||||
);
|
||||
|
||||
print('eSignature query result:');
|
||||
print(results);
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
Future<int> updateESignature(int id, ESignature eSignature) async {
|
||||
final db = await instance.database;
|
||||
|
||||
final data = {
|
||||
"bldgappr_details_id": eSignature.bldgapprDetailsId,
|
||||
"sign_attachment": eSignature.signAttachment,
|
||||
"date_created": eSignature.dateCreated,
|
||||
"date_modified": eSignature.dateModified,
|
||||
"gen_code": eSignature.genCode,
|
||||
};
|
||||
|
||||
final result = await db.update(
|
||||
'e_signature',
|
||||
data,
|
||||
where: "id = ?",
|
||||
whereArgs: [id],
|
||||
);
|
||||
|
||||
if (result > 0) {
|
||||
print('eSignature Updated Successfully');
|
||||
} else {
|
||||
throw Exception('Failed to update eSignature.');
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Valid IDS
|
||||
|
||||
Future<List<Map<String, dynamic>>> getValidIds(int bldgapprDetailsId) async {
|
||||
final db = await instance.database;
|
||||
|
||||
// Query the database for the valid ID with the provided bldgappr_details_id
|
||||
final results = await db.query(
|
||||
'bldg_valid_ids',
|
||||
where: "bldgappr_details_id = ?",
|
||||
whereArgs: [bldgapprDetailsId],
|
||||
limit: 10, // Limit the query to return only one result
|
||||
);
|
||||
|
||||
// Debugging output to print the results
|
||||
print('Valid IDs query result:');
|
||||
print(results);
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
Future<ValidIds> createValidIds(ValidIds validID) async {
|
||||
final db = await instance.database;
|
||||
|
||||
final data = {
|
||||
// "id": treesImprovements.id,
|
||||
"bldgappr_details_id": validID.bldgapprDetailsId,
|
||||
"date_created": validID.dateCreated,
|
||||
"id_attachment": validID.validIds,
|
||||
"gen_code": "5TH"
|
||||
};
|
||||
print('Valid IDs insert result:');
|
||||
print(data);
|
||||
final id = await db.insert('bldg_valid_ids', data);
|
||||
return validID.copy(bldgapprDetailsId: id);
|
||||
}
|
||||
|
||||
Future<int> updateValidIds(int id, ValidIds validID) async {
|
||||
final db = await instance.database;
|
||||
|
||||
final data = {
|
||||
"bldgappr_details_id": validID.bldgapprDetailsId,
|
||||
"date_created": validID.dateCreated,
|
||||
"id_attachment": validID.validIds,
|
||||
"gen_code": validID.genCode
|
||||
};
|
||||
|
||||
final result = await db
|
||||
.update('bldg_valid_ids', data, where: "id = ?", whereArgs: [id]);
|
||||
|
||||
if (result > 0) {
|
||||
print('Valid ID Updated Successfully');
|
||||
} else {
|
||||
throw Exception('Failed to update Valid ID.');
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Future<List<Map<String, dynamic>>> getFloorValidIds(id) async {
|
||||
final db = await instance.database;
|
||||
final results = await db.query('bldg_valid_ids',
|
||||
where: "bldgappr_details_id = ?", whereArgs: [id], limit: 1);
|
||||
print('valid ids test result');
|
||||
print(results);
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
//Structural Materials
|
||||
|
||||
|
@ -1562,6 +1770,73 @@ class SQLServices {
|
|||
return result;
|
||||
}
|
||||
|
||||
//Sworn Statement
|
||||
|
||||
Future<SwornStatement> createSwornStatement(
|
||||
SwornStatement swornStatement) async {
|
||||
final db = await instance.database;
|
||||
print("Sworn");
|
||||
print(swornStatement.toJson());
|
||||
final data = {
|
||||
"bldgapprDetailsId": swornStatement.bldgapprDetailsId,
|
||||
"citizenship": swornStatement.citizenship,
|
||||
"civil": swornStatement.civilStatus,
|
||||
"fname": swornStatement.fname,
|
||||
"mname": swornStatement.mname,
|
||||
"lname": swornStatement.lname,
|
||||
"gen_code": swornStatement.genCode,
|
||||
};
|
||||
|
||||
final id = await db.insert('sworn_statement', data);
|
||||
return swornStatement.copy(bldgapprDetailsId: id);
|
||||
}
|
||||
|
||||
Future<List<Map<String, dynamic>>> getSwornStatement(
|
||||
bldgapprDetailsId) async {
|
||||
print("Sworn ID");
|
||||
print(bldgapprDetailsId);
|
||||
final db = await instance.database;
|
||||
|
||||
final result = await db.query(
|
||||
'sworn_statement',
|
||||
where: "bldgapprDetailsId = ?",
|
||||
whereArgs: [bldgapprDetailsId],
|
||||
limit: 1, // Assuming only one record per `bldgappr_details_id`
|
||||
);
|
||||
|
||||
print('Sworn Statement fetched: $result');
|
||||
return result;
|
||||
}
|
||||
|
||||
Future<int> updateSwornStatement(
|
||||
int bldgapprDetailsId, SwornStatement swornStatement) async {
|
||||
final db = await instance.database;
|
||||
|
||||
final data = {
|
||||
"citizenship": swornStatement.citizenship,
|
||||
"civil": swornStatement.civilStatus,
|
||||
"fname": swornStatement.fname,
|
||||
"mname": swornStatement.mname,
|
||||
"lname": swornStatement.lname,
|
||||
"gen_code": swornStatement.genCode,
|
||||
};
|
||||
|
||||
final result = await db.update(
|
||||
'sworn_statement',
|
||||
data,
|
||||
where: "bldgapprDetailsId = ?",
|
||||
whereArgs: [bldgapprDetailsId],
|
||||
);
|
||||
|
||||
if (result > 0) {
|
||||
print('Sworn Statement updated successfully.');
|
||||
} else {
|
||||
throw Exception('Failed to update Sworn Statement.');
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//Land Property Owner
|
||||
|
||||
Future<LandPropertyOwner> createLandOwner(
|
||||
|
|
|
@ -41,4 +41,22 @@ class LandRefServices {
|
|||
throw e.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Future<http.Response?> update(LandRef data, id) async {
|
||||
String path = "${Url.instance.propertyInfo()}$id/";
|
||||
Map<String, String> headers = {
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'X-Client-Key': xClientKey,
|
||||
'X-Client-Secret': xClientKeySecret
|
||||
};
|
||||
|
||||
http.Response? response;
|
||||
try {
|
||||
response = await Request.instance.putRequest(
|
||||
path: path, body: data.toJson(), headers: headers, param: {});
|
||||
} catch (e) {
|
||||
throw e.toString();
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ class PropertyAssessmentServices {
|
|||
}
|
||||
|
||||
Future<http.Response?> updateEdit(
|
||||
PropertyAssessmentEdit assessment, id) async {
|
||||
PropertyAssessment assessment, id) async {
|
||||
String path = Url.instance.propertyAssessment();
|
||||
Map<String, String> headers = {
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
|
|
|
@ -19,6 +19,7 @@ String? globalMiddleName;
|
|||
DateTime? globalBday;
|
||||
String? globalSex;
|
||||
Profile? globalCurrentProfile;
|
||||
|
||||
///offline data
|
||||
bool? globalOfflineAvailable;
|
||||
OfflineProfile? globalOfflineProfile;
|
||||
|
@ -26,3 +27,14 @@ OfflineProfile? globalOfflineProfile;
|
|||
Box? CREDENTIALS;
|
||||
Box? SOS;
|
||||
Box? OFFLINE;
|
||||
|
||||
Map<String, String> getHeaders() {
|
||||
String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z";
|
||||
String xClientKeySecret = "unitcYqAN7GGalyz";
|
||||
|
||||
return {
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'X-Client-Key': xClientKey,
|
||||
'X-Client-Secret': xClientKeySecret,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
import 'dart:convert';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// Reusable function to send a POST request
|
||||
Future<http.Response?> postRequest({
|
||||
required String url,
|
||||
required Map<String, String> headers,
|
||||
required Map<String, dynamic> body,
|
||||
}) async {
|
||||
try {
|
||||
final response = await http.post(
|
||||
Uri.parse(url),
|
||||
headers: headers,
|
||||
body: jsonEncode(body),
|
||||
);
|
||||
|
||||
if (response.statusCode == 201) {
|
||||
print('Post request successful');
|
||||
} else {
|
||||
print('Failed to post: ${response.statusCode}');
|
||||
}
|
||||
|
||||
return response;
|
||||
} catch (e) {
|
||||
print('Error: $e');
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -7,12 +7,12 @@ class Url {
|
|||
// // // return '192.168.10.183:3000';
|
||||
return 'agusandelnorte.gov.ph';
|
||||
// return "192.168.10.219:3000";
|
||||
// return "192.168.10.241";
|
||||
// return "192.168.10.185";
|
||||
// return "192.168.80.110";
|
||||
// return "192.168.10.118";
|
||||
// return "192.168.10.221:3004";
|
||||
// return "playweb.agusandelnorte.gov.ph";
|
||||
// return 'devapi.agusandelnorte.gov.ph:3004';
|
||||
// return "192.168.80.21:8000";
|
||||
// return "192.168.80.20:8000";
|
||||
// return "192.168.10.247";
|
||||
// return "playcensys.agusandelnorte.gov.ph";
|
||||
// return "10.10.10.110:8000";
|
||||
|
@ -20,7 +20,7 @@ class Url {
|
|||
}
|
||||
|
||||
String prefixHost() {
|
||||
return "http";
|
||||
return "https://";
|
||||
// return "http";
|
||||
}
|
||||
|
||||
|
@ -372,6 +372,10 @@ class Url {
|
|||
return "/api/rptass_app/bldgappr_details/";
|
||||
}
|
||||
|
||||
String buildingStructure() {
|
||||
return "/api/rptass_app/bldgappr_structure/";
|
||||
}
|
||||
|
||||
String generalDescription() {
|
||||
return "/api/rptass_app/bldgappr_gendesc/";
|
||||
}
|
||||
|
@ -412,6 +416,10 @@ class Url {
|
|||
return "/api/rptass_app/agusan_city/";
|
||||
}
|
||||
|
||||
String getAssessmentLevel() {
|
||||
return "/api/rptass_app/bldgappr_assessment_levels/";
|
||||
}
|
||||
|
||||
String getSignatories() {
|
||||
return "/api/rptass_app/signatories/";
|
||||
}
|
||||
|
|
|
@ -1537,10 +1537,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: signature
|
||||
sha256: d95143b8e310b395ea0be59a46bb69fa24106cb6ec79815fc56fd320268e24e6
|
||||
sha256: "8056e091ad59c2eb5735fee975ec649d0caf8ce802bb1ffb1e0955b00a6d0daa"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.4.0"
|
||||
version: "5.5.0"
|
||||
simple_chips_input:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
|
@ -54,7 +54,7 @@ dependencies:
|
|||
flutter_progress_hud: ^2.0.2
|
||||
barcode_scan2: ^4.2.1
|
||||
qr_flutter: ^4.0.0
|
||||
signature: ^5.4.0
|
||||
signature: ^5.5.0
|
||||
awesome_dialog: ^3.0.2
|
||||
system_info2: ^2.0.4
|
||||
flutter_bloc: ^8.0.0
|
||||
|
@ -148,6 +148,8 @@ flutter:
|
|||
- assets/pngs/
|
||||
- assets/fonts/
|
||||
- assets/
|
||||
- assets/pngs/white_bg.png
|
||||
- assets/pngs/broken_lines.png
|
||||
# - images/a_dot_ham.jpeg
|
||||
|
||||
# An image asset can refer to one or more resolution-specific "variants", see
|
||||
|
|
Loading…
Reference in New Issue