passo offline mode

feature/passo/PASSO-#1-Sync-data-from-device-to-postgre-and-vice-versa
cyzoox 2024-02-08 08:52:29 +08:00
parent 8204c1fbdf
commit 5b1752b813
161 changed files with 19656 additions and 1643 deletions

View File

@ -0,0 +1,27 @@
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:unit2/model/passo/land_classification.dart';
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
part 'land_classification_event.dart';
part 'land_classification_state.dart';
class LandClassificationBloc
extends Bloc<LandClassificationEvent, LandClassificationState> {
LandClassificationBloc() : super(LandClassificationInitial()) {
List<LandClassification> landClassification = [];
on<LoadLandClassification>((event, emit) async {
landClassification =
await SQLServices.instance.readAllLandClassification();
emit(LandClassificationLoaded(landClassification: landClassification));
});
on<AddLandClassification>((event, emit) async {
await SQLServices.instance.createLandClassification(LandClassification(
id: event.id,
classificationCode: event.classificationCode,
description: event.description));
});
}
}

View File

@ -0,0 +1,34 @@
part of 'land_classification_bloc.dart';
class LandClassificationEvent extends Equatable {
const LandClassificationEvent();
@override
List<Object> get props => [];
}
class AddLandClassification extends LandClassificationEvent {
final int id;
final String classificationCode;
final String description;
const AddLandClassification({
required this.id,
required this.classificationCode,
required this.description,
});
@override
List<Object> get props => [
id,
classificationCode,
description,
];
}
class LoadLandClassification extends LandClassificationEvent {
const LoadLandClassification();
@override
List<Object> get props => [];
}

View File

@ -0,0 +1,18 @@
part of 'land_classification_bloc.dart';
class LandClassificationState extends Equatable {
const LandClassificationState();
@override
List<Object> get props => [];
}
class LandClassificationInitial extends LandClassificationState {}
class LandClassificationLoaded extends LandClassificationState {
final List<LandClassification> landClassification;
const LandClassificationLoaded({required this.landClassification});
@override
List<Object> get props => [landClassification];
}

View File

@ -0,0 +1,39 @@
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import '../../../../../model/passo/land_subclassification.dart';
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
part 'land_subclassification_event.dart';
part 'land_subclassification_state.dart';
class LandSubclassificationBloc
extends Bloc<LandSubclassificationEvent, LandSubclassificationState> {
LandSubclassificationBloc() : super(LandSubclassificationInitial()) {
List<LandSubClassification> landSubClassification = [];
on<LoadLandSubClassification>((event, emit) async {
landSubClassification =
await SQLServices.instance.readAllLandSubClassification();
emit(LandSubClassificationLoaded(
landSubClassification: landSubClassification));
});
on<LoadSpecificLandSubClassification>((event, emit) async {
landSubClassification = await SQLServices.instance
.readSpecificLandSubClassification(event.cityCode, event.classCode);
emit(LandSubClassificationLoaded(
landSubClassification: landSubClassification));
});
on<AddLandSubClassification>((event, emit) async {
await SQLServices.instance.createLandSubClassification(
LandSubClassification(
id: event.id,
classificationId: event.classificationId,
cityCode: event.cityCode,
subclassCode: event.subclassCode,
subclassDescription: event.subclassDescription,
baseUnitMarketval: event.baseUnitMarketval));
});
}
}

View File

@ -0,0 +1,54 @@
part of 'land_subclassification_bloc.dart';
class LandSubclassificationEvent extends Equatable {
const LandSubclassificationEvent();
@override
List<Object> get props => [];
}
class AddLandSubClassification extends LandSubclassificationEvent {
final int id;
final int classificationId;
final String cityCode;
final String subclassCode;
final String subclassDescription;
final String baseUnitMarketval;
const AddLandSubClassification({
required this.id,
required this.classificationId,
required this.cityCode,
required this.subclassCode,
required this.subclassDescription,
required this.baseUnitMarketval,
});
@override
List<Object> get props => [
id,
classificationId,
cityCode,
subclassCode,
subclassDescription,
baseUnitMarketval,
];
}
class LoadLandSubClassification extends LandSubclassificationEvent {
const LoadLandSubClassification();
@override
List<Object> get props => [];
}
class LoadSpecificLandSubClassification extends LandSubclassificationEvent {
final String cityCode;
final int classCode;
const LoadSpecificLandSubClassification(
{required this.cityCode, required this.classCode});
@override
List<Object> get props => [cityCode, classCode];
}

View File

@ -0,0 +1,18 @@
part of 'land_subclassification_bloc.dart';
class LandSubclassificationState extends Equatable {
const LandSubclassificationState();
@override
List<Object> get props => [];
}
class LandSubclassificationInitial extends LandSubclassificationState {}
class LandSubClassificationLoaded extends LandSubclassificationState {
final List<LandSubClassification> landSubClassification;
const LandSubClassificationLoaded({required this.landSubClassification});
@override
List<Object> get props => [landSubClassification];
}

View File

@ -0,0 +1,27 @@
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import '../../../../../model/passo/trees_improvements.dart';
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
part 'trees_improvements_event.dart';
part 'trees_improvements_state.dart';
class TreesImprovementsBloc
extends Bloc<TreesImprovementsEvent, TreesImprovementsState> {
TreesImprovementsBloc() : super(TreesImprovementsInitial()) {
List<TreesImprovements> treesImprovements = [];
on<LoadTreesImprovements>((event, emit) async {
treesImprovements = await SQLServices.instance.readAllTreesImprovements();
emit(TreesImprovementsLoaded(treesImprovements: treesImprovements));
});
on<AddTreesImprovements>((event, emit) async {
await SQLServices.instance.createTreesImprovements(TreesImprovements(
id: event.id,
improvement: event.improvement,
pricePerTree: event.pricePerTree,
subclassCode: event.subclassCode));
});
}
}

View File

@ -0,0 +1,37 @@
part of 'trees_improvements_bloc.dart';
class TreesImprovementsEvent extends Equatable {
const TreesImprovementsEvent();
@override
List<Object> get props => [];
}
class AddTreesImprovements extends TreesImprovementsEvent {
final int id;
final String improvement;
final String pricePerTree;
final dynamic subclassCode;
const AddTreesImprovements({
required this.id,
required this.improvement,
required this.pricePerTree,
required this.subclassCode,
});
@override
List<Object> get props => [
id,
improvement,
pricePerTree,
subclassCode,
];
}
class LoadTreesImprovements extends TreesImprovementsEvent {
const LoadTreesImprovements();
@override
List<Object> get props => [];
}

View File

@ -0,0 +1,18 @@
part of 'trees_improvements_bloc.dart';
class TreesImprovementsState extends Equatable {
const TreesImprovementsState();
@override
List<Object> get props => [];
}
class TreesImprovementsInitial extends TreesImprovementsState {}
class TreesImprovementsLoaded extends TreesImprovementsState {
final List<TreesImprovements> treesImprovements;
const TreesImprovementsLoaded({required this.treesImprovements});
@override
List<Object> get props => [treesImprovements];
}

View File

@ -0,0 +1,27 @@
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import '../../../../../model/passo/type_of_location.dart';
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
part 'type_of_location_event.dart';
part 'type_of_location_state.dart';
class TypeOfLocationBloc
extends Bloc<TypeOfLocationEvent, TypeOfLocationState> {
TypeOfLocationBloc() : super(TypeOfLocationInitial()) {
List<TypeOfLocation> typeOfLocation = [];
on<LoadTypeOfLocation>((event, emit) async {
typeOfLocation = await SQLServices.instance.readAllTypeOfLocation();
emit(TypeOfLocationLoaded(typeOfLocation: typeOfLocation));
});
on<AddTypeOfLocation>((event, emit) async {
await SQLServices.instance.createTypeOfLocation(TypeOfLocation(
id: event.id,
distanceKm: event.distanceKm,
allRoadTypes: event.allRoadTypes,
localTradingCenter: event.localTradingCenter));
});
}
}

View File

@ -0,0 +1,37 @@
part of 'type_of_location_bloc.dart';
class TypeOfLocationEvent extends Equatable {
const TypeOfLocationEvent();
@override
List<Object> get props => [];
}
class AddTypeOfLocation extends TypeOfLocationEvent {
final int id;
final String distanceKm;
final String allRoadTypes;
final String localTradingCenter;
const AddTypeOfLocation({
required this.id,
required this.distanceKm,
required this.allRoadTypes,
required this.localTradingCenter,
});
@override
List<Object> get props => [
id,
distanceKm,
allRoadTypes,
localTradingCenter,
];
}
class LoadTypeOfLocation extends TypeOfLocationEvent {
const LoadTypeOfLocation();
@override
List<Object> get props => [];
}

View File

@ -0,0 +1,18 @@
part of 'type_of_location_bloc.dart';
class TypeOfLocationState extends Equatable {
const TypeOfLocationState();
@override
List<Object> get props => [];
}
class TypeOfLocationInitial extends TypeOfLocationState {}
class TypeOfLocationLoaded extends TypeOfLocationState {
final List<TypeOfLocation> typeOfLocation;
const TypeOfLocationLoaded({required this.typeOfLocation});
@override
List<Object> get props => [typeOfLocation];
}

View File

@ -0,0 +1,26 @@
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import '../../../../../model/passo/type_of_road.dart';
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
part 'type_of_road_event.dart';
part 'type_of_road_state.dart';
class TypeOfRoadBloc extends Bloc<TypeOfRoadEvent, TypeOfRoadState> {
TypeOfRoadBloc() : super(TypeOfRoadInitial()) {
List<TypeOfRoad> typeOfRoad = [];
on<LoadTypeOfRoad>((event, emit) async {
typeOfRoad = await SQLServices.instance.readAllTypeOfRoad();
emit(TypeOfRoadLoaded(typeOfRoad: typeOfRoad));
});
on<AddTypeOfRoad>((event, emit) async {
await SQLServices.instance.createTypeOfRoad(TypeOfRoad(
id: event.id,
roadType: event.roadType,
deduction: event.deduction,
));
});
}
}

View File

@ -0,0 +1,34 @@
part of 'type_of_road_bloc.dart';
class TypeOfRoadEvent extends Equatable {
const TypeOfRoadEvent();
@override
List<Object> get props => [];
}
class AddTypeOfRoad extends TypeOfRoadEvent {
final int id;
final String roadType;
final String deduction;
const AddTypeOfRoad({
required this.id,
required this.roadType,
required this.deduction,
});
@override
List<Object> get props => [
id,
roadType,
deduction,
];
}
class LoadTypeOfRoad extends TypeOfRoadEvent {
const LoadTypeOfRoad();
@override
List<Object> get props => [];
}

View File

@ -0,0 +1,18 @@
part of 'type_of_road_bloc.dart';
class TypeOfRoadState extends Equatable {
const TypeOfRoadState();
@override
List<Object> get props => [];
}
class TypeOfRoadInitial extends TypeOfRoadState {}
class TypeOfRoadLoaded extends TypeOfRoadState {
final List<TypeOfRoad> typeOfRoad;
const TypeOfRoadLoaded({required this.typeOfRoad});
@override
List<Object> get props => [typeOfRoad];
}

View File

@ -0,0 +1,31 @@
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import '../../../../../model/passo/land_value_adjustment.dart';
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
part 'value_adjustments_event.dart';
part 'value_adjustments_state.dart';
class ValueAdjustmentsBloc
extends Bloc<ValueAdjustmentsEvent, ValueAdjustmentsState> {
ValueAdjustmentsBloc() : super(ValueAdjustmentsInitial()) {
List<ValueAdjustments> valueAdjustments = [];
on<LoadValueAdjustments>((event, emit) async {
valueAdjustments = await SQLServices.instance.readAllValueAdjustments();
emit(ValueAdjustmentsLoaded(valueAdjustments: valueAdjustments));
});
on<AddValueAdjustments>((event, emit) async {
await SQLServices.instance.createValueAdjustments(ValueAdjustments(
id: event.id,
landapprDetailsId: event.landapprDetailsId,
baseMarketval: event.baseMarketval,
adjustmentFactors: event.adjustmentFactors,
adjustment: event.adjustment,
valueAdjustment: event.valueAdjustment,
marketValue: event.marketValue,
));
});
}
}

View File

@ -0,0 +1,46 @@
part of 'value_adjustments_bloc.dart';
class ValueAdjustmentsEvent extends Equatable {
const ValueAdjustmentsEvent();
@override
List<Object> get props => [];
}
class AddValueAdjustments extends ValueAdjustmentsEvent {
final int id;
final int landapprDetailsId;
final String baseMarketval;
final String adjustmentFactors;
final String adjustment;
final String valueAdjustment;
final String marketValue;
const AddValueAdjustments({
required this.id,
required this.landapprDetailsId,
required this.baseMarketval,
required this.adjustmentFactors,
required this.adjustment,
required this.valueAdjustment,
required this.marketValue,
});
@override
List<Object> get props => [
id,
landapprDetailsId,
baseMarketval,
adjustmentFactors,
adjustment,
valueAdjustment,
marketValue,
];
}
class LoadValueAdjustments extends ValueAdjustmentsEvent {
const LoadValueAdjustments();
@override
List<Object> get props => [];
}

View File

@ -0,0 +1,18 @@
part of 'value_adjustments_bloc.dart';
class ValueAdjustmentsState extends Equatable {
const ValueAdjustmentsState();
@override
List<Object> get props => [];
}
class ValueAdjustmentsInitial extends ValueAdjustmentsState {}
class ValueAdjustmentsLoaded extends ValueAdjustmentsState {
final List<ValueAdjustments> valueAdjustments;
const ValueAdjustmentsLoaded({required this.valueAdjustments});
@override
List<Object> get props => [valueAdjustments];
}

View File

@ -27,10 +27,9 @@ class AdditionalItemsOfflineBloc
await SQLServices.instance.getAdditionalItems(event.id);
if (result.isNotEmpty) {
List<AdditionalItems> locationList =
result.map((map) => AdditionalItems.fromJson(map)).toList();
addItems = result.map((map) => AdditionalItems.fromJson(map)).toList();
emit(AdditionalItemsLoaded(addItem: locationList));
emit(AdditionalItemsLoaded(addItem: addItems));
} else {
print('No data found.');
}
@ -74,5 +73,11 @@ class AdditionalItemsOfflineBloc
addItems = await SQLServices.instance.readAdditionalItems();
emit(AdditionalItemsLoaded(addItem: addItems));
});
on<DeleteAdditionalItems>((event, emit) async {
addItems
.removeWhere(((AdditionalItems element) => element.id == event.id));
await SQLServices.instance.deleteAdditionalItems(id: event.id);
emit(const AdditionalItemsDeletedState(success: true));
});
}
}

View File

@ -30,6 +30,10 @@ class AddAdditionalItems extends AdditionalItemsOfflineEvent {
final int id;
final int bldgapprDetailsId;
final int classId;
final String assessedById;
final String assessedByName;
final String dateCreated;
final String dateModified;
final String className;
final String structType;
final dynamic unitValue;
@ -49,6 +53,10 @@ class AddAdditionalItems extends AdditionalItemsOfflineEvent {
required this.id,
required this.bldgapprDetailsId,
required this.classId,
required this.assessedById,
required this.assessedByName,
required this.dateCreated,
required this.dateModified,
required this.className,
required this.structType,
required this.unitValue,
@ -70,6 +78,10 @@ class AddAdditionalItems extends AdditionalItemsOfflineEvent {
id,
bldgapprDetailsId,
classId,
assessedById,
assessedByName,
dateCreated,
dateModified,
className,
structType,
unitValue,

View File

@ -31,5 +31,27 @@ class BldgAppraisalOfflineBloc
totalArea: event.totalArea,
actualUse: event.actualUse));
});
on<FetchSingleBldgAppraisal>((event, emit) async {
List<Map<String, dynamic>> result =
await SQLServices.instance.getBldgAppraisal(event.id);
if (result.isNotEmpty) {
List<PropertyAppraisal> appraisalList =
result.map((map) => PropertyAppraisal.fromJson2(map)).toList();
// Choose a specific element from locationList
PropertyAppraisal firstAppraisal = appraisalList
.first; // You can change this to select a specific item
print('appraisal test result');
print(firstAppraisal.toJson());
emit(SpecificBldgAppraisalLoaded(appraisal: firstAppraisal));
} else {
print('No data found.');
}
});
on<UpdateAppraisal>((event, emit) async {
await SQLServices.instance.updateAppraisal(event.id, event.appraisal);
});
}
}

View File

@ -12,8 +12,8 @@ class AddBldgAppraisal extends BldgAppraisalOfflineEvent {
final int bldgapprDetailsId;
final String assessedById;
final String assessedByName;
final DateTime dateCreated;
final DateTime dateModified;
final String dateCreated;
final String dateModified;
final String unitconstructCost;
final String buildingCore;
final String unitconstructSubtotal;
@ -66,3 +66,21 @@ class AddBldgAppraisal extends BldgAppraisalOfflineEvent {
actualUse
];
}
class FetchSingleBldgAppraisal extends BldgAppraisalOfflineEvent {
final int id;
const FetchSingleBldgAppraisal({required this.id});
@override
List<Object> get props => [id];
}
class UpdateAppraisal extends BldgAppraisalOfflineEvent {
final PropertyAppraisal appraisal;
final int id;
const UpdateAppraisal({required this.id, required this.appraisal});
@override
List<Object> get props => [id, appraisal];
}

View File

@ -27,3 +27,11 @@ class LoadSpecificBldgAppraisalOffline extends BldgAppraisalOfflineState {
@override
List<Object> get props => [appraisal];
}
class SpecificBldgAppraisalLoaded extends BldgAppraisalOfflineState {
final PropertyAppraisal appraisal;
const SpecificBldgAppraisalLoaded({required this.appraisal});
@override
List<Object> get props => [appraisal];
}

View File

@ -21,8 +21,8 @@ class BldgAssessmentOfflineBloc
assessedValue: event.assessedValue,
taxable: event.taxable,
exempt: event.exempt,
qtr: event.qtr,
yr: event.yr,
qtr: event.qtr.toString(),
yr: event.yr.toString(),
appraisedbyName: event.appraisedbyName,
appraisedbyDate: event.appraisedbyDate,
recommendapprName: event.recommendapprName,
@ -34,5 +34,27 @@ class BldgAssessmentOfflineBloc
entryDateAssessment: event.entryDateAssessment,
entryDateBy: event.entryDateBy));
});
on<FetchSingleBldgAssessment>((event, emit) async {
List<Map<String, dynamic>> result =
await SQLServices.instance.getBldgAssessment(event.id);
if (result.isNotEmpty) {
List<PropertyAssessment> assessmentList =
result.map((map) => PropertyAssessment.fromJson2(map)).toList();
// Choose a specific element from locationList
PropertyAssessment firstAssessment = assessmentList
.first; // You can change this to select a specific item
print('assessment test result');
print(firstAssessment.toJson());
emit(SpecificBldgAssessmentLoaded(assessment: firstAssessment));
} else {
print('No data found.');
}
});
on<UpdateBldgAssessment>((event, emit) async {
await SQLServices.instance.updateAssessment(event.id, event.assessment);
});
}
}

View File

@ -10,28 +10,36 @@ class BldgAssessmentOfflineEvent extends Equatable {
class AddBldgAssessment extends BldgAssessmentOfflineEvent {
final int id;
final int bldgapprDetailsId;
final String assessedById;
final String assessedByName;
final String dateCreated;
final String dateModified;
final String actualUse;
final String marketValue;
final String assessmentLevel;
final String assessedValue;
final bool taxable;
final bool exempt;
final String taxable;
final String exempt;
final int qtr;
final int yr;
final String appraisedbyName;
final DateTime appraisedbyDate;
final String appraisedbyDate;
final String recommendapprName;
final DateTime recommendapprDate;
final String recommendapprDate;
final String approvedbyName;
final String memoranda;
final String swornstatementNo;
final DateTime dateReceived;
final DateTime entryDateAssessment;
final String dateReceived;
final String entryDateAssessment;
final String entryDateBy;
const AddBldgAssessment({
required this.id,
required this.bldgapprDetailsId,
required this.assessedById,
required this.assessedByName,
required this.dateCreated,
required this.dateModified,
required this.actualUse,
required this.marketValue,
required this.assessmentLevel,
@ -56,6 +64,10 @@ class AddBldgAssessment extends BldgAssessmentOfflineEvent {
List<Object> get props => [
id,
bldgapprDetailsId,
assessedById,
assessedByName,
dateCreated,
dateModified,
actualUse,
marketValue,
assessmentLevel,
@ -76,3 +88,21 @@ class AddBldgAssessment extends BldgAssessmentOfflineEvent {
entryDateBy,
];
}
class FetchSingleBldgAssessment extends BldgAssessmentOfflineEvent {
final int id;
const FetchSingleBldgAssessment({required this.id});
@override
List<Object> get props => [id];
}
class UpdateBldgAssessment extends BldgAssessmentOfflineEvent {
final PropertyAssessment assessment;
final int id;
UpdateBldgAssessment({required this.id, required this.assessment});
@override
List<Object> get props => [id, assessment];
}

View File

@ -27,3 +27,11 @@ class LoadSpecificBldgAssessmentOffline extends BldgAssessmentOfflineState {
@override
List<Object> get props => [assessment];
}
class SpecificBldgAssessmentLoaded extends BldgAssessmentOfflineState {
final PropertyAssessment assessment;
const SpecificBldgAssessmentLoaded({required this.assessment});
@override
List<Object> get props => [assessment];
}

View File

@ -0,0 +1,66 @@
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import '../../../../../model/passo/additional_items.dart';
import '../../../../../model/passo/building_and_structure.dart';
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
part 'building_and_structure_event.dart';
part 'building_and_structure_state.dart';
class BuildingAndStructureBloc
extends Bloc<BuildingAndStructureEvent, BuildingAndStructureState> {
BuildingAndStructureBloc() : super(BuildingAndStructureOfflineInitial()) {
List<BldgAndStructure> bldgAndStructure = [];
on<LoadBuildingAndStructure>((event, emit) async {
emit(BuildingAndStructureOfflineInitial());
try {
emit(BuildingAndStructureLoaded(bldgAndStructure: bldgAndStructure));
} catch (e) {
emit(BuildingAndStructureErrorState(e.toString()));
}
});
on<LoadBuildingAndStructureEdit>((event, emit) async {
emit(BuildingAndStructureOfflineInitial());
List<Map<String, dynamic>> result =
await SQLServices.instance.getBuildingAndStructure(event.id);
if (result.isNotEmpty) {
bldgAndStructure =
result.map((map) => BldgAndStructure.fromJson(map)).toList();
emit(BuildingAndStructureLoaded(bldgAndStructure: bldgAndStructure));
} else {
print('No data found.');
}
});
on<AddBuildingAndStructure>((event, emit) async {
try {
BldgAndStructure item = await SQLServices.instance
.createBuildingAndStructure(event.bldgAndStructure);
print(item.toJson());
bldgAndStructure.add(item);
emit(BuildingAndStructureLoaded(bldgAndStructure: bldgAndStructure));
} catch (e) {
print(e.toString());
}
});
on<ShowBuildingAndStructure>((event, emit) async {
emit(ShowBldgAndStructuresScreen());
});
on<FetchBuildingAndStructure>((event, emit) async {
bldgAndStructure = await SQLServices.instance.readBuildingAndStructure();
emit(BuildingAndStructureLoaded(bldgAndStructure: bldgAndStructure));
});
on<DeleteBuildingAndStructure>((event, emit) async {
bldgAndStructure
.removeWhere(((BldgAndStructure element) => element.id == event.id));
await SQLServices.instance.deleteBuildingAndStructure(id: event.id);
emit(const BuildingAndStructureDeletedState(success: true));
});
}
}

View File

@ -0,0 +1,68 @@
part of 'building_and_structure_bloc.dart';
class BuildingAndStructureEvent extends Equatable {
const BuildingAndStructureEvent();
@override
List<Object> get props => [];
}
class LoadBuildingAndStructure extends BuildingAndStructureEvent {
final List<BldgAndStructure> bldgAndStructure;
const LoadBuildingAndStructure(
{this.bldgAndStructure = const <BldgAndStructure>[]});
@override
List<Object> get props => [bldgAndStructure];
}
class LoadBuildingAndStructureEdit extends BuildingAndStructureEvent {
final List<BldgAndStructure> bldgAndStructure;
final int? id;
const LoadBuildingAndStructureEdit({required this.bldgAndStructure, this.id});
@override
List<Object> get props => [bldgAndStructure];
}
class AddBuildingAndStructure extends BuildingAndStructureEvent {
final BldgAndStructure bldgAndStructure;
const AddBuildingAndStructure({required this.bldgAndStructure});
@override
List<Object> get props => [bldgAndStructure];
}
class UpdateBuildingAndStructure extends BuildingAndStructureEvent {
final BldgAndStructure addItems;
const UpdateBuildingAndStructure({required this.addItems});
@override
List<Object> get props => [addItems];
}
class FetchBuildingAndStructure extends BuildingAndStructureEvent {
const FetchBuildingAndStructure();
@override
List<Object> get props => [];
}
class FetchSpecificBuildingAndStructure extends BuildingAndStructureEvent {
final int id;
const FetchSpecificBuildingAndStructure({required this.id});
@override
List<Object> get props => [id];
}
class DeleteBuildingAndStructure extends BuildingAndStructureEvent {
final int id;
const DeleteBuildingAndStructure({required this.id});
@override
List<Object> get props => [id];
}
class ShowBuildingAndStructure extends BuildingAndStructureEvent {}

View File

@ -0,0 +1,46 @@
part of 'building_and_structure_bloc.dart';
class BuildingAndStructureState extends Equatable {
const BuildingAndStructureState();
@override
List<Object> get props => [];
}
class BuildingAndStructureOfflineInitial extends BuildingAndStructureState {
@override
List<Object> get props => [];
}
class BuildingAndStructureLoaded extends BuildingAndStructureState {
final List<BldgAndStructure> bldgAndStructure;
const BuildingAndStructureLoaded({required this.bldgAndStructure});
@override
List<Object> get props => [bldgAndStructure];
}
class LoadSpecificBuildingAndStructure extends BuildingAndStructureState {
final BldgAndStructure bldgAndStructure;
const LoadSpecificBuildingAndStructure({required this.bldgAndStructure});
@override
List<Object> get props => [bldgAndStructure];
}
class ShowBldgAndStructuresScreen extends BuildingAndStructureState {}
class BuildingAndStructureErrorState extends BuildingAndStructureState {
const BuildingAndStructureErrorState(this.error);
final String error;
@override
List<Object> get props => [error];
}
class BuildingAndStructureDeletedState extends BuildingAndStructureState {
final bool success;
const BuildingAndStructureDeletedState({required this.success});
@override
List<Object> get props => [success];
}

View File

@ -34,7 +34,8 @@ class GeneralDescriptionBloc
area4Thfloor: event.area4Thfloor,
totalFloorArea: event.totalFloorArea,
floorSketch: event.floorSketch,
actualUse: event.actualUse));
actualUse: event.actualUse,
unitValue: event.unitValue));
});
on<FetchSingleGeneralDescription>((event, emit) async {
List<Map<String, dynamic>> result =
@ -55,5 +56,9 @@ class GeneralDescriptionBloc
print('No data found.');
}
});
on<UpdateGeneralDescription>((event, emit) async {
await SQLServices.instance
.updateGeneralDescription(event.id, event.gendesc);
});
}
}

View File

@ -12,6 +12,8 @@ class AddGendesc extends GeneralDescriptionEvent {
final int bldgapprDetailsId;
final String assessedById;
final String assessedByName;
final String dateCreated;
final String dateModified;
final String bldgKind;
final String strucType;
final String bldgPermit;
@ -30,31 +32,34 @@ class AddGendesc extends GeneralDescriptionEvent {
final String totalFloorArea;
final dynamic floorSketch;
final String actualUse;
final String unitValue;
const AddGendesc({
required this.id,
required this.bldgapprDetailsId,
required this.assessedById,
required this.assessedByName,
required this.bldgKind,
required this.strucType,
required this.bldgPermit,
required this.dateIssued,
required this.cct,
required this.certCompletionIssued,
required this.certOccupancyIssued,
required this.dateCompleted,
required this.dateOccupied,
required this.bldgAge,
required this.noStoreys,
required this.area1Stfloor,
required this.area2Ndfloor,
required this.area3Rdfloor,
required this.area4Thfloor,
required this.totalFloorArea,
required this.floorSketch,
required this.actualUse,
});
const AddGendesc(
{required this.id,
required this.bldgapprDetailsId,
required this.assessedById,
required this.assessedByName,
required this.dateCreated,
required this.dateModified,
required this.bldgKind,
required this.strucType,
required this.bldgPermit,
required this.dateIssued,
required this.cct,
required this.certCompletionIssued,
required this.certOccupancyIssued,
required this.dateCompleted,
required this.dateOccupied,
required this.bldgAge,
required this.noStoreys,
required this.area1Stfloor,
required this.area2Ndfloor,
required this.area3Rdfloor,
required this.area4Thfloor,
required this.totalFloorArea,
required this.floorSketch,
required this.actualUse,
required this.unitValue});
@override
List<Object> get props => [
@ -62,6 +67,8 @@ class AddGendesc extends GeneralDescriptionEvent {
bldgapprDetailsId,
assessedById,
assessedByName,
dateCreated,
dateModified,
bldgKind,
strucType,
bldgPermit,
@ -80,6 +87,7 @@ class AddGendesc extends GeneralDescriptionEvent {
totalFloorArea,
floorSketch,
actualUse,
unitValue
];
}
@ -90,3 +98,13 @@ class FetchSingleGeneralDescription extends GeneralDescriptionEvent {
@override
List<Object> get props => [id];
}
class UpdateGeneralDescription extends GeneralDescriptionEvent {
final GeneralDesc gendesc;
final int id;
UpdateGeneralDescription({required this.id, required this.gendesc});
@override
List<Object> get props => [id, gendesc];
}

View File

@ -70,6 +70,10 @@ class LandrefLocationBloc
}
});
on<UpdateBldgLandRef>((event, emit) async {
await SQLServices.instance.updateLandRef(event.id, event.landRef);
});
// on<DeleteTodo>((event, emit) async {
// await PropertyOwnerInfoServices.instance.delete(id: event.id);
// add(const FetchTodos());

View File

@ -19,20 +19,23 @@ class AddLandRef extends LandrefLocationEvent {
final dynamic area;
final dynamic surveyNo;
final dynamic blkNo;
final String dateCreated;
final String dateModified;
const AddLandRef({
required this.id,
required this.bldgapprDetailsId,
required this.assessedById,
required this.assessedByName,
required this.owner,
required this.cloaNo,
required this.lotNo,
required this.tdn,
required this.area,
required this.surveyNo,
required this.blkNo,
});
const AddLandRef(
{required this.id,
required this.bldgapprDetailsId,
required this.assessedById,
required this.assessedByName,
required this.owner,
required this.cloaNo,
required this.lotNo,
required this.tdn,
required this.area,
required this.surveyNo,
required this.blkNo,
required this.dateCreated,
required this.dateModified});
@override
List<Object> get props => [
@ -46,15 +49,20 @@ class AddLandRef extends LandrefLocationEvent {
tdn,
area,
surveyNo,
blkNo
blkNo,
dateCreated,
dateModified
];
}
class UpdateTodo extends LandrefLocationEvent {
final Todo todo;
const UpdateTodo({required this.todo});
class UpdateBldgLandRef extends LandrefLocationEvent {
final LandRef landRef;
final int id;
UpdateBldgLandRef({required this.id, required this.landRef});
@override
List<Object> get props => [todo];
List<Object> get props => [id, landRef];
}
class FetchLanRef extends LandrefLocationEvent {

View File

@ -3,8 +3,6 @@ import 'package:equatable/equatable.dart';
import 'package:unit2/sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
import '../../../../../model/passo/bldg_loc.dart';
import '../../../../../model/passo/todo.dart';
import '../../../../../sevices/offline/offline_passo/building/property_owner_info_service.dart';
part 'location_event.dart';
part 'location_state.dart';
@ -43,5 +41,8 @@ class LocationBloc extends Bloc<LocationEvent, LocationState> {
print('No data found.');
}
});
on<UpdateBldgLoc>((event, emit) async {
await SQLServices.instance.updateLocation(event.id, event.bldgLoc);
});
}
}

View File

@ -16,17 +16,20 @@ class AddLocation extends LocationEvent {
final String barangay;
final String municipality;
final String province;
final String dateCreated;
final String dateModified;
const AddLocation({
required this.id,
required this.bldgapprDetailsId,
required this.assessedById,
required this.assessedByName,
required this.street,
required this.barangay,
required this.municipality,
required this.province,
});
const AddLocation(
{required this.id,
required this.bldgapprDetailsId,
required this.assessedById,
required this.assessedByName,
required this.street,
required this.barangay,
required this.municipality,
required this.province,
required this.dateCreated,
required this.dateModified});
@override
List<Object> get props => [
@ -37,14 +40,19 @@ class AddLocation extends LocationEvent {
barangay,
municipality,
province,
dateCreated,
dateModified
];
}
class UpdateTodo extends LocationEvent {
final Todo todo;
const UpdateTodo({required this.todo});
class UpdateBldgLoc extends LocationEvent {
final BldgLoc bldgLoc;
final int id;
UpdateBldgLoc({required this.id, required this.bldgLoc});
@override
List<Object> get props => [todo];
List<Object> get props => [id, bldgLoc];
}
class FetchLanRef extends LocationEvent {

View File

@ -10,36 +10,50 @@ part 'crud_state.dart';
class CrudBloc extends Bloc<CrudEvent, CrudState> {
CrudBloc() : super(CrudInitial()) {
List<PropertyInfo> todos = [];
List<PropertyInfo> propertyOwner = [];
on<AddTodo>((event, emit) async {
await SQLServices.instance.createBldgOwner(
PropertyInfo(
transCode: event.transCode,
tdn: event.tdn,
pin: event.pin,
owner: event.owner,
address: event.address,
telno: event.telno,
tin: event.tin,
adminUser: event.adminUser,
adminAddress: event.adminAddress,
adminTelno: event.adminTelno,
adminTin: event.adminTin,
faasType: event.faasType,
assessedById: event.assessedById,
assessedByName: event.assessedByName),
);
try {
PropertyInfo ownerInfo;
ownerInfo = await SQLServices.instance.createBldgOwner(
PropertyInfo(
transCode: event.transCode,
tdn: event.tdn,
pin: event.pin,
owner: event.owner,
address: event.address,
telno: event.telno,
tin: event.tin,
adminUser: event.adminUser,
adminAddress: event.adminAddress,
adminTelno: event.adminTelno,
adminTin: event.adminTin,
faasType: event.faasType,
assessedById: event.assessedById,
assessedByName: event.assessedByName,
dateCreated: event.dateCreated,
dateModified: event.dateModified),
);
propertyOwner.add(ownerInfo);
emit(PropertyInfoLoaded(propertyInfos: propertyOwner));
} catch (e) {
emit(PropertyOwnerInfoErrorState(errorMessage: 'Failed to add todo'));
print('Error: $e');
// You might want to throw or log the error, or take other appropriate actions
// If you want to rethrow the error, uncomment the following line
// throw e;
}
});
on<UpdateTodo>((event, emit) async {
await PropertyOwnerInfoServices.instance.update(
todo: event.todo,
);
on<UpdatePropertyOwnerInfo>((event, emit) async {
await SQLServices.instance.updateBldgOwner(event.id, event.propertyInfo);
});
on<FetchTodos>((event, emit) async {
todos = await SQLServices.instance.readAllBldgOwner();
emit(DisplayTodos(todo: todos));
propertyOwner = await SQLServices.instance.readAllBldgOwner();
emit(PropertyInfoLoaded(propertyInfos: propertyOwner));
});
// on<FetchSpecificTodo>((event, emit) async {

View File

@ -20,6 +20,8 @@ class AddTodo extends CrudEvent {
final String faasType;
final String assessedById;
final String assessedByName;
final String dateCreated;
final String dateModified;
const AddTodo(
{required this.id,
@ -36,7 +38,9 @@ class AddTodo extends CrudEvent {
required this.adminTin,
required this.faasType,
required this.assessedById,
required this.assessedByName});
required this.assessedByName,
required this.dateCreated,
required this.dateModified});
@override
List<Object?> get props => [
@ -54,15 +58,20 @@ class AddTodo extends CrudEvent {
adminTin,
faasType,
assessedById,
assessedByName
assessedByName,
dateCreated,
dateModified
];
}
class UpdateTodo extends CrudEvent {
final Todo todo;
const UpdateTodo({required this.todo});
class UpdatePropertyOwnerInfo extends CrudEvent {
final PropertyInfo propertyInfo;
final int id;
UpdatePropertyOwnerInfo({required this.id, required this.propertyInfo});
@override
List<Object?> get props => [todo];
List<Object> get props => [id, propertyInfo];
}
class FetchTodos extends CrudEvent {

View File

@ -9,12 +9,24 @@ class CrudInitial extends CrudState {
List<Object> get props => [];
}
class DisplayTodos extends CrudState {
final List<PropertyInfo> todo;
const DisplayTodos({required this.todo});
class PropertyOwnerInfoLoading extends CrudState {
@override
List<Object> get props => [todo];
List<Object> get props => [];
}
class PropertyOwnerInfoErrorState extends CrudState {
final String errorMessage;
const PropertyOwnerInfoErrorState({required this.errorMessage});
@override
List<Object> get props => [errorMessage];
}
class PropertyInfoLoaded extends CrudState {
final List<PropertyInfo> propertyInfos;
const PropertyInfoLoaded({required this.propertyInfos});
@override
List<Object> get props => [propertyInfos];
}
class DisplaySpecificTodo extends CrudState {

View File

@ -32,7 +32,7 @@ class StructuralMaterialOfflineBloc extends Bloc<StructuralMaterialOfflineEvent,
if (result.isNotEmpty) {
List<StructureMaterials> materialList =
result.map((map) => StructureMaterials.fromJson(map)).toList();
result.map((map) => StructureMaterials.fromJson2(map)).toList();
// Choose a specific element from locationList
StructureMaterials firstMaterial =
@ -45,5 +45,9 @@ class StructuralMaterialOfflineBloc extends Bloc<StructuralMaterialOfflineEvent,
print('No data found.');
}
});
on<UpdateStructuralMaterials>((event, emit) async {
await SQLServices.instance
.updateStructuralMaterial(event.id, event.materials);
});
}
}

View File

@ -18,19 +18,26 @@ class AddStructuralMaterial extends StructuralMaterialOfflineEvent {
final List<String>? flooring;
final List<String>? walls;
final List<String>? others;
final String assessedById;
final String assessedByName;
final String dateCreated;
final String dateModified;
const AddStructuralMaterial({
required this.id,
required this.bldgapprDetailsId,
required this.foundation,
required this.columns,
required this.beams,
required this.trussFraming,
required this.roof,
required this.flooring,
required this.walls,
required this.others,
});
const AddStructuralMaterial(
{required this.id,
required this.bldgapprDetailsId,
required this.foundation,
required this.columns,
required this.beams,
required this.trussFraming,
required this.roof,
required this.flooring,
required this.walls,
required this.others,
required this.assessedById,
required this.assessedByName,
required this.dateCreated,
required this.dateModified});
@override
List<Object> get props => [
@ -43,7 +50,11 @@ class AddStructuralMaterial extends StructuralMaterialOfflineEvent {
...?roof,
...?flooring,
...?walls,
...?others
...?others,
assessedById,
assessedByName,
dateCreated,
dateModified
];
}
@ -54,3 +65,13 @@ class FetchSingleStructuralMaterial extends StructuralMaterialOfflineEvent {
@override
List<Object> get props => [id];
}
class UpdateStructuralMaterials extends StructuralMaterialOfflineEvent {
final StructureMaterialsII materials;
final int id;
UpdateStructuralMaterials({required this.id, required this.materials});
@override
List<Object> get props => [id, materials];
}

View File

@ -0,0 +1,71 @@
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:unit2/bloc/passo/land/land_appraisal/land_appraisal_bloc.dart';
import 'package:unit2/model/passo/land_appr.dart';
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
part 'land_property_appraisal_event.dart';
part 'land_property_appraisal_state.dart';
class LandPropertyAppraisalBloc
extends Bloc<LandPropertyAppraisalEvent, LandPropertyAppraisalState> {
LandPropertyAppraisalBloc() : super(LandPropertyAppraisalInitial()) {
List<LandAppr> landAppr = [];
on<LoadLandPropertyAppraisal>((event, emit) async {
emit(LandPropertyAppraisalInitial());
try {
emit(LandPropertyAppraisalLoaded(landAppr: landAppr));
} catch (e) {
emit(LandPropertyAppraisalErrorState(e.toString()));
}
});
on<LoadLandPropertyAppraisalEdit>((event, emit) async {
emit(LandPropertyAppraisalInitial());
List<Map<String, dynamic>> result =
await SQLServices.instance.getLandPropertyAppraisal(event.id);
if (result.isNotEmpty) {
landAppr = result.map((map) => LandAppr.fromJson2(map)).toList();
emit(LandPropertyAppraisalLoaded(landAppr: landAppr));
} else {
print('No data found.');
}
});
on<AddLandPropertyAppraisal>((event, emit) async {
try {
print(event);
LandAppr item = await SQLServices.instance.createLandAppraisal(LandAppr(
landapprDetailsId: event.landapprDetailsId,
classification: event.classification,
subClass: event.subClass,
area: event.area,
unitValue: event.unitValue,
baseMarketval: event.baseMarketval));
print('Appraisal');
print(item.toJson());
landAppr.add(item);
emit(LandPropertyAppraisalLoaded(landAppr: landAppr));
} catch (e) {
print(e.toString());
}
});
on<ShowAdditionalItems>((event, emit) async {
emit(ShowAddItemsScreen());
});
// on<FetchAdditionalItems>((event, emit) async {
// addItems = await SQLServices.instance.readAdditionalItems();
// emit(AdditionalItemsLoaded(addItem: addItems));
// });
on<DeleteLandPropertyAppraisal>((event, emit) async {
landAppr.removeWhere(((LandAppr element) => element.id == event.id));
await SQLServices.instance.deleteLandPropertyAppraisal(id: event.id);
emit(const LandPropertyAppraisalDeletedState(success: true));
});
}
}

View File

@ -0,0 +1,86 @@
part of 'land_property_appraisal_bloc.dart';
class LandPropertyAppraisalEvent extends Equatable {
const LandPropertyAppraisalEvent();
@override
List<Object> get props => [];
}
class LoadLandPropertyAppraisal extends LandPropertyAppraisalEvent {
final List<LandAppr> landAppr;
const LoadLandPropertyAppraisal({this.landAppr = const <LandAppr>[]});
@override
List<Object> get props => [landAppr];
}
class LoadLandPropertyAppraisalEdit extends LandPropertyAppraisalEvent {
final List<LandAppr> landAppr;
final int? id;
const LoadLandPropertyAppraisalEdit({required this.landAppr, this.id});
@override
List<Object> get props => [landAppr];
}
class AddLandPropertyAppraisal extends LandPropertyAppraisalEvent {
final int landapprDetailsId;
final String classification;
final String subClass;
final String area;
final String unitValue;
final String baseMarketval;
const AddLandPropertyAppraisal({
required this.landapprDetailsId,
required this.classification,
required this.subClass,
required this.area,
required this.unitValue,
required this.baseMarketval,
});
@override
List<Object> get props => [
landapprDetailsId,
classification,
subClass,
area,
unitValue,
baseMarketval,
];
}
class UpdateLandPropertyAppraisal extends LandPropertyAppraisalEvent {
final LandAppr landAppr;
const UpdateLandPropertyAppraisal({required this.landAppr});
@override
List<Object> get props => [landAppr];
}
class FetchLandPropertyAppraisal extends LandPropertyAppraisalEvent {
const FetchLandPropertyAppraisal();
@override
List<Object> get props => [];
}
class FetchSpecificLandPropertyAppraisal extends LandPropertyAppraisalEvent {
final int id;
const FetchSpecificLandPropertyAppraisal({required this.id});
@override
List<Object> get props => [id];
}
class DeleteLandPropertyAppraisal extends LandPropertyAppraisalEvent {
final int id;
const DeleteLandPropertyAppraisal({required this.id});
@override
List<Object> get props => [id];
}
class ShowAdditionalItems extends LandPropertyAppraisalEvent {}

View File

@ -0,0 +1,46 @@
part of 'land_property_appraisal_bloc.dart';
class LandPropertyAppraisalState extends Equatable {
const LandPropertyAppraisalState();
@override
List<Object> get props => [];
}
class LandPropertyAppraisalInitial extends LandPropertyAppraisalState {
@override
List<Object> get props => [];
}
class LandPropertyAppraisalLoaded extends LandPropertyAppraisalState {
final List<LandAppr> landAppr;
const LandPropertyAppraisalLoaded({required this.landAppr});
@override
List<Object> get props => [landAppr];
}
class LoadSpecificLandPropertyAppraisal extends LandPropertyAppraisalState {
final LandAppr landAppr;
const LoadSpecificLandPropertyAppraisal({required this.landAppr});
@override
List<Object> get props => [landAppr];
}
class ShowAddItemsScreen extends LandPropertyAppraisalState {}
class LandPropertyAppraisalErrorState extends LandPropertyAppraisalState {
const LandPropertyAppraisalErrorState(this.error);
final String error;
@override
List<Object> get props => [error];
}
class LandPropertyAppraisalDeletedState extends LandPropertyAppraisalState {
final bool success;
const LandPropertyAppraisalDeletedState({required this.success});
@override
List<Object> get props => [success];
}

View File

@ -0,0 +1,72 @@
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import '../../../../../model/passo/land_property_assessment.dart';
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
part 'land_property_assessment_event.dart';
part 'land_property_assessment_state.dart';
class LandPropertyAssessmentBloc
extends Bloc<LandPropertyAssessmentEvent, LandPropertyAssessmentState> {
LandPropertyAssessmentBloc() : super(LandPropertyAssessmentInitial()) {
List<LandPropertyAssessment> landPropertyAssessment = [];
on<LoadLandPropertyAssessment>((event, emit) async {
emit(LandPropertyAssessmentInitial());
try {
emit(LandPropertyAssessmentLoaded(
landPropertyAssessment: landPropertyAssessment));
} catch (e) {
emit(LandPropertyAssessmentErrorState(e.toString()));
}
});
on<LoadLandPropertyAssessmentEdit>((event, emit) async {
emit(LandPropertyAssessmentInitial());
List<Map<String, dynamic>> result =
await SQLServices.instance.getLandPropertyAssessment(event.id);
if (result.isNotEmpty) {
landPropertyAssessment =
result.map((map) => LandPropertyAssessment.fromJson2(map)).toList();
emit(LandPropertyAssessmentLoaded(
landPropertyAssessment: landPropertyAssessment));
} else {
print('No data found.');
}
});
on<AddLandPropertyAssessment>((event, emit) async {
try {
LandPropertyAssessment item = await SQLServices.instance
.createLandPropertyAssessment(LandPropertyAssessment(
landapprDetailsId: event.landapprDetailsId,
actualUse: event.actualUse,
marketval: event.marketval,
assessmentLevel: event.assessmentLevel,
assessedValue: event.assessedValue,
totalMarketval: event.totalMarketval,
totalAssessedval: event.totalAssessedval,
));
print(item.toJson());
landPropertyAssessment.add(item);
emit(LandPropertyAssessmentLoaded(
landPropertyAssessment: landPropertyAssessment));
} catch (e) {
print(e.toString());
}
});
on<ShowLandPropertyAssessment>((event, emit) async {
emit(ShowLandPropertyAssessmentcreen());
});
on<DeleteLandPropertyAssessment>((event, emit) async {
landPropertyAssessment.removeWhere(
((LandPropertyAssessment element) => element.id == event.id));
await SQLServices.instance.deleteLandPropertyAssessment(id: event.id);
emit(const LandPropertyAssessmentDeletedState(success: true));
});
}
}

View File

@ -0,0 +1,91 @@
part of 'land_property_assessment_bloc.dart';
class LandPropertyAssessmentEvent extends Equatable {
const LandPropertyAssessmentEvent();
@override
List<Object> get props => [];
}
class LoadLandPropertyAssessment extends LandPropertyAssessmentEvent {
final List<LandPropertyAssessment> landPropertyAssessment;
const LoadLandPropertyAssessment(
{this.landPropertyAssessment = const <LandPropertyAssessment>[]});
@override
List<Object> get props => [landPropertyAssessment];
}
class LoadLandPropertyAssessmentEdit extends LandPropertyAssessmentEvent {
final List<LandPropertyAssessment> landPropertyAssessment;
final int? id;
const LoadLandPropertyAssessmentEdit(
{required this.landPropertyAssessment, this.id});
@override
List<Object> get props => [landPropertyAssessment];
}
class AddLandPropertyAssessment extends LandPropertyAssessmentEvent {
final int landapprDetailsId;
final String actualUse;
final String marketval;
final String assessmentLevel;
final String assessedValue;
final String totalMarketval;
final String totalAssessedval;
const AddLandPropertyAssessment({
required this.landapprDetailsId,
required this.actualUse,
required this.marketval,
required this.assessmentLevel,
required this.assessedValue,
required this.totalMarketval,
required this.totalAssessedval,
});
@override
List<Object> get props => [
landapprDetailsId,
actualUse,
marketval,
assessmentLevel,
assessedValue,
totalMarketval,
totalAssessedval,
];
}
class UpdateLandPropertyAssessment extends LandPropertyAssessmentEvent {
final LandPropertyAssessment landPropertyAssessment;
const UpdateLandPropertyAssessment({required this.landPropertyAssessment});
@override
List<Object> get props => [landPropertyAssessment];
}
class FetchLandPropertyAssessment extends LandPropertyAssessmentEvent {
const FetchLandPropertyAssessment();
@override
List<Object> get props => [];
}
class FetchSpecificLandPropertyAssessment extends LandPropertyAssessmentEvent {
final int id;
const FetchSpecificLandPropertyAssessment({required this.id});
@override
List<Object> get props => [id];
}
class DeleteLandPropertyAssessment extends LandPropertyAssessmentEvent {
final int id;
const DeleteLandPropertyAssessment({required this.id});
@override
List<Object> get props => [id];
}
class ShowLandPropertyAssessment extends LandPropertyAssessmentEvent {}

View File

@ -0,0 +1,47 @@
part of 'land_property_assessment_bloc.dart';
class LandPropertyAssessmentState extends Equatable {
const LandPropertyAssessmentState();
@override
List<Object> get props => [];
}
class LandPropertyAssessmentInitial extends LandPropertyAssessmentState {
@override
List<Object> get props => [];
}
class LandPropertyAssessmentLoaded extends LandPropertyAssessmentState {
final List<LandPropertyAssessment> landPropertyAssessment;
const LandPropertyAssessmentLoaded({required this.landPropertyAssessment});
@override
List<Object> get props => [landPropertyAssessment];
}
class LoadSpecificLandPropertyAssessment extends LandPropertyAssessmentState {
final LandPropertyAssessment landPropertyAssessment;
const LoadSpecificLandPropertyAssessment(
{required this.landPropertyAssessment});
@override
List<Object> get props => [landPropertyAssessment];
}
class ShowLandPropertyAssessmentcreen extends LandPropertyAssessmentState {}
class LandPropertyAssessmentErrorState extends LandPropertyAssessmentState {
const LandPropertyAssessmentErrorState(this.error);
final String error;
@override
List<Object> get props => [error];
}
class LandPropertyAssessmentDeletedState extends LandPropertyAssessmentState {
final bool success;
const LandPropertyAssessmentDeletedState({required this.success});
@override
List<Object> get props => [success];
}

View File

@ -0,0 +1,55 @@
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import '../../../../../model/passo/land_property_boundaries.dart';
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
part 'land_property_boundaries_event.dart';
part 'land_property_boundaries_state.dart';
class LandPropertyBoundariesBloc
extends Bloc<LandPropertyBoundariesEvent, LandPropertyBoundariesState> {
LandPropertyBoundariesBloc() : super(LandPropertyBoundariesInitial()) {
List<LandPropertyBoundaries> todos = [];
on<AddLandPropertyBoundaries>((event, emit) async {
await SQLServices.instance.createLandPropertyBoundaries(
LandPropertyBoundaries(
id: event.id,
landapprDetailsId: event.landapprDetailsId,
assessedById: event.assessedById,
assessedByName: event.assessedByName,
dateCreated: event.dateCreated,
dateModified: event.dateModified,
north: event.north,
east: event.east,
south: event.south,
west: event.west,
sketch: event.sketch));
});
on<FetchSingleLandPropertyBoundaries>((event, emit) async {
List<Map<String, dynamic>> result =
await SQLServices.instance.getLandPropertyBoundaries(event.id);
if (result.isNotEmpty) {
List<LandPropertyBoundaries> landpropertyboundariesList =
result.map((map) => LandPropertyBoundaries.fromJson(map)).toList();
// Choose a specific element from landpropertyboundariesList
LandPropertyBoundaries firstLandPropertyBoundaries =
landpropertyboundariesList
.first; // You can change this to select a specific item
print('landpropertyboundaries test result');
print(firstLandPropertyBoundaries);
emit(SpecificLandPropertyBoundariesLoaded(
landpropertyboundaries: firstLandPropertyBoundaries));
} else {
print('No data found.');
}
});
on<UpdateLandPropertyBoundaries>((event, emit) async {
await SQLServices.instance
.updateLandPropertyBoundaries(event.id, event.landPropertyBoundaries);
});
}
}

View File

@ -0,0 +1,77 @@
part of 'land_property_boundaries_bloc.dart';
class LandPropertyBoundariesEvent extends Equatable {
const LandPropertyBoundariesEvent();
@override
List<Object> get props => [];
}
class AddLandPropertyBoundaries extends LandPropertyBoundariesEvent {
final int id;
final int landapprDetailsId;
final String assessedById;
final String assessedByName;
final String dateCreated;
final String dateModified;
final String north;
final String east;
final String south;
final String west;
final String sketch;
const AddLandPropertyBoundaries({
required this.id,
required this.landapprDetailsId,
required this.assessedById,
required this.assessedByName,
required this.dateCreated,
required this.dateModified,
required this.north,
required this.east,
required this.south,
required this.west,
required this.sketch,
});
@override
List<Object> get props => [
id,
landapprDetailsId,
assessedById,
assessedByName,
dateCreated,
dateModified,
north,
east,
south,
west,
sketch,
];
}
class UpdateLandPropertyBoundaries extends LandPropertyBoundariesEvent {
final LandPropertyBoundaries landPropertyBoundaries;
final int id;
UpdateLandPropertyBoundaries(
{required this.id, required this.landPropertyBoundaries});
@override
List<Object> get props => [id, landPropertyBoundaries];
}
class FetchLanRef extends LandPropertyBoundariesEvent {
const FetchLanRef();
@override
List<Object> get props => [];
}
class FetchSingleLandPropertyBoundaries extends LandPropertyBoundariesEvent {
final int id;
const FetchSingleLandPropertyBoundaries({required this.id});
@override
List<Object> get props => [id];
}

View File

@ -0,0 +1,30 @@
part of 'land_property_boundaries_bloc.dart';
class LandPropertyBoundariesState extends Equatable {
const LandPropertyBoundariesState();
@override
List<Object> get props => [];
}
class LandPropertyBoundariesInitial extends LandPropertyBoundariesState {
@override
List<Object> get props => [];
}
class LandPropertyBoundariesLoaded extends LandPropertyBoundariesState {
final List<LandPropertyBoundaries> landpropertyboundaries;
const LandPropertyBoundariesLoaded({required this.landpropertyboundaries});
@override
List<Object> get props => [landpropertyboundaries];
}
class SpecificLandPropertyBoundariesLoaded extends LandPropertyBoundariesState {
final LandPropertyBoundaries landpropertyboundaries;
const SpecificLandPropertyBoundariesLoaded(
{required this.landpropertyboundaries});
@override
List<Object> get props => [landpropertyboundaries];
}

View File

@ -0,0 +1,58 @@
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import '../../../../../model/passo/land_property_loc.dart';
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
part 'land_property_location_event.dart';
part 'land_property_location_state.dart';
class LandPropertyLocationBloc
extends Bloc<LandPropertyLocationEvent, LandPropertyLocationState> {
LandPropertyLocationBloc() : super(LandPropertyLocationInitial()) {
List<LandPropertyLoc> todos = [];
on<AddLandPropertyLocation>((event, emit) async {
await SQLServices.instance.createLandLocation(LandPropertyLoc(
id: event.id,
landapprDetailsId: event.landapprDetailsId,
assessedById: event.assessedById,
assessedByName: event.assessedByName,
dateCreated: event.dateCreated,
dateModified: event.dateModified,
street: event.street,
municipality: event.municipality,
barangay: event.barangay,
province: event.province,
));
});
on<LoadLandPropertyLocation>((event, emit) async {
// todos = await SQLServices.instance.getLandPropertyOwner();
// emit(LandPropertyOwnerLoaded(landPropertyOwner: todos));
});
on<FetchSingleLandPropertyLocation>((event, emit) async {
List<Map<String, dynamic>> result =
await SQLServices.instance.getLandPropertyLocation(event.id);
if (result.isNotEmpty) {
List<LandPropertyLoc> landpropertylocationList =
result.map((map) => LandPropertyLoc.fromJson2(map)).toList();
// Choose a specific element from landpropertylocationList
LandPropertyLoc firstLandPropertyLocation = landpropertylocationList
.first; // You can change this to select a specific item
print('landpropertylocation test result');
print(firstLandPropertyLocation);
emit(SpecificLandPropertyLocationLoaded(
landpropertylocation: firstLandPropertyLocation));
} else {
print('No data found.');
}
});
on<UpdateLandPropertyLocation>((event, emit) async {
await SQLServices.instance
.updateLandPropertyLocation(event.id, event.landPropertyLocation);
});
}
}

View File

@ -0,0 +1,81 @@
part of 'land_property_location_bloc.dart';
class LandPropertyLocationEvent extends Equatable {
const LandPropertyLocationEvent();
@override
List<Object> get props => [];
}
class AddLandPropertyLocation extends LandPropertyLocationEvent {
final int id;
final int landapprDetailsId;
final String assessedById;
final String assessedByName;
final String dateCreated;
final String dateModified;
final String street;
final String municipality;
final String barangay;
final String province;
const AddLandPropertyLocation({
required this.id,
required this.landapprDetailsId,
required this.assessedById,
required this.assessedByName,
required this.dateCreated,
required this.dateModified,
required this.street,
required this.municipality,
required this.barangay,
required this.province,
});
@override
List<Object> get props => [
id,
landapprDetailsId,
assessedById,
assessedByName,
dateCreated,
dateModified,
street,
municipality,
barangay,
province,
];
}
class UpdateLandPropertyLocation extends LandPropertyLocationEvent {
final LandPropertyLoc landPropertyLocation;
final int id;
UpdateLandPropertyLocation(
{required this.id, required this.landPropertyLocation});
@override
List<Object> get props => [id, landPropertyLocation];
}
class LoadLandPropertyLocation extends LandPropertyLocationEvent {
const LoadLandPropertyLocation();
@override
List<Object> get props => [];
}
class FetchLanRef extends LandPropertyLocationEvent {
const FetchLanRef();
@override
List<Object> get props => [];
}
class FetchSingleLandPropertyLocation extends LandPropertyLocationEvent {
final int id;
const FetchSingleLandPropertyLocation({required this.id});
@override
List<Object> get props => [id];
}

View File

@ -0,0 +1,30 @@
part of 'land_property_location_bloc.dart';
class LandPropertyLocationState extends Equatable {
const LandPropertyLocationState();
@override
List<Object> get props => [];
}
class LandPropertyLocationInitial extends LandPropertyLocationState {
@override
List<Object> get props => [];
}
class LandPropertyLocationLoaded extends LandPropertyLocationState {
final List<LandPropertyLoc> landpropertylocation;
const LandPropertyLocationLoaded({required this.landpropertylocation});
@override
List<Object> get props => [landpropertylocation];
}
class SpecificLandPropertyLocationLoaded extends LandPropertyLocationState {
final LandPropertyLoc landpropertylocation;
const SpecificLandPropertyLocationLoaded(
{required this.landpropertylocation});
@override
List<Object> get props => [landpropertylocation];
}

View File

@ -0,0 +1,71 @@
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import '../../../../../model/passo/land_property_owner.dart';
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
part 'land_property_owner_event.dart';
part 'land_property_owner_state.dart';
class LandPropertyOwnerBloc
extends Bloc<LandPropertyOwnerEvent, LandPropertyOwnerState> {
LandPropertyOwnerBloc() : super(LandPropertyOwnerInitial()) {
List<LandPropertyOwner> todos = [];
on<AddLandPropertyOwner>((event, emit) async {
try {
await SQLServices.instance.createLandOwner(
LandPropertyOwner(
id: event.id,
assessedById: event.assessedById,
assessedByName: event.assessedByName,
dateCreated: event.dateCreated,
dateModified: event.dateModified,
transCode: event.transCode,
tdn: event.tdn,
pin: event.pin,
cloaNo: event.cloaNo,
dated: event.dated,
surveyNo: event.surveyNo,
lotNo: event.lotNo,
blkNo: event.blkNo,
owner: event.owner,
address: event.address,
telno: event.telno,
tin: event.tin,
adminUser: event.adminUser,
adminTelno: event.adminTelno,
adminAddress: event.adminAddress,
adminTin: event.adminTin,
faasType: event.faasType),
);
} catch (e) {
emit(LandPropertyOwnerInfoErrorState(errorMessage: 'error'));
print('Error: $e');
// You might want to throw or log the error, or take other appropriate actions
// If you want to rethrow the error, uncomment the following line
// throw e;
}
});
on<UpdateLandPropertyOwnerInfo>((event, emit) async {
await SQLServices.instance
.updateLandPropertyOwner(event.id, event.landPropertyOwner);
});
on<LoadLandPropertyOwner>((event, emit) async {
todos = await SQLServices.instance.getLandPropertyOwner();
emit(LandPropertyOwnerLoaded(landPropertyOwner: todos));
});
// on<FetchSpecificTodo>((event, emit) async {
// Prop todo = await PropertyOwnerInfoServices.instance.readTodo(id: event.id);
// emit(DisplaySpecificTodo(todo: todo));
// });
on<DeleteLandPropertyOwner>((event, emit) async {
await SQLServices.instance.deleteLandPropertyOwner(id: event.id);
add(const LoadLandPropertyOwner());
});
}
}

View File

@ -0,0 +1,116 @@
part of 'land_property_owner_bloc.dart';
class LandPropertyOwnerEvent extends Equatable {
const LandPropertyOwnerEvent();
@override
List<Object> get props => [];
}
class AddLandPropertyOwner extends LandPropertyOwnerEvent {
final int id;
final String assessedById;
final String assessedByName;
final String dateCreated;
final String dateModified;
final String transCode;
final String tdn;
final String pin;
final String cloaNo;
final String dated;
final String surveyNo;
final String lotNo;
final String blkNo;
final String owner;
final String address;
final String telno;
final String tin;
final String adminUser;
final String adminAddress;
final String adminTelno;
final String adminTin;
final String faasType;
const AddLandPropertyOwner(
{required this.id,
required this.assessedById,
required this.assessedByName,
required this.dateCreated,
required this.dateModified,
required this.transCode,
required this.tdn,
required this.pin,
required this.cloaNo,
required this.dated,
required this.surveyNo,
required this.lotNo,
required this.blkNo,
required this.owner,
required this.address,
required this.telno,
required this.tin,
required this.adminUser,
required this.adminTelno,
required this.adminAddress,
required this.adminTin,
required this.faasType});
@override
List<Object> get props => [
id,
assessedById,
assessedByName,
dateCreated,
dateModified,
transCode,
tdn,
pin,
cloaNo,
dated,
surveyNo,
lotNo,
blkNo,
owner,
address,
telno,
tin,
adminUser,
adminTelno,
adminAddress,
adminTin,
faasType
];
}
class UpdateLandPropertyOwnerInfo extends LandPropertyOwnerEvent {
final LandPropertyOwner landPropertyOwner;
final int id;
const UpdateLandPropertyOwnerInfo(
{required this.id, required this.landPropertyOwner});
@override
List<Object> get props => [id, landPropertyOwner];
}
class LoadLandPropertyOwner extends LandPropertyOwnerEvent {
const LoadLandPropertyOwner();
@override
List<Object> get props => [];
}
class LoadSpecificLandPropertyOwnerInfo extends LandPropertyOwnerEvent {
final int id;
const LoadSpecificLandPropertyOwnerInfo({required this.id});
@override
List<Object> get props => [id];
}
class DeleteLandPropertyOwner extends LandPropertyOwnerEvent {
final int id;
const DeleteLandPropertyOwner({required this.id});
@override
List<Object> get props => [id];
}

View File

@ -0,0 +1,39 @@
part of 'land_property_owner_bloc.dart';
class LandPropertyOwnerState extends Equatable {
@override
List<Object> get props => [];
}
class LandPropertyOwnerInitial extends LandPropertyOwnerState {
@override
List<Object> get props => [];
}
class LandPropertyOwnerInfoLoading extends LandPropertyOwnerState {
@override
List<Object> get props => [];
}
class LandPropertyOwnerInfoErrorState extends LandPropertyOwnerState {
String errorMessage;
LandPropertyOwnerInfoErrorState({required this.errorMessage});
@override
List<Object> get props => [errorMessage];
}
class LandPropertyOwnerLoaded extends LandPropertyOwnerState {
List<LandPropertyOwner> landPropertyOwner;
LandPropertyOwnerLoaded({required this.landPropertyOwner});
@override
List<Object> get props => [landPropertyOwner];
}
class LoadSpecificLandPropertyOwner extends LandPropertyOwnerState {
LandPropertyOwner landPropertyOwner;
LoadSpecificLandPropertyOwner({required this.landPropertyOwner});
@override
List<Object> get props => [landPropertyOwner];
}

View File

@ -0,0 +1,88 @@
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:unit2/model/passo/land_ext.dart';
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
part 'land_property_signature_event.dart';
part 'land_property_signature_state.dart';
class LandPropertySignatureBloc
extends Bloc<LandPropertySignatureEvent, LandPropertySignatureState> {
LandPropertySignatureBloc() : super(LandPropertySignatureInitial()) {
List<LandExt> landExt = [];
on<AddLandPropertySignature>((event, emit) async {
try {
print(event.landapprDetailsId);
await SQLServices.instance.createLandPropertySignatories(
LandExt(
id: event.id,
landapprDetailsId: event.landapprDetailsId,
assessedById: event.assessedById,
assessedByName: event.assessedByName,
dateCreated: event.dateCreated,
dateModified: event.dateModified,
taxable: event.taxable,
exempt: event.exempt,
qtr: event.qtr,
yr: event.yr,
appraisedbyName: event.appraisedbyName,
appraisedbyDate: event.appraisedbyDate,
recommendapprName: event.recommendapprName,
recommendapprDate: event.recommendapprDate,
approvedbyName: event.approvedbyName,
approvedbyDate: event.approvedbyDate,
memoranda: event.memoranda,
swornstatementNo: event.swornstatementNo,
dateReceived: event.dateReceived,
entryDateAssessment: event.entryDateAssessment,
entryDateBy: event.entryDateBy,
),
);
} catch (e) {
emit(LandPropertySignatureInfoErrorState(errorMessage: 'error'));
print('Error: $e');
// You might want to throw or log the error, or take other appropriate actions
// If you want to rethrow the error, uncomment the following line
// throw e;
}
});
on<UpdateLandPropertySignatureInfo>((event, emit) async {
await SQLServices.instance
.updateLandPropertySignature(event.id, event.landPropertySignature);
});
// on<LoadLandPropertySignature>((event, emit) async {
// todos = await SQLServices.instance.getLandPropertySignature();
// emit(LandPropertySignatureLoaded(landPropertySignature: todos));
// });
on<LoadSpecificLandPropertySignatureInfo>((event, emit) async {
List<Map<String, dynamic>> result =
await SQLServices.instance.getLandPropertySignature(event.id);
if (result.isNotEmpty) {
List<LandExt> genDescList =
result.map((map) => LandExt.fromJson2(map)).toList();
// Choose a specific element from locationList
LandExt firstLandExt =
genDescList.first; // You can change this to select a specific item
print('location test result');
print(firstLandExt);
emit(LoadSpecificLandPropertySignature(
landPropertySignature: firstLandExt));
} else {
print('No data found.');
}
});
// on<DeleteLandPropertySignature>((event, emit) async {
// await SQLServices.instance.de(id: event.id);
// add(const LoadLandPropertySignature());
// });
}
}

View File

@ -0,0 +1,114 @@
part of 'land_property_signature_bloc.dart';
class LandPropertySignatureEvent extends Equatable {
const LandPropertySignatureEvent();
@override
List<Object> get props => [];
}
class AddLandPropertySignature extends LandPropertySignatureEvent {
final int id;
final int landapprDetailsId;
final String assessedById;
final String assessedByName;
final String dateCreated;
final String dateModified;
final String taxable;
final String exempt;
final String qtr;
final String yr;
final String appraisedbyName;
final String appraisedbyDate;
final String recommendapprName;
final String recommendapprDate;
final String approvedbyName;
final String approvedbyDate;
final String memoranda;
final String swornstatementNo;
final String dateReceived;
final String entryDateAssessment;
final String entryDateBy;
const AddLandPropertySignature({
required this.id,
required this.landapprDetailsId,
required this.assessedById,
required this.assessedByName,
required this.dateCreated,
required this.dateModified,
required this.taxable,
required this.exempt,
required this.qtr,
required this.yr,
required this.appraisedbyName,
required this.appraisedbyDate,
required this.recommendapprName,
required this.recommendapprDate,
required this.approvedbyName,
required this.approvedbyDate,
required this.memoranda,
required this.swornstatementNo,
required this.dateReceived,
required this.entryDateAssessment,
required this.entryDateBy,
});
@override
List<Object> get props => [
id,
landapprDetailsId,
assessedById,
assessedByName,
dateCreated,
dateModified,
taxable,
exempt,
qtr,
yr,
appraisedbyName,
appraisedbyDate,
recommendapprName,
recommendapprDate,
approvedbyName,
approvedbyDate,
memoranda,
swornstatementNo,
dateReceived,
entryDateAssessment,
entryDateBy,
];
}
class UpdateLandPropertySignatureInfo extends LandPropertySignatureEvent {
final LandExt landPropertySignature;
final int id;
const UpdateLandPropertySignatureInfo(
{required this.id, required this.landPropertySignature});
@override
List<Object> get props => [id, landPropertySignature];
}
class LoadLandPropertySignature extends LandPropertySignatureEvent {
const LoadLandPropertySignature();
@override
List<Object> get props => [];
}
class LoadSpecificLandPropertySignatureInfo extends LandPropertySignatureEvent {
final int id;
const LoadSpecificLandPropertySignatureInfo({required this.id});
@override
List<Object> get props => [id];
}
class DeleteLandPropertySignature extends LandPropertySignatureEvent {
final int id;
const DeleteLandPropertySignature({required this.id});
@override
List<Object> get props => [id];
}

View File

@ -0,0 +1,41 @@
part of 'land_property_signature_bloc.dart';
class LandPropertySignatureState extends Equatable {
const LandPropertySignatureState();
@override
List<Object> get props => [];
}
class LandPropertySignatureInitial extends LandPropertySignatureState {
@override
List<Object> get props => [];
}
class LandPropertySignatureInfoLoading extends LandPropertySignatureState {
@override
List<Object> get props => [];
}
class LandPropertySignatureInfoErrorState extends LandPropertySignatureState {
String errorMessage;
LandPropertySignatureInfoErrorState({required this.errorMessage});
@override
List<Object> get props => [errorMessage];
}
class LandPropertySignatureLoaded extends LandPropertySignatureState {
List<LandExt> landPropertySignature;
LandPropertySignatureLoaded({required this.landPropertySignature});
@override
List<Object> get props => [landPropertySignature];
}
class LoadSpecificLandPropertySignature extends LandPropertySignatureState {
LandExt landPropertySignature;
LoadSpecificLandPropertySignature({required this.landPropertySignature});
@override
List<Object> get props => [landPropertySignature];
}

View File

@ -0,0 +1,75 @@
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:unit2/bloc/passo/land/other_improvements/other_improvements_bloc.dart';
import '../../../../../model/passo/other_improvements.dart';
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
part 'other_improvements_event.dart';
part 'other_improvements_state.dart';
class OtherImprovementsBloc
extends Bloc<OtherImprovementsEvent, OtherImprovementsState> {
OtherImprovementsBloc() : super(OtherImprovementsInitial()) {
List<OtherImprovements> otherImprovements = [];
on<LoadOtherImprovements>((event, emit) async {
emit(OtherImprovementsInitial());
try {
emit(OtherImprovementsLoaded(otherImprovements: otherImprovements));
} catch (e) {
emit(OtherImprovementsErrorState(e.toString()));
}
});
on<LoadOtherImprovementsEdit>((event, emit) async {
emit(OtherImprovementsInitial());
List<Map<String, dynamic>> result =
await SQLServices.instance.getOtherImprovements(event.id);
if (result.isNotEmpty) {
otherImprovements =
result.map((map) => OtherImprovements.fromJson2(map)).toList();
emit(OtherImprovementsLoaded(otherImprovements: otherImprovements));
} else {
print('No data found.');
}
});
on<AddOtherImprovements>((event, emit) async {
try {
OtherImprovements item = await SQLServices.instance
.createOtherImprovements(OtherImprovements(
landapprDetailsId: event.landapprDetailsId,
kindsOfTrees: event.kindsOfTrees,
subclassAge: event.subclassAge,
quantity: event.quantity,
unitValue: event.unitValue,
baseMarketval: event.baseMarketval,
noOfProductive: event.noOfProductive,
noOfNonproductive: event.noOfNonproductive,
fruitBearing: event.fruitBearing));
print(item.toJson());
otherImprovements.add(item);
emit(OtherImprovementsLoaded(otherImprovements: otherImprovements));
} catch (e) {
print(e.toString());
}
});
on<ShowOtherImprovement>((event, emit) async {
emit(ShowOtherImprovementScreen());
});
// on<FetchAdditionalItems>((event, emit) async {
// addItems = await SQLServices.instance.readAdditionalItems();
// emit(AdditionalItemsLoaded(addItem: addItems));
// });
on<DeleteOtherImprovements>((event, emit) async {
otherImprovements
.removeWhere(((OtherImprovements element) => element.id == event.id));
await SQLServices.instance.deleteOtherImprovements(id: event.id);
emit(const OtherImprovementsDeletedState(success: true));
});
}
}

View File

@ -0,0 +1,96 @@
part of 'other_improvements_bloc.dart';
class OtherImprovementsEvent extends Equatable {
const OtherImprovementsEvent();
@override
List<Object> get props => [];
}
class LoadOtherImprovements extends OtherImprovementsEvent {
final List<OtherImprovements> otherImprovements;
const LoadOtherImprovements(
{this.otherImprovements = const <OtherImprovements>[]});
@override
List<Object> get props => [otherImprovements];
}
class LoadOtherImprovementsEdit extends OtherImprovementsEvent {
final List<OtherImprovements> otherImprovements;
final int? id;
const LoadOtherImprovementsEdit({required this.otherImprovements, this.id});
@override
List<Object> get props => [otherImprovements];
}
class AddOtherImprovements extends OtherImprovementsEvent {
final int landapprDetailsId;
final String kindsOfTrees;
final String subclassAge;
final int quantity;
final String unitValue;
final String baseMarketval;
final int noOfProductive;
final int noOfNonproductive;
final String fruitBearing;
const AddOtherImprovements({
required this.landapprDetailsId,
required this.kindsOfTrees,
required this.subclassAge,
required this.quantity,
required this.unitValue,
required this.baseMarketval,
required this.noOfProductive,
required this.noOfNonproductive,
required this.fruitBearing,
});
@override
List<Object> get props => [
landapprDetailsId,
kindsOfTrees,
subclassAge,
quantity,
unitValue,
baseMarketval,
noOfProductive,
noOfNonproductive,
fruitBearing,
];
}
class UpdateOtherImprovements extends OtherImprovementsEvent {
final OtherImprovements otherImprovements;
const UpdateOtherImprovements({required this.otherImprovements});
@override
List<Object> get props => [otherImprovements];
}
class FetchOtherImprovements extends OtherImprovementsEvent {
const FetchOtherImprovements();
@override
List<Object> get props => [];
}
class FetchSpecificOtherImprovements extends OtherImprovementsEvent {
final int id;
const FetchSpecificOtherImprovements({required this.id});
@override
List<Object> get props => [id];
}
class DeleteOtherImprovements extends OtherImprovementsEvent {
final int id;
const DeleteOtherImprovements({required this.id});
@override
List<Object> get props => [id];
}
class ShowOtherImprovement extends OtherImprovementsEvent {}

View File

@ -0,0 +1,46 @@
part of 'other_improvements_bloc.dart';
class OtherImprovementsState extends Equatable {
const OtherImprovementsState();
@override
List<Object> get props => [];
}
class OtherImprovementsInitial extends OtherImprovementsState {
@override
List<Object> get props => [];
}
class OtherImprovementsLoaded extends OtherImprovementsState {
final List<OtherImprovements> otherImprovements;
const OtherImprovementsLoaded({required this.otherImprovements});
@override
List<Object> get props => [otherImprovements];
}
class LoadSpecificOtherImprovements extends OtherImprovementsState {
final OtherImprovements otherImprovements;
const LoadSpecificOtherImprovements({required this.otherImprovements});
@override
List<Object> get props => [otherImprovements];
}
class ShowOtherImprovementScreen extends OtherImprovementsState {}
class OtherImprovementsErrorState extends OtherImprovementsState {
const OtherImprovementsErrorState(this.error);
final String error;
@override
List<Object> get props => [error];
}
class OtherImprovementsDeletedState extends OtherImprovementsState {
final bool success;
const OtherImprovementsDeletedState({required this.success});
@override
List<Object> get props => [success];
}

View File

@ -0,0 +1,69 @@
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:unit2/bloc/passo/land/land_value_adjustments/land_value_adjustments_bloc.dart';
import 'package:unit2/model/passo/land_value_adjustment.dart';
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
part 'value_adjustment_event.dart';
part 'value_adjustment_state.dart';
class ValueAdjustmentBloc
extends Bloc<ValueAdjustmentEvent, ValueAdjustmentState> {
ValueAdjustmentBloc() : super(ValueAdjustmentInitial()) {
List<ValueAdjustments> valueAdjustment = [];
on<LoadValueAdjustment>((event, emit) async {
emit(ValueAdjustmentInitial());
try {
emit(ValueAdjustmentLoaded(valueAdjustment: valueAdjustment));
} catch (e) {
emit(ValueAdjustmentErrorState(e.toString()));
}
});
on<LoadValueAdjustmentEdit>((event, emit) async {
emit(ValueAdjustmentInitial());
List<Map<String, dynamic>> result =
await SQLServices.instance.getValueAdjustments(event.id);
if (result.isNotEmpty) {
valueAdjustment =
result.map((map) => ValueAdjustments.fromJson2(map)).toList();
emit(ValueAdjustmentLoaded(valueAdjustment: valueAdjustment));
} else {
print('No data found.');
}
});
on<AddValueAdjustments>((event, emit) async {
try {
ValueAdjustments item =
await SQLServices.instance.createValueAdjustments(ValueAdjustments(
landapprDetailsId: event.landapprDetailsId,
baseMarketval: event.baseMarketval,
adjustmentFactors: event.adjustmentFactors,
adjustment: event.adjustment,
valueAdjustment: event.valueAdjustment,
marketValue: event.marketValue,
));
print(item.toJson());
valueAdjustment.add(item);
emit(ValueAdjustmentLoaded(valueAdjustment: valueAdjustment));
} catch (e) {
print(e.toString());
}
});
on<ShowValueAdjustment>((event, emit) async {
emit(ShowValueAdjustmentcreen());
});
on<DeleteValueAdjustment>((event, emit) async {
valueAdjustment
.removeWhere(((ValueAdjustments element) => element.id == event.id));
await SQLServices.instance.deleteValueAdjustment(id: event.id);
emit(const ValueAdjustmentDeletedState(success: true));
});
}
}

View File

@ -0,0 +1,88 @@
part of 'value_adjustment_bloc.dart';
class ValueAdjustmentEvent extends Equatable {
const ValueAdjustmentEvent();
@override
List<Object> get props => [];
}
class LoadValueAdjustment extends ValueAdjustmentEvent {
final List<ValueAdjustments> valueAdjustment;
const LoadValueAdjustment(
{this.valueAdjustment = const <ValueAdjustments>[]});
@override
List<Object> get props => [valueAdjustment];
}
class LoadValueAdjustmentEdit extends ValueAdjustmentEvent {
final List<ValueAdjustments> valueAdjustment;
final int? id;
const LoadValueAdjustmentEdit(
{required this.valueAdjustment, required this.id});
@override
List<Object> get props => [valueAdjustment];
}
class AddValueAdjustments extends ValueAdjustmentEvent {
final int landapprDetailsId;
final String baseMarketval;
final String adjustmentFactors;
final String adjustment;
final String valueAdjustment;
final String marketValue;
const AddValueAdjustments({
required this.landapprDetailsId,
required this.baseMarketval,
required this.adjustmentFactors,
required this.adjustment,
required this.valueAdjustment,
required this.marketValue,
});
@override
List<Object> get props => [
landapprDetailsId,
baseMarketval,
adjustmentFactors,
adjustment,
valueAdjustment,
marketValue,
];
}
class UpdateValueAdjustment extends ValueAdjustmentEvent {
final ValueAdjustments valueAdjustment;
const UpdateValueAdjustment({required this.valueAdjustment});
@override
List<Object> get props => [valueAdjustment];
}
class FetchValueAdjustment extends ValueAdjustmentEvent {
const FetchValueAdjustment();
@override
List<Object> get props => [];
}
class FetchSpecificValueAdjustment extends ValueAdjustmentEvent {
final int id;
const FetchSpecificValueAdjustment({required this.id});
@override
List<Object> get props => [id];
}
class DeleteValueAdjustment extends ValueAdjustmentEvent {
final int id;
const DeleteValueAdjustment({required this.id});
@override
List<Object> get props => [id];
}
class ShowValueAdjustment extends ValueAdjustmentEvent {}

View File

@ -0,0 +1,46 @@
part of 'value_adjustment_bloc.dart';
class ValueAdjustmentState extends Equatable {
const ValueAdjustmentState();
@override
List<Object> get props => [];
}
class ValueAdjustmentInitial extends ValueAdjustmentState {
@override
List<Object> get props => [];
}
class ValueAdjustmentLoaded extends ValueAdjustmentState {
final List<ValueAdjustments> valueAdjustment;
const ValueAdjustmentLoaded({required this.valueAdjustment});
@override
List<Object> get props => [valueAdjustment];
}
class LoadSpecificValueAdjustment extends ValueAdjustmentState {
final ValueAdjustments valueAdjustment;
const LoadSpecificValueAdjustment({required this.valueAdjustment});
@override
List<Object> get props => [valueAdjustment];
}
class ShowValueAdjustmentcreen extends ValueAdjustmentState {}
class ValueAdjustmentErrorState extends ValueAdjustmentState {
const ValueAdjustmentErrorState(this.error);
final String error;
@override
List<Object> get props => [error];
}
class ValueAdjustmentDeletedState extends ValueAdjustmentState {
final bool success;
const ValueAdjustmentDeletedState({required this.success});
@override
List<Object> get props => [success];
}

View File

@ -0,0 +1,131 @@
// To parse this JSON data, do
//
// final bldgAndStructure = bldgAndStructureFromJson(jsonString);
import 'dart:convert';
BldgAndStructure bldgAndStructureFromJson(String str) =>
BldgAndStructure.fromJson(json.decode(str));
String bldgAndStructureToJson(BldgAndStructure data) =>
json.encode(data.toJson());
class BldgAndStructure {
final int? id;
final int? bldgapprDetailsId;
final String? assessedById;
final String? assessedByName;
final String? dateCreated;
final String? dateModified;
final String? bldgType;
final String? strucType;
final String? description;
final String? actualUse;
final String? floorCount;
final String? bldgArea;
final String? unitValue;
final String? depRate;
final String? marketValue;
final String? depAmount;
final String? adjustedMarketValue;
BldgAndStructure({
this.id,
this.bldgapprDetailsId,
this.assessedById,
this.assessedByName,
this.dateCreated,
this.dateModified,
this.bldgType,
this.strucType,
this.description,
this.actualUse,
this.floorCount,
this.bldgArea,
this.unitValue,
this.depRate,
this.marketValue,
this.depAmount,
this.adjustedMarketValue,
});
BldgAndStructure copy({
int? id,
int? bldgapprDetailsId,
String? assessedById,
String? assessedByName,
String? dateCreated,
String? dateModified,
String? bldgType,
String? strucType,
String? description,
String? actualUse,
String? floorCount,
String? bldgArea,
String? unitValue,
String? depRate,
String? marketValue,
String? depAmount,
String? adjustedMarketValue,
}) =>
BldgAndStructure(
id: id ?? this.id,
bldgapprDetailsId: bldgapprDetailsId ?? this.bldgapprDetailsId,
assessedById: assessedById ?? this.assessedById,
assessedByName: assessedByName ?? this.assessedByName,
dateCreated: dateCreated ?? this.dateCreated,
dateModified: dateModified ?? this.dateModified,
bldgType: bldgType ?? this.bldgType,
strucType: strucType ?? this.strucType,
description: description ?? this.description,
actualUse: actualUse ?? this.actualUse,
floorCount: floorCount ?? this.floorCount,
bldgArea: bldgArea ?? this.bldgArea,
unitValue: unitValue ?? this.unitValue,
depRate: depRate ?? this.depRate,
marketValue: marketValue ?? this.marketValue,
depAmount: depAmount ?? this.depAmount,
adjustedMarketValue: adjustedMarketValue ?? this.adjustedMarketValue,
);
factory BldgAndStructure.fromJson(Map<String, dynamic> json) =>
BldgAndStructure(
id: json["id"],
bldgapprDetailsId: json["bldgapprDetailsId"],
assessedById: json["assessedById"],
assessedByName: json["assessedByName"],
dateCreated: json["dateCreated"],
dateModified: json["dateModified"],
bldgType: json["bldgType"],
strucType: json["strucType"],
description: json["description"],
actualUse: json["actualUse"],
floorCount: json["floorCount"],
bldgArea: json["bldgArea"],
unitValue: json["unitValue"],
depRate: json["depRate"],
marketValue: json["marketValue"],
depAmount: json["depAmount"],
adjustedMarketValue: json["adjustedMarketValue"],
);
Map<String, dynamic> toJson() => {
"id": id,
"bldgapprDetailsId": bldgapprDetailsId,
"assessedById": assessedById,
"assessedByName": assessedByName,
"dateCreated": dateCreated,
"dateModified": dateModified,
"bldgType": bldgType,
"strucType": strucType,
"description": description,
"actualUse": actualUse,
"floorCount": floorCount,
"bldgArea": bldgArea,
"unitValue": unitValue,
"depRate": depRate,
"marketValue": marketValue,
"depAmount": depAmount,
"adjustedMarketValue": adjustedMarketValue,
};
}

View File

@ -34,60 +34,61 @@ class GeneralDesc {
final String? totalFloorArea;
final dynamic floorSketch;
final String? actualUse;
final String? unitValue;
GeneralDesc({
this.id,
this.bldgapprDetailsId,
this.assessedById,
this.assessedByName,
this.dateCreated,
this.dateModified,
this.bldgKind,
this.strucType,
this.bldgPermit,
this.dateIssued,
this.cct,
this.certCompletionIssued,
this.certOccupancyIssued,
this.dateCompleted,
this.dateOccupied,
this.bldgAge,
this.noStoreys,
this.area1Stfloor,
this.area2Ndfloor,
this.area3Rdfloor,
this.area4Thfloor,
this.totalFloorArea,
this.floorSketch,
this.actualUse,
});
GeneralDesc(
{this.id,
this.bldgapprDetailsId,
this.assessedById,
this.assessedByName,
this.dateCreated,
this.dateModified,
this.bldgKind,
this.strucType,
this.bldgPermit,
this.dateIssued,
this.cct,
this.certCompletionIssued,
this.certOccupancyIssued,
this.dateCompleted,
this.dateOccupied,
this.bldgAge,
this.noStoreys,
this.area1Stfloor,
this.area2Ndfloor,
this.area3Rdfloor,
this.area4Thfloor,
this.totalFloorArea,
this.floorSketch,
this.actualUse,
this.unitValue});
GeneralDesc copy({
int? id,
int? bldgapprDetailsId,
String? assessedById,
String? assessedByName,
String? dateCreated,
String? dateModified,
String? bldgKind,
String? strucType,
String? bldgPermit,
String? dateIssued,
String? cct,
String? certCompletionIssued,
String? certOccupancyIssued,
String? dateCompleted,
String? dateOccupied,
String? bldgAge,
String? noStoreys,
String? area1Stfloor,
String? area2Ndfloor,
String? area3Rdfloor,
String? area4Thfloor,
String? totalFloorArea,
dynamic floorSketch,
String? actualUse,
}) {
GeneralDesc copy(
{int? id,
int? bldgapprDetailsId,
String? assessedById,
String? assessedByName,
String? dateCreated,
String? dateModified,
String? bldgKind,
String? strucType,
String? bldgPermit,
String? dateIssued,
String? cct,
String? certCompletionIssued,
String? certOccupancyIssued,
String? dateCompleted,
String? dateOccupied,
String? bldgAge,
String? noStoreys,
String? area1Stfloor,
String? area2Ndfloor,
String? area3Rdfloor,
String? area4Thfloor,
String? totalFloorArea,
dynamic floorSketch,
String? actualUse,
String? unitValue}) {
return GeneralDesc(
id: id ?? this.id,
bldgapprDetailsId: bldgapprDetailsId ?? this.bldgapprDetailsId,
@ -112,62 +113,63 @@ class GeneralDesc {
area4Thfloor: area4Thfloor ?? this.area4Thfloor,
totalFloorArea: totalFloorArea ?? this.totalFloorArea,
floorSketch: floorSketch ?? this.floorSketch,
actualUse: actualUse ?? this.actualUse);
actualUse: actualUse ?? this.actualUse,
unitValue: unitValue ?? this.unitValue);
}
factory GeneralDesc.fromJson(Map<String, dynamic> json) => GeneralDesc(
id: json["id"],
bldgapprDetailsId: json["bldgappr_details_id"],
assessedById: json["assessed_by_id"],
assessedByName: json["assessed_by_name"],
dateCreated: json["date_created"],
dateModified: json["date_modified"],
bldgKind: json["bldg_kind"],
strucType: json["struc_type"],
bldgPermit: json["bldg_permit"],
dateIssued: json["date_issued"],
cct: json["cct"],
certCompletionIssued: json["cert_completion_issued"],
certOccupancyIssued: json["cert_occupancy_issued"],
dateCompleted: json["date_completed"],
dateOccupied: json["date_occupied"],
bldgAge: json["bldg_age"],
noStoreys: json["no_storeys"],
area1Stfloor: json["area_1stfloor"],
area2Ndfloor: json["area_2ndfloor"],
area3Rdfloor: json["area_3rdfloor"],
area4Thfloor: json["area_4thfloor"],
totalFloorArea: json["total_floor_area"],
floorSketch: json["floor_sketch"],
actualUse: json["actual_use"],
);
id: json["id"],
bldgapprDetailsId: json["bldgappr_details_id"],
assessedById: json["assessed_by_id"],
assessedByName: json["assessed_by_name"],
dateCreated: json["date_created"],
dateModified: json["date_modified"],
bldgKind: json["bldg_kind"],
strucType: json["struc_type"],
bldgPermit: json["bldg_permit"],
dateIssued: json["date_issued"],
cct: json["cct"],
certCompletionIssued: json["cert_completion_issued"],
certOccupancyIssued: json["cert_occupancy_issued"],
dateCompleted: json["date_completed"],
dateOccupied: json["date_occupied"],
bldgAge: json["bldg_age"],
noStoreys: json["no_storeys"],
area1Stfloor: json["area_1stfloor"],
area2Ndfloor: json["area_2ndfloor"],
area3Rdfloor: json["area_3rdfloor"],
area4Thfloor: json["area_4thfloor"],
totalFloorArea: json["total_floor_area"],
floorSketch: json["floor_sketch"],
actualUse: json["actual_use"],
unitValue: json["unit_value"]);
factory GeneralDesc.fromJson2(Map<String, dynamic> json) => GeneralDesc(
id: json["id"],
bldgapprDetailsId: json["bldgapprDetailsId"],
assessedById: json["assessedById"],
assessedByName: json["assessedByName"],
dateCreated: json["dateCreated"],
dateModified: json["dateModified"],
bldgKind: json["bldgKind"],
strucType: json["strucType"],
bldgPermit: json["bldgPermit"],
dateIssued: json["dateIssued"],
cct: json["cct"],
certCompletionIssued: json["certCompletionIssued"],
certOccupancyIssued: json["certOccupancyIssued"],
dateCompleted: json["dateCompleted"],
dateOccupied: json["dateOccupied"],
bldgAge: json["bldgAge"],
noStoreys: json["noStoreys"],
area1Stfloor: json["area1Stfloor"],
area2Ndfloor: json["area2Ndfloor"],
area3Rdfloor: json["area3Rdfloor"],
area4Thfloor: json["area4Thfloor"],
totalFloorArea: json["totalFloorArea"],
floorSketch: json["floorSketch"],
actualUse: json["actualUse"],
);
id: json["id"],
bldgapprDetailsId: json["bldgapprDetailsId"],
assessedById: json["assessedById"],
assessedByName: json["assessedByName"],
dateCreated: json["dateCreated"],
dateModified: json["dateModified"],
bldgKind: json["bldgKind"],
strucType: json["strucType"],
bldgPermit: json["bldgPermit"],
dateIssued: json["dateIssued"],
cct: json["cct"],
certCompletionIssued: json["certCompletionIssued"],
certOccupancyIssued: json["certOccupancyIssued"],
dateCompleted: json["dateCompleted"],
dateOccupied: json["dateOccupied"],
bldgAge: json["bldgAge"],
noStoreys: json["noStoreys"],
area1Stfloor: json["area1Stfloor"],
area2Ndfloor: json["area2Ndfloor"],
area3Rdfloor: json["area3Rdfloor"],
area4Thfloor: json["area4Thfloor"],
totalFloorArea: json["totalFloorArea"],
floorSketch: json["floorSketch"],
actualUse: json["actualUse"],
unitValue: json["unitValue"]);
Map<String, dynamic> toJson() => {
"id": id,
@ -194,5 +196,6 @@ class GeneralDesc {
"total_floor_area": totalFloorArea,
"floor_sketch": floorSketch,
"actual_use": actualUse,
"unit_value": unitValue
};
}

View File

@ -27,6 +27,26 @@ class LandAppr {
this.baseMarketval,
});
LandAppr copy({
int? id,
int? landapprDetailsId,
String? classification,
String? subClass,
String? area,
String? unitValue,
String? baseMarketval,
}) {
return LandAppr(
id: id ?? this.id,
landapprDetailsId: landapprDetailsId ?? this.landapprDetailsId,
classification: classification ?? this.classification,
subClass: subClass ?? this.subClass,
area: area ?? this.area,
unitValue: unitValue ?? this.unitValue,
baseMarketval: baseMarketval ?? this.baseMarketval,
);
}
factory LandAppr.fromJson(Map<String, dynamic> json) => LandAppr(
id: json["id"],
landapprDetailsId: json["landappr_details_id"],
@ -37,6 +57,16 @@ class LandAppr {
baseMarketval: json["base_marketval"],
);
factory LandAppr.fromJson2(Map<String, dynamic> json) => LandAppr(
id: json["id"],
landapprDetailsId: json["landapprDetailsId"],
classification: json["classification"],
subClass: json["subClass"],
area: json["area"],
unitValue: json["unitValue"],
baseMarketval: json["baseMarketval"],
);
Map<String, dynamic> toJson() => {
"id": id,
"landappr_details_id": landapprDetailsId,

View File

@ -21,6 +21,17 @@ class LandClassification {
this.description,
});
LandClassification copy({
final int? id,
final String? classificationCode,
final String? description,
}) {
return LandClassification(
id: id ?? this.id,
classificationCode: classificationCode ?? this.classificationCode,
description: description ?? this.description);
}
factory LandClassification.fromJson(Map<String, dynamic> json) =>
LandClassification(
id: json["id"],
@ -28,6 +39,13 @@ class LandClassification {
description: json["description"],
);
factory LandClassification.fromJson2(Map<String, dynamic> json) =>
LandClassification(
id: json["id"],
classificationCode: json["classificationCode"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"id": id,
"classification_code": classificationCode,

View File

@ -13,22 +13,22 @@ class LandExt {
final int? landapprDetailsId;
final String? assessedById;
final String? assessedByName;
final DateTime? dateCreated;
final DateTime? dateModified;
final bool? taxable;
final bool? exempt;
final int? qtr;
final int? yr;
final String? dateCreated;
final String? dateModified;
final String? taxable;
final String? exempt;
final String? qtr;
final String? yr;
final String? appraisedbyName;
final DateTime? appraisedbyDate;
final String? appraisedbyDate;
final String? recommendapprName;
final DateTime? recommendapprDate;
final String? recommendapprDate;
final String? approvedbyName;
final DateTime? approvedbyDate;
final String? approvedbyDate;
final String? memoranda;
final String? swornstatementNo;
final DateTime? dateReceived;
final DateTime? entryDateAssessment;
final String? dateReceived;
final String? entryDateAssessment;
final String? entryDateBy;
LandExt({
@ -55,70 +55,123 @@ class LandExt {
this.entryDateBy,
});
LandExt copy({
final int? id,
final int? landapprDetailsId,
final String? assessedById,
final String? assessedByName,
final String? dateCreated,
final String? dateModified,
final String? taxable,
final String? exempt,
final String? qtr,
final String? yr,
final String? appraisedbyName,
final String? appraisedbyDate,
final String? recommendapprName,
final String? recommendapprDate,
final String? approvedbyName,
final String? approvedbyDate,
final String? memoranda,
final String? swornstatementNo,
final String? dateReceived,
final String? entryDateAssessment,
final String? entryDateBy,
}) {
return LandExt(
id: id ?? this.id,
landapprDetailsId: landapprDetailsId ?? this.landapprDetailsId,
assessedById: assessedById ?? this.assessedById,
assessedByName: assessedByName ?? this.assessedByName,
dateCreated: dateCreated ?? this.dateCreated,
dateModified: dateModified ?? this.dateModified,
taxable: taxable ?? this.taxable,
exempt: exempt ?? this.exempt,
qtr: qtr ?? this.qtr,
yr: yr ?? this.yr,
appraisedbyName: appraisedbyName ?? this.appraisedbyName,
appraisedbyDate: appraisedbyDate ?? this.appraisedbyDate,
recommendapprName: recommendapprName ?? this.recommendapprName,
recommendapprDate: recommendapprDate ?? this.recommendapprDate,
approvedbyName: approvedbyName ?? this.approvedbyName,
approvedbyDate: approvedbyDate ?? this.approvedbyDate,
memoranda: memoranda ?? this.memoranda,
swornstatementNo: swornstatementNo ?? this.swornstatementNo,
dateReceived: dateReceived ?? this.dateReceived,
entryDateAssessment: entryDateAssessment ?? this.entryDateAssessment,
entryDateBy: entryDateBy ?? this.entryDateBy,
);
}
factory LandExt.fromJson(Map<String, dynamic> json) => LandExt(
id: json["id"],
landapprDetailsId: json["landappr_details_id"],
assessedById: json["assessed_by_id"],
assessedByName: json["assessed_by_name"],
dateCreated: json["date_created"] == null
? null
: DateTime.parse(json["date_created"]),
dateModified: json["date_modified"] == null
? null
: DateTime.parse(json["date_modified"]),
dateCreated: json["date_created"],
dateModified: json["date_modified"],
taxable: json["taxable"],
exempt: json["exempt"],
qtr: json["qtr"],
yr: json["yr"],
appraisedbyName: json["appraisedby_name"],
appraisedbyDate: json["appraisedby_date"] == null
? null
: DateTime.parse(json["appraisedby_date"]),
appraisedbyDate: json["appraisedby_date"],
recommendapprName: json["recommendappr_name"],
recommendapprDate: json["recommendappr_date"] == null
? null
: DateTime.parse(json["recommendappr_date"]),
recommendapprDate: json["recommendappr_date"],
approvedbyName: json["approvedby_name"],
approvedbyDate: json["approvedby_date"] == null
? null
: DateTime.parse(json["approvedby_date"]),
approvedbyDate: json["approvedby_date"],
memoranda: json["memoranda"],
swornstatementNo: json["swornstatement_no"],
dateReceived: json["date_received"] == null
? null
: DateTime.parse(json["date_received"]),
entryDateAssessment: json["entry_date_assessment"] == null
? null
: DateTime.parse(json["entry_date_assessment"]),
dateReceived: json["date_received"],
entryDateAssessment: json["entry_date_assessment"],
entryDateBy: json["entry_date_by"],
);
factory LandExt.fromJson2(Map<String, dynamic> json) => LandExt(
id: json["id"],
landapprDetailsId: json["landapprDetailsId"],
assessedById: json["assessedById"],
assessedByName: json["assessedByName"],
dateCreated: json["dateCreated"],
dateModified: json["dateModified"],
taxable: json["taxable"],
exempt: json["exempt"],
qtr: json["qtr"],
yr: json["yr"],
appraisedbyName: json["appraisedbyName"],
appraisedbyDate: json["appraisedbyDate"],
recommendapprName: json["recommendapprName"],
recommendapprDate: json["recommendapprDate"],
approvedbyName: json["approvedbyName"],
approvedbyDate: json["approvedbyDate"],
memoranda: json["memoranda"],
swornstatementNo: json["swornstatementNo"],
dateReceived: json["dateReceived"],
entryDateAssessment: json["entryDateAssessment"],
entryDateBy: json["entryDateBy"],
);
Map<String, dynamic> toJson() => {
"id": id,
"landappr_details_id": landapprDetailsId,
"assessed_by_id": assessedById,
"assessed_by_name": assessedByName,
"date_created": dateCreated?.toIso8601String(),
"date_modified": dateModified?.toIso8601String(),
"date_created": dateCreated,
"date_modified": dateModified,
"taxable": taxable,
"exempt": exempt,
"qtr": qtr,
"yr": yr,
"appraisedby_name": appraisedbyName,
"appraisedby_date":
"${appraisedbyDate!.year.toString().padLeft(4, '0')}-${appraisedbyDate!.month.toString().padLeft(2, '0')}-${appraisedbyDate!.day.toString().padLeft(2, '0')}",
"appraisedby_date": appraisedbyDate,
"recommendappr_name": recommendapprName,
"recommendappr_date":
"${recommendapprDate!.year.toString().padLeft(4, '0')}-${recommendapprDate!.month.toString().padLeft(2, '0')}-${recommendapprDate!.day.toString().padLeft(2, '0')}",
"recommendappr_date": recommendapprDate,
"approvedby_name": approvedbyName,
"approvedby_date":
"${approvedbyDate!.year.toString().padLeft(4, '0')}-${approvedbyDate!.month.toString().padLeft(2, '0')}-${approvedbyDate!.day.toString().padLeft(2, '0')}",
"approvedby_date": approvedbyDate,
"memoranda": memoranda,
"swornstatement_no": swornstatementNo,
"date_received":
"${dateReceived!.year.toString().padLeft(4, '0')}-${dateReceived!.month.toString().padLeft(2, '0')}-${dateReceived!.day.toString().padLeft(2, '0')}",
"entry_date_assessment":
"${entryDateAssessment!.year.toString().padLeft(4, '0')}-${entryDateAssessment!.month.toString().padLeft(2, '0')}-${entryDateAssessment!.day.toString().padLeft(2, '0')}",
"date_received": dateReceived,
"entry_date_assessment": entryDateAssessment,
"entry_date_by": entryDateBy,
};
}

View File

@ -31,6 +31,28 @@ class LandPropertyAssessment {
this.totalAssessedval,
});
LandPropertyAssessment copy({
final int? id,
final int? landapprDetailsId,
final String? actualUse,
final String? marketval,
final String? assessmentLevel,
final String? assessedValue,
final String? totalMarketval,
final String? totalAssessedval,
}) {
return LandPropertyAssessment(
id: id ?? this.id,
landapprDetailsId: landapprDetailsId ?? this.landapprDetailsId,
actualUse: actualUse ?? this.actualUse,
marketval: marketval ?? this.marketval,
assessmentLevel: assessmentLevel ?? this.assessmentLevel,
assessedValue: assessedValue ?? this.assessedValue,
totalMarketval: totalMarketval ?? this.totalMarketval,
totalAssessedval: totalAssessedval ?? this.totalAssessedval,
);
}
factory LandPropertyAssessment.fromJson(Map<String, dynamic> json) =>
LandPropertyAssessment(
id: json["id"],
@ -43,6 +65,18 @@ class LandPropertyAssessment {
totalAssessedval: json["total_assessedval"],
);
factory LandPropertyAssessment.fromJson2(Map<String, dynamic> json) =>
LandPropertyAssessment(
id: json["id"],
landapprDetailsId: json["landapprDetailsId"],
actualUse: json["actualUse"],
marketval: json["marketval"],
assessmentLevel: json["assessmentLevel"],
assessedValue: json["assessedValue"],
totalMarketval: json["totalMarketval"],
totalAssessedval: json["totalAssessedval"],
);
Map<String, dynamic> toJson() => {
"id": id,
"landappr_details_id": landapprDetailsId,

View File

@ -15,13 +15,13 @@ class LandPropertyBoundaries {
final int? landapprDetailsId;
final String? assessedById;
final String? assessedByName;
final DateTime? dateCreated;
final DateTime? dateModified;
final String? dateCreated;
final String? dateModified;
final String? north;
final String? east;
final String? south;
final String? west;
final dynamic sketch;
final String? sketch;
LandPropertyBoundaries({
this.id,
@ -37,18 +37,57 @@ class LandPropertyBoundaries {
this.sketch,
});
LandPropertyBoundaries copy({
final int? id,
final int? landapprDetailsId,
final String? assessedById,
final String? assessedByName,
final String? dateCreated,
final String? dateModified,
final String? north,
final String? east,
final String? south,
final String? west,
final String? sketch,
}) {
return LandPropertyBoundaries(
id: id ?? this.id,
landapprDetailsId: landapprDetailsId ?? this.landapprDetailsId,
assessedById: assessedById ?? this.assessedById,
assessedByName: assessedByName ?? this.assessedByName,
dateCreated: dateCreated ?? this.dateCreated,
dateModified: dateModified ?? this.dateModified,
north: north ?? this.north,
east: east ?? this.east,
south: south ?? this.south,
west: west ?? this.west,
sketch: sketch ?? this.sketch,
);
}
factory LandPropertyBoundaries.fromJson(Map<String, dynamic> json) =>
LandPropertyBoundaries(
id: json["id"],
landapprDetailsId: json["landappr_details_id"],
assessedById: json["assessed_by_id"],
assessedByName: json["assessed_by_name"],
dateCreated: json["date_created"] == null
? null
: DateTime.parse(json["date_created"]),
dateModified: json["date_modified"] == null
? null
: DateTime.parse(json["date_modified"]),
dateCreated: json["date_created"],
dateModified: json["date_modified"],
north: json["north"],
east: json["east"],
south: json["south"],
west: json["west"],
sketch: json["sketch"],
);
factory LandPropertyBoundaries.fromJson2(Map<String, dynamic> json) =>
LandPropertyBoundaries(
id: json["id"],
landapprDetailsId: json["landapprDetailsId"],
assessedById: json["assessedById"],
assessedByName: json["assessedByName"],
dateCreated: json["dateCreated"],
dateModified: json["dateModified"],
north: json["north"],
east: json["east"],
south: json["south"],
@ -61,8 +100,8 @@ class LandPropertyBoundaries {
"landappr_details_id": landapprDetailsId,
"assessed_by_id": assessedById,
"assessed_by_name": assessedByName,
"date_created": dateCreated?.toIso8601String(),
"date_modified": dateModified?.toIso8601String(),
"date_created": dateCreated,
"date_modified": dateModified,
"north": north,
"east": east,
"south": south,

View File

@ -15,8 +15,8 @@ class LandPropertyLoc {
final int? landapprDetailsId;
final String? assessedById;
final String? assessedByName;
final DateTime? dateCreated;
final DateTime? dateModified;
final String? dateCreated;
final String? dateModified;
final String? street;
final String? municipality;
final String? barangay;
@ -35,18 +35,53 @@ class LandPropertyLoc {
this.province,
});
LandPropertyLoc copy({
int? id,
int? landapprDetailsId,
String? assessedById,
String? assessedByName,
String? dateCreated,
String? dateModified,
String? street,
String? municipality,
String? barangay,
String? province,
}) =>
LandPropertyLoc(
id: id,
landapprDetailsId: landapprDetailsId,
assessedById: assessedById,
assessedByName: assessedByName,
dateCreated: dateCreated,
dateModified: dateModified,
street: street,
municipality: municipality,
barangay: barangay,
province: province,
);
factory LandPropertyLoc.fromJson(Map<String, dynamic> json) =>
LandPropertyLoc(
id: json["id"],
landapprDetailsId: json["landappr_details_id"],
assessedById: json["assessed_by_id"],
assessedByName: json["assessed_by_name"],
dateCreated: json["date_created"] == null
? null
: DateTime.parse(json["date_created"]),
dateModified: json["date_modified"] == null
? null
: DateTime.parse(json["date_modified"]),
dateCreated: json["date_created"],
dateModified: json["date_modified"],
street: json["street"],
municipality: json["municipality"],
barangay: json["barangay"],
province: json["province"],
);
factory LandPropertyLoc.fromJson2(Map<String, dynamic> json) =>
LandPropertyLoc(
id: json["id"],
landapprDetailsId: json["landapprDetailsId"],
assessedById: json["assessedById"],
assessedByName: json["assessedByName"],
dateCreated: json["dateCreated"],
dateModified: json["dateModified"],
street: json["street"],
municipality: json["municipality"],
barangay: json["barangay"],
@ -58,8 +93,8 @@ class LandPropertyLoc {
"landappr_details_id": landapprDetailsId,
"assessed_by_id": assessedById,
"assessed_by_name": assessedByName,
"date_created": dateCreated?.toIso8601String(),
"date_modified": dateModified?.toIso8601String(),
"date_created": dateCreated,
"date_modified": dateModified,
"street": street,
"municipality": municipality,
"barangay": barangay,

View File

@ -14,13 +14,13 @@ class LandPropertyOwner {
final int? id;
final String? assessedById;
final String? assessedByName;
final DateTime? dateCreated;
final DateTime? dateModified;
final String? dateCreated;
final String? dateModified;
final String? transCode;
final String? tdn;
final String? pin;
final String? cloaNo;
final DateTime? dated;
final String? dated;
final String? surveyNo;
final String? lotNo;
final String? blkNo;
@ -59,22 +59,68 @@ class LandPropertyOwner {
this.faasType,
});
LandPropertyOwner copy({
int? id,
String? assessedById,
String? assessedByName,
String? dateCreated,
String? dateModified,
String? transCode,
String? tdn,
String? pin,
String? cloaNo,
String? dated,
String? surveyNo,
String? lotNo,
String? blkNo,
String? owner,
String? address,
String? telno,
String? tin,
String? adminUser,
String? adminAddress,
String? adminTelno,
String? adminTin,
String? faasType,
}) {
return LandPropertyOwner(
id: id,
assessedById: assessedById,
assessedByName: assessedByName,
dateCreated: dateCreated,
dateModified: dateModified,
transCode: transCode,
tdn: tdn,
pin: pin,
cloaNo: cloaNo,
dated: dated,
surveyNo: surveyNo,
lotNo: lotNo,
blkNo: blkNo,
owner: owner,
address: address,
telno: telno,
tin: tin,
adminUser: adminUser,
adminAddress: adminAddress,
adminTelno: adminTelno,
adminTin: adminTin,
faasType: faasType,
);
}
factory LandPropertyOwner.fromJson(Map<String, dynamic> json) =>
LandPropertyOwner(
id: json["id"],
assessedById: json["assessed_by_id"],
assessedByName: json["assessed_by_name"],
dateCreated: json["date_created"] == null
? null
: DateTime.parse(json["date_created"]),
dateModified: json["date_modified"] == null
? null
: DateTime.parse(json["date_modified"]),
dateCreated: json["date_created"],
dateModified: json["date_modified"],
transCode: json["trans_code"],
tdn: json["tdn"],
pin: json["pin"],
cloaNo: json["cloa_no"],
dated: json["dated"] == null ? null : DateTime.parse(json["dated"]),
dated: json["dated"],
surveyNo: json["survey_no"],
lotNo: json["lot_no"],
blkNo: json["blk_no"],
@ -89,18 +135,43 @@ class LandPropertyOwner {
faasType: json["faas_type"],
);
factory LandPropertyOwner.fromJson2(Map<String, dynamic> json) =>
LandPropertyOwner(
id: json["id"],
assessedById: json["assessedById"],
assessedByName: json["assessedByName"],
dateCreated: json["dateCreated"],
dateModified: json["dateModified"],
transCode: json["transCode"],
tdn: json["tdn"],
pin: json["pin"],
cloaNo: json["cloaNo"],
dated: json["dated"],
surveyNo: json["surveyNo"],
lotNo: json["lotNo"],
blkNo: json["blkNo"],
owner: json["owner"],
address: json["address"],
telno: json["telno"],
tin: json["tin"],
adminUser: json["adminUser"],
adminAddress: json["adminAddress"],
adminTelno: json["adminTelno"],
adminTin: json["adminTin"],
faasType: json["faasType"],
);
Map<String, dynamic> toJson() => {
"id": id,
"assessed_by_id": assessedById,
"assessed_by_name": assessedByName,
"date_created": dateCreated?.toIso8601String(),
"date_modified": dateModified?.toIso8601String(),
"date_created": dateCreated,
"date_modified": dateModified,
"trans_code": transCode,
"tdn": tdn,
"pin": pin,
"cloa_no": cloaNo,
"dated":
"${dated!.year.toString().padLeft(4, '0')}-${dated!.month.toString().padLeft(2, '0')}-${dated!.day.toString().padLeft(2, '0')}",
"dated": dated,
"survey_no": surveyNo,
"lot_no": lotNo,
"blk_no": blkNo,

View File

@ -27,6 +27,24 @@ class LandSubClassification {
this.baseUnitMarketval,
});
LandSubClassification copy({
final int? id,
final int? classificationId,
final String? cityCode,
final String? subclassCode,
final String? subclassDescription,
final String? baseUnitMarketval,
}) {
return LandSubClassification(
id: id ?? this.id,
classificationId: classificationId ?? this.classificationId,
cityCode: cityCode ?? this.cityCode,
subclassCode: subclassCode ?? this.subclassCode,
subclassDescription: subclassDescription ?? this.subclassDescription,
baseUnitMarketval: baseUnitMarketval ?? this.baseUnitMarketval,
);
}
factory LandSubClassification.fromJson(Map<String, dynamic> json) =>
LandSubClassification(
id: json["id"],
@ -37,6 +55,16 @@ class LandSubClassification {
baseUnitMarketval: json["base_unit_marketval"],
);
factory LandSubClassification.fromJson2(Map<String, dynamic> json) =>
LandSubClassification(
id: json["id"],
classificationId: json["classificationId"],
cityCode: json["cityCode"],
subclassCode: json["subclassCode"],
subclassDescription: json["subclassDescription"],
baseUnitMarketval: json["baseUnitMarketval"],
);
Map<String, dynamic> toJson() => {
"id": id,
"classification_id": classificationId,

View File

@ -29,6 +29,26 @@ class ValueAdjustments {
this.marketValue,
});
ValueAdjustments copy({
final int? id,
final int? landapprDetailsId,
final String? baseMarketval,
final String? adjustmentFactors,
final String? adjustment,
final String? valueAdjustment,
final String? marketValue,
}) {
return ValueAdjustments(
id: id ?? this.id,
landapprDetailsId: landapprDetailsId ?? this.landapprDetailsId,
baseMarketval: baseMarketval ?? this.baseMarketval,
adjustmentFactors: adjustmentFactors ?? this.adjustmentFactors,
adjustment: adjustment ?? this.adjustment,
valueAdjustment: valueAdjustment ?? this.valueAdjustment,
marketValue: marketValue ?? this.marketValue,
);
}
factory ValueAdjustments.fromJson(Map<String, dynamic> json) =>
ValueAdjustments(
id: json["id"],
@ -40,6 +60,17 @@ class ValueAdjustments {
marketValue: json["market_value"],
);
factory ValueAdjustments.fromJson2(Map<String, dynamic> json) =>
ValueAdjustments(
id: json["id"],
landapprDetailsId: json["landapprDetailsId"],
baseMarketval: json["baseMarketval"],
adjustmentFactors: json["adjustmentFactors"],
adjustment: json["adjustment"],
valueAdjustment: json["valueAdjustment"],
marketValue: json["marketValue"],
);
Map<String, dynamic> toJson() => {
"id": id,
"landappr_details_id": landapprDetailsId,

View File

@ -20,7 +20,7 @@ class OtherImprovements {
final String? baseMarketval;
final int? noOfProductive;
final int? noOfNonproductive;
final bool? fruitBearing;
final String? fruitBearing;
OtherImprovements({
this.id,
@ -35,6 +35,32 @@ class OtherImprovements {
this.fruitBearing,
});
OtherImprovements copy({
final int? id,
final int? landapprDetailsId,
final String? kindsOfTrees,
final String? subclassAge,
final int? quantity,
final String? unitValue,
final String? baseMarketval,
final int? noOfProductive,
final int? noOfNonproductive,
final String? fruitBearing,
}) {
return OtherImprovements(
id: id ?? this.id,
landapprDetailsId: landapprDetailsId ?? this.landapprDetailsId,
kindsOfTrees: kindsOfTrees ?? this.kindsOfTrees,
subclassAge: subclassAge ?? this.subclassAge,
quantity: quantity ?? this.quantity,
unitValue: unitValue ?? this.unitValue,
baseMarketval: baseMarketval ?? this.baseMarketval,
noOfProductive: noOfProductive ?? this.noOfProductive,
noOfNonproductive: noOfNonproductive ?? this.noOfNonproductive,
fruitBearing: fruitBearing ?? this.fruitBearing,
);
}
factory OtherImprovements.fromJson(Map<String, dynamic> json) =>
OtherImprovements(
id: json["id"],
@ -49,6 +75,20 @@ class OtherImprovements {
fruitBearing: json["fruit_bearing"],
);
factory OtherImprovements.fromJson2(Map<String, dynamic> json) =>
OtherImprovements(
id: json["id"],
landapprDetailsId: json["landapprDetailsId"],
kindsOfTrees: json["kindsOfTrees"],
subclassAge: json["subclassAge"],
quantity: json["quantity"],
unitValue: json["unitValue"],
baseMarketval: json["baseMarketval"],
noOfProductive: json["noOfProductive"],
noOfNonproductive: json["noOfNonproductive"],
fruitBearing: json["fruitBearing"],
);
Map<String, dynamic> toJson() => {
"id": id,
"landappr_details_id": landapprDetailsId,

View File

@ -15,8 +15,8 @@ class PropertyAppraisal {
final int? bldgapprDetailsId;
final String? assessedById;
final String? assessedByName;
final DateTime? dateCreated;
final DateTime? dateModified;
final String? dateCreated;
final String? dateModified;
final String? unitconstructCost;
final String? buildingCore;
final String? unitconstructSubtotal;
@ -53,8 +53,8 @@ class PropertyAppraisal {
int? bldgapprDetailsId,
String? assessedById,
String? assessedByName,
DateTime? dateCreated,
DateTime? dateModified,
String? dateCreated,
String? dateModified,
String? unitconstructCost,
String? buildingCore,
String? unitconstructSubtotal,
@ -93,12 +93,8 @@ class PropertyAppraisal {
bldgapprDetailsId: json["bldgappr_details_id"],
assessedById: json["assessed_by_id"],
assessedByName: json["assessed_by_name"],
dateCreated: json["date_created"] == null
? null
: DateTime.parse(json["date_created"]),
dateModified: json["date_modified"] == null
? null
: DateTime.parse(json["date_modified"]),
dateCreated: json["date_created"],
dateModified: json["date_modified"],
unitconstructCost: json["unitconstruct_cost"],
buildingCore: json["building_core"],
unitconstructSubtotal: json["unitconstruct_subtotal"],
@ -111,13 +107,33 @@ class PropertyAppraisal {
totalArea: json["total_area"],
actualUse: json["actual_use"]);
factory PropertyAppraisal.fromJson2(Map<String, dynamic> json) =>
PropertyAppraisal(
id: json["id"],
bldgapprDetailsId: json["bldgapprDetailsId"],
assessedById: json["assessedById"],
assessedByName: json["assessedByName"],
dateCreated: json["dateCreated"],
dateModified: json["dateModified"],
unitconstructCost: json["unitconstructCost"],
buildingCore: json["buildingCore"],
unitconstructSubtotal: json["unitconstructSubtotal"],
depreciationRate: json["depreciationRate"],
depreciationCost: json["depreciationCost"],
costAddItems: json["costAddItems"],
addItemsSubtotal: json["addItemsSubtotal"],
totalpercentDepreciation: json["totalpercentDepreciation"],
marketValue: json["marketValue"],
totalArea: json["totalArea"],
actualUse: json["actualUse"]);
Map<String, dynamic> toJson() => {
"id": id,
"bldgappr_details_id": bldgapprDetailsId,
"assessed_by_id": assessedById,
"assessed_by_name": assessedByName,
"date_created": dateCreated?.toIso8601String(),
"date_modified": dateModified?.toIso8601String(),
"date_created": dateCreated,
"date_modified": dateModified,
"unitconstruct_cost": unitconstructCost,
"building_core": buildingCore,
"unitconstruct_subtotal": unitconstructSubtotal,

View File

@ -18,19 +18,19 @@ class PropertyAssessment {
final String marketValue;
final String assessmentLevel;
final String assessedValue;
final bool taxable;
final bool exempt;
final int qtr;
final int yr;
final String taxable;
final String exempt;
final String qtr;
final String yr;
final String appraisedbyName;
final DateTime appraisedbyDate;
final String appraisedbyDate;
final String recommendapprName;
final DateTime recommendapprDate;
final String recommendapprDate;
final String approvedbyName;
final String memoranda;
final String swornstatementNo;
final DateTime dateReceived;
final DateTime entryDateAssessment;
final String dateReceived;
final String entryDateAssessment;
final String entryDateBy;
PropertyAssessment({
@ -63,19 +63,19 @@ class PropertyAssessment {
String? marketValue,
String? assessmentLevel,
String? assessedValue,
bool? taxable,
bool? exempt,
int? qtr,
int? yr,
String? taxable,
String? exempt,
String? qtr,
String? yr,
String? appraisedbyName,
DateTime? appraisedbyDate,
String? appraisedbyDate,
String? recommendapprName,
DateTime? recommendapprDate,
String? recommendapprDate,
String? approvedbyName,
String? memoranda,
String? swornstatementNo,
DateTime? dateReceived,
DateTime? entryDateAssessment,
String? dateReceived,
String? entryDateAssessment,
String? entryDateBy,
}) =>
PropertyAssessment(
@ -114,17 +114,41 @@ class PropertyAssessment {
qtr: json["qtr"],
yr: json["yr"],
appraisedbyName: json["appraisedby_name"],
appraisedbyDate: DateTime.parse(json["appraisedby_date"]),
appraisedbyDate: json["appraisedby_date"],
recommendapprName: json["recommendappr_name"],
recommendapprDate: DateTime.parse(json["recommendappr_date"]),
recommendapprDate: json["recommendappr_date"],
approvedbyName: json["approvedby_name"],
memoranda: json["memoranda"],
swornstatementNo: json["swornstatement_no"],
dateReceived: DateTime.parse(json["date_received"]),
entryDateAssessment: DateTime.parse(json["entry_date_assessment"]),
dateReceived: json["date_received"],
entryDateAssessment: json["entry_date_assessment"],
entryDateBy: json["entry_date_by"],
);
factory PropertyAssessment.fromJson2(Map<String, dynamic> json) =>
PropertyAssessment(
id: json["id"],
bldgapprDetailsId: json["bldgapprDetailsId"],
actualUse: json["actualUse"],
marketValue: json["marketValue"],
assessmentLevel: json["assessmentLevel"],
assessedValue: json["assessedValue"],
taxable: json["taxable"],
exempt: json["exempt"],
qtr: json["qtr"],
yr: json["yr"],
appraisedbyName: json["appraisedbyName"],
appraisedbyDate: json["appraisedbyDate"],
recommendapprName: json["recommendapprName"],
recommendapprDate: json["recommendapprDate"],
approvedbyName: json["approvedbyName"],
memoranda: json["memoranda"],
swornstatementNo: json["swornstatementNo"],
dateReceived: json["dateReceived"],
entryDateAssessment: json["entryDateAssessment"],
entryDateBy: json["entryDateBy"],
);
Map<String, dynamic> toJson() => {
"id": id,
"bldgappr_details_id": bldgapprDetailsId,
@ -137,18 +161,13 @@ class PropertyAssessment {
"qtr": qtr,
"yr": yr,
"appraisedby_name": appraisedbyName,
"appraisedby_date":
"${appraisedbyDate.year.toString().padLeft(4, '0')}-${appraisedbyDate.month.toString().padLeft(2, '0')}-${appraisedbyDate.day.toString().padLeft(2, '0')}",
"appraisedby_date": appraisedbyDate,
"recommendappr_name": recommendapprName,
"recommendappr_date":
"${recommendapprDate.year.toString().padLeft(4, '0')}-${recommendapprDate.month.toString().padLeft(2, '0')}-${recommendapprDate.day.toString().padLeft(2, '0')}",
"recommendappr_date": recommendapprDate,
"approvedby_name": approvedbyName,
"memoranda": memoranda,
"swornstatement_no": swornstatementNo,
"date_received":
"${dateReceived.year.toString().padLeft(4, '0')}-${dateReceived.month.toString().padLeft(2, '0')}-${dateReceived.day.toString().padLeft(2, '0')}",
"entry_date_assessment":
"${entryDateAssessment.year.toString().padLeft(4, '0')}-${entryDateAssessment.month.toString().padLeft(2, '0')}-${entryDateAssessment.day.toString().padLeft(2, '0')}",
"date_received": dateReceived,
"entry_date_by": entryDateBy,
};
}

View File

@ -13,8 +13,8 @@ class PropertyInfo {
final int? id;
final String? assessedById;
final String? assessedByName;
final DateTime? dateCreated;
final DateTime? dateModified;
final String? dateCreated;
final String? dateModified;
final String? transCode;
final String? tdn;
final String? pin;
@ -52,8 +52,8 @@ class PropertyInfo {
int? id,
String? assessedById,
String? assessedByName,
DateTime? dateCreated,
DateTime? dateModified,
String? dateCreated,
String? dateModified,
String? transCode,
String? tdn,
String? pin,
@ -111,6 +111,30 @@ class PropertyInfo {
faasType: json["faas_type"],
);
factory PropertyInfo.fromJson2(Map<String, dynamic> json) => PropertyInfo(
id: json["id"],
assessedById: json["assessedById"],
assessedByName: json["assessedByName"],
// dateCreated: json["date_created"] == null
// ? null
// : DateTime.parse(json["date_created"]),
// dateModified: json["date_modified"] == null
// ? null
// : DateTime.parse(json["date_modified"]),
transCode: json["transCode"],
tdn: json["tdn"],
pin: json["pin"],
owner: json["owner"],
address: json["address"],
telno: json["telno"],
tin: json["tin"],
adminUser: json["adminUser"],
adminAddress: json["adminAddress"],
adminTelno: json["adminTelno"],
adminTin: json["adminTin"],
faasType: json["faasType"],
);
factory PropertyInfo.fromMap(Map<String, dynamic> map) => PropertyInfo(
id: map["id"],
assessedById: map["assessedById"],
@ -135,8 +159,8 @@ class PropertyInfo {
"id": id,
"assessed_by_id": assessedById,
"assessed_by_name": assessedByName,
"date_created": dateCreated?.toIso8601String(),
"date_modified": dateModified?.toIso8601String(),
"date_created": dateCreated,
"date_modified": dateModified,
"trans_code": transCode,
"tdn": tdn,
"pin": pin,

View File

@ -71,6 +71,19 @@ class StructureMaterials {
walls: json["walls"],
others: json["others"]);
factory StructureMaterials.fromJson2(Map<String, dynamic> json) =>
StructureMaterials(
id: json["id"],
bldgapprDetailsId: json["bldgapprDetailsId"],
foundation: json["foundation"],
columns: json["columns"],
beams: json["beams"],
trussFraming: json["trussFraming"],
roof: json["roof"],
flooring: json["flooring"],
walls: json["walls"],
others: json["others"]);
Map<String, dynamic> toJson() => {
"id": id,
"bldgappr_details_id": bldgapprDetailsId,

View File

@ -23,6 +23,20 @@ class TreesImprovements {
this.subclassCode,
});
TreesImprovements copy({
final int? id,
final String? improvement,
final String? pricePerTree,
final dynamic subclassCode,
}) {
return TreesImprovements(
id: id ?? this.id,
improvement: improvement ?? this.improvement,
pricePerTree: pricePerTree ?? this.pricePerTree,
subclassCode: subclassCode ?? this.subclassCode,
);
}
factory TreesImprovements.fromJson(Map<String, dynamic> json) =>
TreesImprovements(
id: json["id"],
@ -31,6 +45,14 @@ class TreesImprovements {
subclassCode: json["subclass_code"],
);
factory TreesImprovements.fromJson2(Map<String, dynamic> json) =>
TreesImprovements(
id: json["id"],
improvement: json["improvement"],
pricePerTree: json["pricePerTree"],
subclassCode: json["subclassCode"],
);
Map<String, dynamic> toJson() => {
"id": id,
"improvement": improvement,

View File

@ -22,6 +22,15 @@ class TypeOfLocation {
this.localTradingCenter,
});
TypeOfLocation copy({
final int? id,
final String? distanceKm,
final String? allRoadTypes,
final String? localTradingCenter,
}) {
return TypeOfLocation();
}
factory TypeOfLocation.fromJson(Map<String, dynamic> json) => TypeOfLocation(
id: json["id"],
distanceKm: json["distance_km"],
@ -29,6 +38,13 @@ class TypeOfLocation {
localTradingCenter: json["local_trading_center"],
);
factory TypeOfLocation.fromJson2(Map<String, dynamic> json) => TypeOfLocation(
id: json["id"],
distanceKm: json["distanceKm"],
allRoadTypes: json["allRoadTypes"],
localTradingCenter: json["localTradingCenter"],
);
Map<String, dynamic> toJson() => {
"id": id,
"distance_km": distanceKm,

View File

@ -20,12 +20,30 @@ class TypeOfRoad {
this.deduction,
});
TypeOfRoad copy({
final int? id,
final String? roadType,
final String? deduction,
}) {
return TypeOfRoad(
id: id ?? this.id,
roadType: roadType ?? this.roadType,
deduction: deduction ?? this.deduction,
);
}
factory TypeOfRoad.fromJson(Map<String, dynamic> json) => TypeOfRoad(
id: json["id"],
roadType: json["road_type"],
deduction: json["deduction"],
);
factory TypeOfRoad.fromJson2(Map<String, dynamic> json) => TypeOfRoad(
id: json["id"],
roadType: json["roadType"],
deduction: json["deduction"],
);
Map<String, dynamic> toJson() => {
"id": id,
"road_type": roadType,

View File

@ -59,7 +59,8 @@ class OfflineModuleScreen extends StatelessWidget {
ontap: () {
Navigator.push(context,
MaterialPageRoute(builder: ((context) {
return const PassoOfflineMainScreen();
return PassoOfflineMainScreen(
state.offlineProfile);
})));
}))
.toList()),

View File

@ -3,19 +3,34 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:fluttericon/elusive_icons.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';
import 'package:unit2/bloc/offline/offline_passo/admin/memoranda/memoranda_admin_bloc.dart';
import 'package:unit2/bloc/offline/offline_passo/admin/municipalities_admin/municipalities_admin_bloc.dart';
import 'package:unit2/bloc/offline/offline_passo/admin/signatories/signatories_admin_bloc.dart';
import 'package:unit2/bloc/offline/offline_passo/admin/trees_improvements/trees_improvements_bloc.dart';
import 'package:unit2/bloc/offline/offline_passo/admin/type_of_location/type_of_location_bloc.dart';
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/barangay.dart';
import 'package:unit2/screens/offline/passo/admin/class_components.dart';
import 'package:unit2/screens/offline/passo/admin/globalSyncService.dart';
import 'package:unit2/screens/offline/passo/admin/land_classification.dart';
import 'package:unit2/screens/offline/passo/admin/land_sub_classification.dart';
import 'package:unit2/screens/offline/passo/admin/memoranda.dart';
import 'package:unit2/screens/offline/passo/admin/municipalities.dart';
import 'package:unit2/screens/offline/passo/admin/signatories.dart';
import 'package:unit2/screens/offline/passo/admin/trees_improvements.dart';
import 'package:unit2/screens/offline/passo/admin/type_of_location.dart';
import 'package:unit2/screens/offline/passo/admin/type_of_road.dart';
import 'package:unit2/screens/offline/passo/admin/unit_construction.dart';
import 'package:unit2/screens/offline/passo/admin/value_adjustment.dart';
import 'package:unit2/screens/profile/components/main_menu.dart';
import 'package:unit2/sevices/offline/offline_passo/admin/api_services/type_of_location.dart';
import 'package:unit2/theme-data.dart/colors.dart';
import '../../../../bloc/offline/offline_passo/admin/land_classification/land_classification_bloc.dart';
class AdminMainScreen extends StatefulWidget {
const AdminMainScreen({super.key});
@ -31,11 +46,27 @@ class _AdminMainScreen extends State<AdminMainScreen> {
backgroundColor: primary,
title: const Text("PASSO Admin"),
centerTitle: true,
actions: [
TextButton(
style: TextButton.styleFrom(
textStyle: const TextStyle(fontSize: 15),
),
onPressed: () async {
try {
GlobalSyncService().syncAllData();
} catch (e) {
// Handle any errors that might occur during the API call or database insertion.
print("Error: $e");
}
},
child: const Text('SYNC'),
),
],
),
body: ListView(
children: [
MainMenu(
icon: Elusive.group,
icon: Elusive.wrench,
title: "Municipalities",
onTap: () {
Navigator.push(context,
@ -50,7 +81,7 @@ class _AdminMainScreen extends State<AdminMainScreen> {
),
const Divider(),
MainMenu(
icon: Elusive.group,
icon: Elusive.wrench,
title: "Barangays",
onTap: () {
Navigator.push(context,
@ -64,7 +95,7 @@ class _AdminMainScreen extends State<AdminMainScreen> {
),
const Divider(),
MainMenu(
icon: Elusive.group,
icon: Elusive.wrench,
title: "Class Components",
onTap: () {
Navigator.push(context,
@ -79,7 +110,7 @@ class _AdminMainScreen extends State<AdminMainScreen> {
),
const Divider(),
MainMenu(
icon: Elusive.group,
icon: Elusive.wrench,
title: "Structural Types",
onTap: () {
Navigator.push(context,
@ -94,7 +125,7 @@ class _AdminMainScreen extends State<AdminMainScreen> {
),
const Divider(),
MainMenu(
icon: Elusive.group,
icon: Elusive.wrench,
title: "Signatories",
onTap: () {
Navigator.push(context,
@ -109,7 +140,7 @@ class _AdminMainScreen extends State<AdminMainScreen> {
),
const Divider(),
MainMenu(
icon: Elusive.group,
icon: Elusive.wrench,
title: "Memoranda",
onTap: () {
Navigator.push(context,
@ -122,6 +153,81 @@ class _AdminMainScreen extends State<AdminMainScreen> {
}));
},
),
const Divider(),
MainMenu(
icon: Elusive.wrench,
title: "Land SubClassification",
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (BuildContext context) {
return BlocProvider(
create: (context) => LandSubclassificationBloc()
..add(const LoadLandSubClassification()),
child: const LandSubClassificationAdminPage(),
);
}));
},
),
const Divider(),
MainMenu(
icon: Elusive.wrench,
title: "Land Classification",
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (BuildContext context) {
return BlocProvider(
create: (context) => LandClassificationBloc()
..add(const LoadLandClassification()),
child: const LandClassificationAdminPage(),
);
}));
},
),
const Divider(),
MainMenu(
icon: Elusive.wrench,
title: "Trees",
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (BuildContext context) {
return BlocProvider(
create: (context) =>
TreesImprovementsBloc()..add(LoadTreesImprovements()),
child: const TreesImprovementsAdminPage(),
);
}));
},
),
const Divider(),
MainMenu(
icon: Elusive.wrench,
title: "Type of Road",
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (BuildContext context) {
return BlocProvider(
create: (context) =>
TypeOfRoadBloc()..add(const LoadTypeOfRoad()),
child: const TypesOfRoadAdminPage(),
);
}));
},
),
const Divider(),
MainMenu(
icon: Elusive.wrench,
title: "Type of Location",
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (BuildContext context) {
return BlocProvider(
create: (context) =>
TypeOfLocationBloc()..add(const LoadTypeOfLocation()),
child: const TypesOfLocationAdminPage(),
);
}));
},
),
],
),
);

View File

@ -100,8 +100,9 @@ class _ClassComponentsAdminPage extends State<ClassComponentsAdminPage> {
rows: state.classes.map((dataRow) {
return DataRow(
cells: [
DataCell(Text(dataRow.componentName ??
'N/A')), // Use a default value if cityCode is null
DataCell(
Text(dataRow.componentName ?? 'N/A')),
// Use a default value if cityCode is null
DataCell(Text(dataRow.withoutBucc
.toString() ??
'N/A')), // Use a default value if cityDescription is null

View File

@ -0,0 +1,246 @@
import '../../../../model/passo/barangay.dart';
import '../../../../model/passo/city.dart';
import '../../../../model/passo/class_components _offline.dart';
import '../../../../model/passo/class_components.dart';
import '../../../../model/passo/land_classification.dart';
import '../../../../model/passo/land_subclassification.dart';
import '../../../../model/passo/land_value_adjustment.dart';
import '../../../../model/passo/memoranda.dart';
import '../../../../model/passo/signatories.dart';
import '../../../../model/passo/trees_improvements.dart';
import '../../../../model/passo/type_of_location.dart';
import '../../../../model/passo/type_of_road.dart';
import '../../../../model/passo/unit_construct.dart';
import '../../../../sevices/offline/offline_passo/admin/api_services/barangay_api_services.dart';
import '../../../../sevices/offline/offline_passo/admin/api_services/class_components_api_services.dart';
import '../../../../sevices/offline/offline_passo/admin/api_services/land_classification_api_services.dart';
import '../../../../sevices/offline/offline_passo/admin/api_services/land_sub_classification_api_services.dart';
import '../../../../sevices/offline/offline_passo/admin/api_services/memoranda_api_services.dart';
import '../../../../sevices/offline/offline_passo/admin/api_services/municipalities_api_services.dart';
import '../../../../sevices/offline/offline_passo/admin/api_services/signatories.dart';
import '../../../../sevices/offline/offline_passo/admin/api_services/trees_improvements_api_services.dart';
import '../../../../sevices/offline/offline_passo/admin/api_services/type_of_location.dart';
import '../../../../sevices/offline/offline_passo/admin/api_services/type_of_road_api_services.dart';
import '../../../../sevices/offline/offline_passo/admin/api_services/unit_construction_api_services.dart';
import '../../../../sevices/offline/offline_passo/admin/api_services/value_adjustments.dart';
import '../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
class GlobalSyncService {
static final GlobalSyncService _instance = GlobalSyncService._internal();
factory GlobalSyncService() {
return _instance;
}
GlobalSyncService._internal();
Future<void> syncAllData() async {
const maxRetries = 100;
int retryCount = 0;
// Helper function for retrying individual sync methods
Future<void> syncWithRetry(Future<void> Function() syncMethod) async {
if (retryCount < maxRetries) {
retryCount++;
print('Retrying synchronization for ${retryCount}...');
// Implement a backoff strategy, for example, using a delay.
await Future.delayed(Duration(seconds: retryCount * 2));
await syncMethod();
} else {
print('Max retries reached for ${syncMethod.toString()}. Sync failed.');
// Handle the failure as needed (e.g., show an error message).
}
}
Future<void> retrySync() async {
try {
await syncWithRetry(syncBrgyData);
await syncWithRetry(syncClassComponentsData);
await syncWithRetry(syncLandClassification);
await syncWithRetry(syncLandSubClassification);
await syncWithRetry(syncMemoranda);
await syncWithRetry(syncMunicipalities);
await syncWithRetry(syncSignatories);
await syncWithRetry(syncTreesImprovements);
await syncWithRetry(syncTypeOfLocation);
await syncWithRetry(syncTypeOfRoad);
await syncWithRetry(syncUnitConstruct);
await syncWithRetry(syncValueAdjustment);
} catch (e) {
print(e);
print('Max retries reached. Sync failed.');
// Handle the failure as needed (e.g., show an error message).
}
}
await retrySync();
// Add more sync methods as needed
}
Future<void> syncBrgyData() async {
final result = await BrgyAdminApiServices.instance.fetch();
final brgys = result.map((json) => Brgy.fromJson(json)).toList();
for (Brgy brgy in brgys) {
await SQLServices.instance.createBarangay(brgy);
}
}
Future<void> syncClassComponentsData() async {
final result = await ClassComponentAdminApiServices.instance.fetch();
final classes =
result.map((json) => ClassComponents.fromJson(json)).toList();
for (ClassComponents classs in classes) {
await SQLServices.instance.createClassComponents(
ClassComponentsOffline(
componentName: classs.componentName,
minBaseUnitvalPercent: classs.minBaseUnitvalPercent,
maxBaseUnitvalPercent: classs.maxBaseUnitvalPercent,
minUnitvalSqrmtr: classs.minUnitvalSqrmtr,
maxUnitvalSqrmtr: classs.maxUnitvalSqrmtr,
minAddBaseunitval: classs.minAddBaseunitval,
maxAddBaseunitval: classs.maxAddBaseunitval,
minDeductBaserate: classs.minAddBaseunitval,
maxDeductBaserate: classs.maxDeductBaserate,
minLinearMeter: classs.minLinearMeter,
maxLinearMeter: classs.maxLinearMeter,
minSpacing: classs.minSpacing,
maxSpacing: classs.maxSpacing,
roughFinish: classs.roughFinish,
highFinish: classs.highFinish,
withoutBucc: classs.withoutBucc == true ? 1 : 0),
);
}
}
Future<void> syncLandClassification() async {
final result = await LandClassificationAdminApiServices.instance.fetch();
// Assuming result is a List of JSON objects, convert them to City objects.
final landClass =
result.map((json) => LandClassification.fromJson(json)).toList();
// Loop through the list of City objects and insert them into the local database.
for (LandClassification landClassification in landClass) {
await SQLServices.instance.createLandClassification(landClassification);
}
}
Future<void> syncLandSubClassification() async {
final result = await LandSubClassificationAdminApiServices.instance.fetch();
// Assuming result is a List of JSON objects, convert them to City objects.
final landSubClass =
result.map((json) => LandSubClassification.fromJson(json)).toList();
// Loop through the list of City objects and insert them into the local database.
for (LandSubClassification landSubClassification in landSubClass) {
await SQLServices.instance
.createLandSubClassification(landSubClassification);
}
}
Future<void> syncMemoranda() async {
final result = await MemorandaAdminApiServices.instance.fetch();
// Assuming result is a List of JSON objects, convert them to City objects.
final memos = result.map((json) => Memoranda.fromJson(json)).toList();
// Loop through the list of City objects and insert them into the local database.
for (Memoranda memo in memos) {
await SQLServices.instance.createMemoranda(memo);
}
}
Future<void> syncMunicipalities() async {
final result = await MunicipalityAdminApiServices.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.createMunicipalities(city);
}
}
Future<void> syncSignatories() async {
final result = await SignatoriesAdminApiServices.instance.fetch();
// Assuming result is a List of JSON objects, convert them to City objects.
final signatories =
result.map((json) => Signatories.fromJson(json)).toList();
// Loop through the list of City objects and insert them into the local database.
for (Signatories signatory in signatories) {
await SQLServices.instance.createSignatories(signatory);
}
}
Future<void> syncTreesImprovements() async {
final result = await TreesImprovementsAdminApiServices.instance.fetch();
// Assuming result is a List of JSON objects, convert them to City objects.
final treesImpr =
result.map((json) => TreesImprovements.fromJson(json)).toList();
// Loop through the list of City objects and insert them into the local database.
for (TreesImprovements treesImprovements in treesImpr) {
await SQLServices.instance.createTreesImprovements(treesImprovements);
}
}
Future<void> syncTypeOfLocation() async {
final result = await TypeOfLocationAdminApiServices.instance.fetch();
// Assuming result is a List of JSON objects, convert them to City objects.
final typesOfLoc =
result.map((json) => TypeOfLocation.fromJson(json)).toList();
// Loop through the list of City objects and insert them into the local database.
for (TypeOfLocation typesOfLocation in typesOfLoc) {
await SQLServices.instance.createTypeOfLocation(typesOfLocation);
}
}
Future<void> syncTypeOfRoad() async {
final result = await TypeOfRoadAdminApiServices.instance.fetch();
// Assuming result is a List of JSON objects, convert them to City objects.
final typesOfRoad =
result.map((json) => TypeOfRoad.fromJson(json)).toList();
// Loop through the list of City objects and insert them into the local database.
for (TypeOfRoad typesOfRoad in typesOfRoad) {
await SQLServices.instance.createTypeOfRoad(typesOfRoad);
}
}
Future<void> syncUnitConstruct() async {
final result = await UnitConstructionAdminApiServices.instance.fetch();
// Assuming result is a List of JSON objects, convert them to City objects.
final units = result.map((json) => UnitConstruct.fromJson(json)).toList();
// Loop through the list of City objects and insert them into the local database.
for (UnitConstruct unit in units) {
await SQLServices.instance.createUnitConstruction(unit);
}
}
Future<void> syncValueAdjustment() async {
final result = await ValueAdjustmentsAdminApiServices.instance.fetch();
// Assuming result is a List of JSON objects, convert them to City objects.
final valueAdj =
result.map((json) => ValueAdjustments.fromJson(json)).toList();
// Loop through the list of City objects and insert them into the local database.
for (ValueAdjustments valueAdjustments in valueAdj) {
await SQLServices.instance.createValueAdjustments(valueAdjustments);
}
}
}

View File

@ -0,0 +1,109 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:unit2/bloc/offline/offline_passo/admin/land_classification/land_classification_bloc.dart';
import 'package:unit2/model/passo/land_classification.dart';
import 'package:unit2/sevices/offline/offline_passo/admin/api_services/land_classification_api_services.dart';
import '../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
import '../../../../theme-data.dart/colors.dart';
class LandClassificationAdminPage extends StatefulWidget {
const LandClassificationAdminPage();
@override
_LandClassificationAdminPage createState() => _LandClassificationAdminPage();
}
class _LandClassificationAdminPage extends State<LandClassificationAdminPage> {
final items = [];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: primary,
title: const Text("Land Classification"),
centerTitle: true,
actions: [
TextButton(
style: TextButton.styleFrom(
textStyle: const TextStyle(fontSize: 15),
),
onPressed: () async {
try {
final result =
await LandClassificationAdminApiServices.instance.fetch();
// Assuming result is a List of JSON objects, convert them to City objects.
final landClass = result
.map((json) => LandClassification.fromJson(json))
.toList();
// Loop through the list of City objects and insert them into the local database.
for (LandClassification landClassification in landClass) {
await SQLServices.instance
.createLandClassification(landClassification);
}
} catch (e) {
// Handle any errors that might occur during the API call or database insertion.
print("Error: $e");
}
},
child: const Text('SYNC'),
),
],
),
body: BlocConsumer<LandClassificationBloc, LandClassificationState>(
listener: (context, state) {
// TODO: implement listener
},
builder: (context, state) {
if (state is LandClassificationLoaded) {
return Column(children: [
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.all(15.0),
child: Column(
children: [
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
// ignore: prefer_const_literals_to_create_immutables
columns: [
const DataColumn(
label: Text('ID'),
),
const DataColumn(
label: Text('Code'),
),
const DataColumn(
label: Text('Memoranda'),
),
],
rows: state.landClassification.map((dataRow) {
return DataRow(
cells: [
DataCell(Text(dataRow.id.toString() ??
'N/A')), // Use a default value if cityCode is null
DataCell(Text(dataRow.classificationCode ??
'N/A')), // Use a default value if cityDescription is null
DataCell(Text(dataRow.description ?? 'N/A')),
],
);
}).toList(),
),
)
],
),
),
),
)
]);
}
return Container();
},
),
);
}
}

View File

@ -0,0 +1,118 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:unit2/bloc/offline/offline_passo/admin/land_subclassification/land_subclassification_bloc.dart';
import 'package:unit2/sevices/offline/offline_passo/admin/api_services/land_sub_classification_api_services.dart';
import 'package:unit2/theme-data.dart/colors.dart';
import '../../../../model/passo/land_subclassification.dart';
import '../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
class LandSubClassificationAdminPage extends StatefulWidget {
const LandSubClassificationAdminPage();
@override
_LandSubClassificationAdminPage createState() =>
_LandSubClassificationAdminPage();
}
class _LandSubClassificationAdminPage
extends State<LandSubClassificationAdminPage> {
final items = [];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: primary,
title: const Text("Land Sub-Classification"),
centerTitle: true,
actions: [
TextButton(
style: TextButton.styleFrom(
textStyle: const TextStyle(fontSize: 15),
),
onPressed: () async {
try {
final result = await LandSubClassificationAdminApiServices
.instance
.fetch();
// Assuming result is a List of JSON objects, convert them to City objects.
final landSubClass = result
.map((json) => LandSubClassification.fromJson(json))
.toList();
// Loop through the list of City objects and insert them into the local database.
for (LandSubClassification landSubClassification
in landSubClass) {
await SQLServices.instance
.createLandSubClassification(landSubClassification);
}
} catch (e) {
// Handle any errors that might occur during the API call or database insertion.
print("Error: $e");
}
},
child: const Text('SYNC'),
),
],
),
body: BlocConsumer<LandSubclassificationBloc, LandSubclassificationState>(
listener: (context, state) {
// TODO: implement listener
},
builder: (context, state) {
if (state is LandSubClassificationLoaded) {
return Column(children: [
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.all(15.0),
child: Column(
children: [
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
// ignore: prefer_const_literals_to_create_immutables
columns: [
const DataColumn(
label: Text('ID'),
),
const DataColumn(
label: Text('Municipality'),
),
const DataColumn(
label: Text('Sub-Class Description'),
),
const DataColumn(
label: Text('Base Unit Market Value'),
),
],
rows: state.landSubClassification.map((dataRow) {
return DataRow(
cells: [
DataCell(
Text(dataRow.id.toString() ?? 'N/A')),
DataCell(Text(dataRow.cityCode.toString() ??
'N/A')), // Use a default value if cityCode is null
DataCell(Text(dataRow.subclassDescription ??
'N/A')), // Use a default value if cityDescription is null
DataCell(
Text(dataRow.baseUnitMarketval ?? 'N/A')),
],
);
}).toList(),
),
)
],
),
),
),
)
]);
}
return Container();
},
),
);
}
}

View File

@ -0,0 +1,108 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:unit2/bloc/offline/offline_passo/admin/trees_improvements/trees_improvements_bloc.dart';
import 'package:unit2/sevices/offline/offline_passo/admin/api_services/trees_improvements_api_services.dart';
import 'package:unit2/theme-data.dart/colors.dart';
import '../../../../model/passo/trees_improvements.dart';
import '../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
class TreesImprovementsAdminPage extends StatefulWidget {
const TreesImprovementsAdminPage();
@override
_TreesImprovementsAdminPage createState() => _TreesImprovementsAdminPage();
}
class _TreesImprovementsAdminPage extends State<TreesImprovementsAdminPage> {
final items = [];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: primary,
title: const Text("Trees Improvement"),
centerTitle: true,
actions: [
TextButton(
style: TextButton.styleFrom(
textStyle: const TextStyle(fontSize: 15),
),
onPressed: () async {
try {
final result =
await TreesImprovementsAdminApiServices.instance.fetch();
// Assuming result is a List of JSON objects, convert them to City objects.
final treesImpr = result
.map((json) => TreesImprovements.fromJson(json))
.toList();
// Loop through the list of City objects and insert them into the local database.
for (TreesImprovements treesImprovements in treesImpr) {
await SQLServices.instance
.createTreesImprovements(treesImprovements);
}
} catch (e) {
// Handle any errors that might occur during the API call or database insertion.
print("Error: $e");
}
},
child: const Text('SYNC'),
),
],
),
body: BlocConsumer<TreesImprovementsBloc, TreesImprovementsState>(
listener: (context, state) {
// TODO: implement listener
},
builder: (context, state) {
if (state is TreesImprovementsLoaded) {
return Column(children: [
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.all(15.0),
child: Column(
children: [
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
// ignore: prefer_const_literals_to_create_immutables
columns: [
const DataColumn(
label: Text('ID'),
),
const DataColumn(
label: Text('Code'),
),
const DataColumn(
label: Text('Memoranda'),
),
],
rows: state.treesImprovements.map((dataRow) {
return DataRow(
cells: [
DataCell(Text(dataRow.id.toString() ??
'N/A')), // Use a default value if cityCode is null
DataCell(Text(dataRow.improvement ??
'N/A')), // Use a default value if cityDescription is null
DataCell(
Text(dataRow.pricePerTree ?? 'N/A')),
],
);
}).toList(),
),
)
],
),
),
),
)
]);
}
return Container();
},
));
}
}

View File

@ -0,0 +1,114 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:unit2/bloc/offline/offline_passo/admin/type_of_location/type_of_location_bloc.dart';
import 'package:unit2/sevices/offline/offline_passo/admin/api_services/type_of_location.dart';
import '../../../../model/passo/type_of_location.dart';
import '../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
import '../../../../theme-data.dart/colors.dart';
class TypesOfLocationAdminPage extends StatefulWidget {
const TypesOfLocationAdminPage();
@override
_TypesOfLocationAdminPage createState() => _TypesOfLocationAdminPage();
}
class _TypesOfLocationAdminPage extends State<TypesOfLocationAdminPage> {
final items = [];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: primary,
title: const Text("Type of Location"),
centerTitle: true,
actions: [
TextButton(
style: TextButton.styleFrom(
textStyle: const TextStyle(fontSize: 15),
),
onPressed: () async {
try {
final result =
await TypeOfLocationAdminApiServices.instance.fetch();
// Assuming result is a List of JSON objects, convert them to City objects.
final typesOfLoc = result
.map((json) => TypeOfLocation.fromJson(json))
.toList();
// Loop through the list of City objects and insert them into the local database.
for (TypeOfLocation typesOfLocation in typesOfLoc) {
await SQLServices.instance
.createTypeOfLocation(typesOfLocation);
}
} catch (e) {
// Handle any errors that might occur during the API call or database insertion.
print("Error: $e");
}
},
child: const Text('SYNC'),
),
],
),
body: BlocConsumer<TypeOfLocationBloc, TypeOfLocationState>(
listener: (context, state) {
// TODO: implement listener
},
builder: (context, state) {
if (state is TypeOfLocationLoaded) {
return Column(children: [
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.all(15.0),
child: Column(
children: [
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
// ignore: prefer_const_literals_to_create_immutables
columns: [
const DataColumn(
label: Text('ID'),
),
const DataColumn(
label: Text('Distance in KM'),
),
const DataColumn(
label: Text('Road Types'),
),
const DataColumn(
label: Text(
'Distance from Local Trading Center'),
),
],
rows: state.typeOfLocation.map((dataRow) {
return DataRow(
cells: [
DataCell(Text(dataRow.id.toString() ??
'N/A')), // Use a default value if cityCode is null
DataCell(Text(dataRow.distanceKm ??
'N/A')), // Use a default value if cityDescription is null
DataCell(
Text(dataRow.allRoadTypes ?? 'N/A')),
DataCell(Text(
dataRow.localTradingCenter ?? 'N/A')),
],
);
}).toList(),
),
)
],
),
),
),
)
]);
}
return Container();
},
));
}
}

View File

@ -0,0 +1,105 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:unit2/bloc/offline/offline_passo/admin/type_of_road/type_of_road_bloc.dart';
import 'package:unit2/sevices/offline/offline_passo/admin/api_services/type_of_road_api_services.dart';
import '../../../../model/passo/type_of_road.dart';
import '../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
import '../../../../theme-data.dart/colors.dart';
class TypesOfRoadAdminPage extends StatefulWidget {
const TypesOfRoadAdminPage();
@override
_TypesOfRoadAdminPage createState() => _TypesOfRoadAdminPage();
}
class _TypesOfRoadAdminPage extends State<TypesOfRoadAdminPage> {
final items = [];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: primary,
title: const Text("Type of Road"),
centerTitle: true,
actions: [
TextButton(
style: TextButton.styleFrom(
textStyle: const TextStyle(fontSize: 15),
),
onPressed: () async {
try {
final result =
await TypeOfRoadAdminApiServices.instance.fetch();
// Assuming result is a List of JSON objects, convert them to City objects.
final typesOfRoad =
result.map((json) => TypeOfRoad.fromJson(json)).toList();
// Loop through the list of City objects and insert them into the local database.
for (TypeOfRoad typesOfRoad in typesOfRoad) {
await SQLServices.instance.createTypeOfRoad(typesOfRoad);
}
} catch (e) {
// Handle any errors that might occur during the API call or database insertion.
print("Error: $e");
}
},
child: const Text('SYNC'),
),
],
),
body: BlocConsumer<TypeOfRoadBloc, TypeOfRoadState>(
listener: (context, state) {
// TODO: implement listener
},
builder: (context, state) {
if (state is TypeOfRoadLoaded) {
return Column(children: [
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.all(15.0),
child: Column(
children: [
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
// ignore: prefer_const_literals_to_create_immutables
columns: [
const DataColumn(
label: Text('ID'),
),
const DataColumn(
label: Text('Road Type'),
),
const DataColumn(
label: Text('Deduction'),
),
],
rows: state.typeOfRoad.map((dataRow) {
return DataRow(
cells: [
DataCell(Text(dataRow.id.toString() ??
'N/A')), // Use a default value if cityCode is null
DataCell(Text(dataRow.roadType ??
'N/A')), // Use a default value if cityDescription is null
DataCell(Text(dataRow.deduction ?? 'N/A')),
],
);
}).toList(),
),
)
],
),
),
),
)
]);
}
return Container();
},
));
}
}

View File

@ -0,0 +1,122 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:unit2/bloc/offline/offline_passo/admin/value_adjustments/value_adjustments_bloc.dart';
import 'package:unit2/sevices/offline/offline_passo/admin/api_services/value_adjustments.dart';
import '../../../../model/passo/land_value_adjustment.dart';
import '../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
import '../../../../theme-data.dart/colors.dart';
class ValueAdjustmentsAdminPage extends StatefulWidget {
const ValueAdjustmentsAdminPage();
@override
_ValueAdjustmentsAdminPage createState() => _ValueAdjustmentsAdminPage();
}
class _ValueAdjustmentsAdminPage extends State<ValueAdjustmentsAdminPage> {
final items = [];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: primary,
title: const Text("Value Adjustment"),
centerTitle: true,
actions: [
TextButton(
style: TextButton.styleFrom(
textStyle: const TextStyle(fontSize: 15),
),
onPressed: () async {
try {
final result =
await ValueAdjustmentsAdminApiServices.instance.fetch();
// Assuming result is a List of JSON objects, convert them to City objects.
final valueAdj = result
.map((json) => ValueAdjustments.fromJson(json))
.toList();
// Loop through the list of City objects and insert them into the local database.
for (ValueAdjustments valueAdjustments in valueAdj) {
await SQLServices.instance
.createValueAdjustments(valueAdjustments);
}
} catch (e) {
// Handle any errors that might occur during the API call or database insertion.
print("Error: $e");
}
},
child: const Text('SYNC'),
),
],
),
body: BlocConsumer<ValueAdjustmentsBloc, ValueAdjustmentsState>(
listener: (context, state) {
// TODO: implement listener
},
builder: (context, state) {
if (state is ValueAdjustmentsLoaded) {
return Column(children: [
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.all(15.0),
child: Column(
children: [
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
// ignore: prefer_const_literals_to_create_immutables
columns: [
const DataColumn(
label: Text('ID'),
),
const DataColumn(
label: Text('Base Market Value'),
),
const DataColumn(
label: Text('Adjustment Factor'),
),
const DataColumn(
label: Text('Adjustment'),
),
const DataColumn(
label: Text('Value Adjustment'),
),
const DataColumn(
label: Text('Market Value'),
),
],
rows: state.valueAdjustments.map((dataRow) {
return DataRow(
cells: [
DataCell(Text(dataRow.id.toString() ??
'N/A')), // Use a default value if cityCode is null
DataCell(Text(dataRow.baseMarketval ??
'N/A')), // Use a default value if cityDescription is null
DataCell(Text(
dataRow.adjustmentFactors ?? 'N/A')),
DataCell(Text(dataRow.adjustment ?? 'N/A')),
DataCell(
Text(dataRow.valueAdjustment ?? 'N/A')),
DataCell(
Text(dataRow.marketValue ?? 'N/A')),
],
);
}).toList(),
),
)
],
),
),
),
)
]);
}
return Container();
},
));
}
}

View File

@ -0,0 +1,368 @@
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:intl/intl.dart';
import 'package:searchfield/searchfield.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/building_and_structure/building_and_structure_bloc.dart';
import 'package:unit2/model/offline/offline_profile.dart';
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';
class AddBuildingAndStructureOffline extends StatefulWidget {
final OfflineProfile offlineProfile;
AddBuildingAndStructureOffline(this.offlineProfile);
@override
_AddBuildingAndStructureOffline createState() =>
_AddBuildingAndStructureOffline();
}
class _AddBuildingAndStructureOffline
extends State<AddBuildingAndStructureOffline> {
GlobalKey<FormBuilderState> formKey = GlobalKey<FormBuilderState>();
final focus = FocusNode();
final DateTime now;
final String formatter;
_AddBuildingAndStructureOffline()
: now = DateTime.now(),
formatter = DateFormat.yMMMMd('en_US').format(DateTime.now());
final actual_use = [
"Residential",
"Agricultural",
"Commercial",
"Industrial",
"Mineral",
"Timberland",
];
double _unitBase = 0;
String _structureType = "";
double _areaValue = 0;
double _depRate = 0;
double _totalMarketValue(unitBase, bldgArea) {
return unitBase * bldgArea;
}
double _amountofDepreciation(unitBase, area, depreciation) {
return (unitBase * area) * depreciation;
}
double _adjustedMarketValue(unitBase, area, depreciation) {
double marketVal = unitBase * area;
double depAmount = (unitBase * area) * depreciation;
return marketVal - depAmount;
}
@override
Widget build(BuildContext context) {
return BlocConsumer<BuildingAndStructureBloc, BuildingAndStructureState>(
listener: (context, state) {
// TODO: implement listener
},
builder: (context, state) {
print(state);
if (state is ShowBldgAndStructuresScreen) {
return BlocConsumer<UnitConstructionAdminBloc,
UnitConstructionAdminState>(
listener: (context, state) {
// TODO: implement listener
},
builder: (context, state) {
if (state is UnitConstructLoaded) {
return FormBuilder(
key: formKey,
onChanged: () {
formKey.currentState?.save();
},
autovalidateMode: AutovalidateMode.disabled,
child: Padding(
padding: const EdgeInsets.all(0.0),
child: Container(
height: 800,
child: SingleChildScrollView(
padding: const EdgeInsets.all(2.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
margin: const EdgeInsets.only(
left: 0, top: 10, right: 0, bottom: 0),
child: SizedBox(
height: 45,
child: SearchField(
itemHeight: 70,
suggestions: state.unit
.map((UnitConstruct unit) =>
SearchFieldListItem(
'${unit.bldgType} - ${unit.building}',
item: unit,
child: ListTile(
title: Text(
'${unit.bldgType} - ${unit.building!.toUpperCase()}',
overflow:
TextOverflow.ellipsis,
),
)))
.toList(),
validator: FormBuilderValidators.required(
errorText: "This field is required"),
searchInputDecoration:
normalTextFieldStyle("Structure Type", "")
.copyWith(
suffixIcon: const Icon(
Icons.arrow_drop_down)),
////agency suggestion tap
focusNode: focus,
suggestionState: Suggestion.expand,
onSuggestionTap: (unit) {
setState(() {
_unitBase =
double.parse(unit.item!.unitValue);
_structureType =
'${unit.item!.bldgType} - ${unit.item!.building}';
formKey.currentState!.patchValue(
{'unit_value': unit.item?.unitValue});
});
focus.unfocus();
},
),
),
),
const SizedBox(
height: 10,
),
customDropDownField(
"Actual Use", "", 'actual_use', actual_use),
const SizedBox(
height: 5,
),
const SizedBox(
height: 10,
),
Container(
child: FormBuilderTextField(
name: 'unit_value',
decoration:
normalTextFieldStyle("Unit Value", ""),
validator: FormBuilderValidators.compose([]),
onChanged: (value) {
// setState(() {
// _areaValue = int.parse(value!);
// });
},
),
),
SizedBox(
height: 10,
),
Row(
children: [
Expanded(
child: FormBuilderTextField(
name: 'dep_rate',
decoration: normalTextFieldStyle(
"Depreciation Rate", ""),
validator:
FormBuilderValidators.compose([]),
onChanged: (value) {
setState(() {
_depRate = double.parse(value!);
});
},
),
),
const SizedBox(
width: 5,
),
Expanded(
child: FormBuilderTextField(
name: 'bldg_area',
decoration:
normalTextFieldStyle("Area", ""),
validator:
FormBuilderValidators.compose([]),
onChanged: (value) {
setState(() {
_areaValue = double.parse(value!);
});
},
),
),
],
),
const SizedBox(height: 10),
const Text('Market Value'),
const SizedBox(height: 5),
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: Align(
alignment: Alignment.center,
child: Text(NumberFormat.currency(
locale: 'en-PH', symbol: "")
.format(_totalMarketValue(
_unitBase, _areaValue)))),
),
const SizedBox(height: 10),
const Text('Amount of Depreciation'),
const SizedBox(height: 5),
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: Align(
alignment: Alignment.center,
child: Text(NumberFormat.currency(
locale: 'en-PH', symbol: "")
.format(_amountofDepreciation(
_unitBase, _areaValue, _depRate)))),
),
const SizedBox(height: 10),
const Text('Adjusted Market Value'),
const SizedBox(height: 5),
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: Align(
alignment: Alignment.center,
child: Text(NumberFormat.currency(
locale: 'en-PH', symbol: "")
.format(_adjustedMarketValue(
_unitBase, _areaValue, _depRate)))),
),
const SizedBox(height: 10),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: 120,
height: 60,
padding: const EdgeInsets.all(8.0),
child: ElevatedButton(
onPressed: () async {
try {
final tempID = await SharedPreferences
.getInstance();
var bldgStructure = BldgAndStructure(
id: 1,
bldgapprDetailsId: tempID.getInt(
'tempid')!,
assessedById: widget
.offlineProfile.id
.toString(),
assessedByName: widget
.offlineProfile.firstName,
dateCreated: formatter,
dateModified: 'none',
bldgType: _structureType,
strucType: _structureType,
description: 'None',
actualUse: formKey.currentState
?.value['actual_use'],
floorCount: '1',
bldgArea: _areaValue.toString(),
unitValue: _unitBase.toString(),
depRate: _depRate.toString(),
marketValue: _totalMarketValue(
_unitBase,
_areaValue)
.toString(),
depAmount: _amountofDepreciation(
_unitBase,
_areaValue,
_depRate)
.toString(),
adjustedMarketValue:
_adjustedMarketValue(_unitBase,
_areaValue, _depRate)
.toString());
context
.read<BuildingAndStructureBloc>()
.add(AddBuildingAndStructure(
bldgAndStructure:
bldgStructure));
} catch (e) {
print(e);
}
},
style: ElevatedButton.styleFrom(
primary: Colors.black,
),
child: const Text("Submit"),
),
),
const SizedBox(
width:
5), // Use SizedBox for horizontal spacing in a Row
Container(
width: 120,
height: 60,
padding: const EdgeInsets.all(8.0),
child: ElevatedButton(
onPressed: () {
context
.read<BuildingAndStructureBloc>()
.add(
const LoadBuildingAndStructure());
},
style: ElevatedButton.styleFrom(
primary: Colors.black,
),
child: const Text("Cancel"),
),
),
],
)
],
),
),
),
),
);
}
return Container();
},
);
}
return Container();
},
);
}
}

View File

@ -9,6 +9,7 @@ import 'package:shared_preferences/shared_preferences.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/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';
@ -17,7 +18,8 @@ import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/error_state.dart';
class AddExtraItemsOffline extends StatefulWidget {
AddExtraItemsOffline();
final OfflineProfile offlineProfile;
AddExtraItemsOffline(this.offlineProfile);
@override
_AddExtraItemsOffline createState() => _AddExtraItemsOffline();
@ -30,7 +32,7 @@ class _AddExtraItemsOffline extends State<AddExtraItemsOffline> {
bool isSecondHand = false;
TextEditingController textEditingController = TextEditingController();
double _unitBase = 0;
int _areaValue = 0;
double _areaValue = 0;
final double _depValue = 0;
double _unitValue = 0;
String _className = "";
@ -40,6 +42,13 @@ class _AddExtraItemsOffline extends State<AddExtraItemsOffline> {
int _notPaintedUnitVal = 0;
int _secondHandUnitVal = 0;
final DateTime now;
final String formatter;
_AddExtraItemsOffline()
: now = DateTime.now(),
formatter = DateFormat.yMMMMd('en_US').format(DateTime.now());
BoxDecoration box1() {
return const BoxDecoration(boxShadow: [
BoxShadow(color: Colors.black12, spreadRadius: 5, blurRadius: 5)
@ -304,10 +313,22 @@ class _AddExtraItemsOffline extends State<AddExtraItemsOffline> {
suggestionState: Suggestion.expand,
onSuggestionTap: (unit) {
setState(() {
_unitBase = double.parse(
unit.item!.unitValue);
_structureType =
'${unit.item!.bldgType} - ${unit.item!.building}';
if (_withoutBUCC) {
_unitBase = double.parse(
unit.item!.unitValue);
_structureType =
'${unit.item!.bldgType} - ${unit.item!.building}';
} else {
_unitBase = double.parse(
unit.item!.unitValue);
_structureType =
'${unit.item!.bldgType} - ${unit.item!.building}';
formKey.currentState!
.patchValue({
'unitValue':
unit.item!.unitValue
});
}
});
focus.unfocus();
},
@ -364,7 +385,8 @@ class _AddExtraItemsOffline extends State<AddExtraItemsOffline> {
[]),
onChanged: (value) {
setState(() {
_areaValue = int.parse(value!);
_areaValue =
double.parse(value!);
});
},
),
@ -603,29 +625,33 @@ class _AddExtraItemsOffline extends State<AddExtraItemsOffline> {
await SharedPreferences
.getInstance();
context
.read<
AdditionalItemsOfflineBloc>()
.add(AddAdditionalItems(
context.read<AdditionalItemsOfflineBloc>().add(
AddAdditionalItems(
id: 1,
bldgapprDetailsId:
tempID
.getInt(
'tempid')!,
bldgapprDetailsId: tempID
.getInt('tempid')!,
classId: _classId,
assessedById: widget
.offlineProfile.id
.toString(),
assessedByName: widget
.offlineProfile
.firstName!,
dateCreated: formatter,
dateModified: 'None',
className: _className,
structType:
_structureType,
unitValue:
_withoutBUCC ==
true
_withoutBUCC == true
? 0
: _unitValue,
baseUnitValue:
_unitBase,
area: _areaValue,
marketValue:
(_unitValue * _unitBase) *
(_unitValue *
_unitBase) *
_areaValue,
depreciationRate:
_depValue,
@ -676,9 +702,11 @@ class _AddExtraItemsOffline extends State<AddExtraItemsOffline> {
padding: const EdgeInsets.all(8.0),
child: ElevatedButton(
onPressed: () {
// context
// .read<AdditionalItemsOfflineBloc>()
// .add(const LoadAdditionalItems());
context
.read<
AdditionalItemsOfflineBloc>()
.add(
const LoadAdditionalItems());
},
style: ElevatedButton.styleFrom(
primary: Colors.black,

View File

@ -2,6 +2,8 @@ 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: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/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';
@ -13,12 +15,14 @@ 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>();
class AddBuilding extends StatefulWidget {
Function triggerBlocEvent;
AddBuilding(this.triggerBlocEvent);
final OfflineProfile offlineProfile;
AddBuilding(this.triggerBlocEvent, this.offlineProfile);
@override
_AddBuilding createState() => _AddBuilding();
}
@ -27,6 +31,14 @@ class _AddBuilding extends State<AddBuilding> {
int activeStep = 0; // Initial step set to 5.
int upperBound = 6;
List<String> foundation = [];
List<String> column = [];
List<String> beam = [];
List<String> trussFraming = [];
List<String> roof = [];
List<String> flooring = [];
List<String> walls = [];
void PrevBtn() {
setState(() {
activeStep--;
@ -39,81 +51,160 @@ class _AddBuilding extends State<AddBuilding> {
});
}
void updateFoundation(List<String> updatedList) {
setState(() {
foundation = updatedList;
});
}
void updateColumn(List<String> updatedList) {
setState(() {
column = updatedList;
});
}
void updateBeam(List<String> updatedList) {
setState(() {
beam = updatedList;
});
}
void updateTrussFraming(List<String> updatedList) {
setState(() {
trussFraming = updatedList;
});
}
void updateRoof(List<String> updatedList) {
setState(() {
roof = updatedList;
});
}
void updateFlooring(List<String> updatedList) {
setState(() {
flooring = updatedList;
});
}
void updateWalls(List<String> updatedList) {
setState(() {
walls = updatedList;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: primary,
centerTitle: true,
title: const Text("Offline Building FAAS"),
print(widget.offlineProfile.toJson());
return WillPopScope(
onWillPop: () async {
confirmAlertWithCancel(
context,
onCloseTransaction,
() => null,
'Cancel transaction?',
"Are you sure you want to cancel this transaction?"); // Action to perform on back pressed
return false;
},
child: Scaffold(
appBar: AppBar(
backgroundColor: primary,
centerTitle: true,
title: const Text("Offline Building FAAS"),
),
body: Column(children: [
NumberStepper(
numbers: [1, 2, 3, 4, 5, 6, 7, 8],
stepPadding: 5,
activeStepColor: primary,
numberStyle: TextStyle(color: Colors.white),
lineColor: primary,
// activeStep property set to activeStep variable defined above.
activeStep: activeStep,
activeStepBorderColor: Colors.white,
activeStepBorderWidth: 1,
// This ensures step-tapping updates the activeStep.
onStepReached: (index) {
setState(() {
activeStep = index;
});
},
enableStepTapping: false,
),
Expanded(
child: StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return FormBuilder(
key: offlineBldgKey,
onChanged: () {
offlineBldgKey.currentState?.save();
},
autovalidateMode: AutovalidateMode.disabled,
child: Container(
child: content(PrevBtn, NextBtn),
),
);
}),
),
]),
),
body: Column(children: [
NumberStepper(
numbers: [1, 2, 3, 4, 5, 6, 7],
stepPadding: 5,
activeStepColor: primary,
numberStyle: TextStyle(color: Colors.white),
lineColor: primary,
// activeStep property set to activeStep variable defined above.
activeStep: activeStep,
activeStepBorderColor: Colors.white,
activeStepBorderWidth: 1,
// This ensures step-tapping updates the activeStep.
onStepReached: (index) {
setState(() {
activeStep = index;
});
},
enableStepTapping: false,
),
Expanded(
child: StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return FormBuilder(
key: offlineBldgKey,
onChanged: () {
offlineBldgKey.currentState?.save();
},
autovalidateMode: AutovalidateMode.disabled,
child: Container(
child: content(PrevBtn, NextBtn),
),
);
}),
),
]),
);
}
Widget content(PrevBtn, NextBtn) {
switch (activeStep) {
case 0:
return PropertyInfoOfflinePage(NextBtn);
return PropertyInfoOfflinePage(NextBtn, widget.offlineProfile);
case 1:
return LandRefLocationOfflinePage(PrevBtn, NextBtn);
return LandRefLocationOfflinePage(
PrevBtn, NextBtn, widget.offlineProfile);
case 2:
return GeneralDescriptionOfflinePage(NextBtn, PrevBtn);
return GeneralDescriptionOfflinePage(
NextBtn, PrevBtn, widget.offlineProfile);
case 3:
return StructuralMaterialsOfflinePage(PrevBtn, NextBtn);
return BuildingAndStructureOfflinePage(
PrevBtn, NextBtn, widget.offlineProfile);
case 4:
return AdditionalItemOfflinePage(PrevBtn, NextBtn);
return StatefulBuilder(
builder: (context, StateSetter setInnerState) =>
StructuralMaterialsOfflinePage(PrevBtn, NextBtn,
foundation: foundation,
column: column,
beam: beam,
trussFraming: trussFraming,
roof: roof,
flooring: flooring,
walls: walls,
updateFoundation: updateFoundation,
updateColumn: updateColumn,
updateBeam: updateBeam,
updateFlooring: updateFlooring,
updateRoof: updateRoof,
updateTrussFraming: updateTrussFraming,
updateWalls: updateWalls));
case 5:
return PropertyAppraisalOfflinePage(NextBtn, PrevBtn);
return AdditionalItemOfflinePage(
PrevBtn, NextBtn, widget.offlineProfile);
case 6:
return PropertyAssessmentOfflinePage(onSAveAll);
return PropertyAppraisalOfflinePage(
NextBtn, PrevBtn, widget.offlineProfile);
case 7:
return PropertyAssessmentOfflinePage(
onCloseTransaction, widget.offlineProfile);
default:
return Text("Property Info");
}
}
void onSAveAll() {
void onCloseTransaction() {
Navigator.of(context).pop();
widget.triggerBlocEvent();
}

View File

@ -2,16 +2,19 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:intl/intl.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/screens/offline/passo/building/add/AddExtraItemsOffline.dart';
import '../../../../../utils/alerts.dart';
import '../../../../../widgets/passo/custom_button.dart';
class AdditionalItemOfflinePage extends StatefulWidget {
final VoidCallback additionalItemsPrevBtn;
final VoidCallback additionalItemsNextBtn;
final OfflineProfile offlineProfile;
const AdditionalItemOfflinePage(
this.additionalItemsPrevBtn, this.additionalItemsNextBtn);
const AdditionalItemOfflinePage(this.additionalItemsPrevBtn,
this.additionalItemsNextBtn, this.offlineProfile);
@override
_AdditionalItemOfflinePage createState() => _AdditionalItemOfflinePage();
@ -22,12 +25,18 @@ class _AdditionalItemOfflinePage extends State<AdditionalItemOfflinePage> {
// context.read<AdditionalItemBloc>().add(DeleteAdditionalItems(id: itemId));
// }
void deleteItem(int itemId) {
context
.read<AdditionalItemsOfflineBloc>()
.add(DeleteAdditionalItems(id: itemId));
}
final items = [];
double _totalMarketValue(items) {
double total = 0;
items.forEach((row) {
total += double.parse(row.adjustedMarketVal);
total += row.adjustedMarketVal;
});
return total;
}
@ -155,11 +164,17 @@ class _AdditionalItemOfflinePage extends State<AdditionalItemOfflinePage> {
return DataRow(
cells: [
DataCell(Text(dataRow.className)),
DataCell(
Text(dataRow.baseUnitValue.toString())),
DataCell(Text(NumberFormat.currency(
locale: 'en-PH',
symbol: "",
).format(dataRow.baseUnitValue).toString())),
DataCell(Text(dataRow.unitValue.toString())),
DataCell(Text(((double.parse(
dataRow.adjustedMarketVal.toString())))
DataCell(Text(NumberFormat.currency(
locale: 'en-PH',
symbol: "",
)
.format(((double.parse(
dataRow.adjustedMarketVal.toString()))))
.toString())),
DataCell(Row(
children: [
@ -178,28 +193,14 @@ class _AdditionalItemOfflinePage extends State<AdditionalItemOfflinePage> {
),
),
onTap: () {
// deleteItem(dataRow.id);
confirmAlertWithCancel(
context,
() => deleteItem(dataRow.id!),
() => null,
'Delete Item?',
"Are you sure you want to delete this item?");
},
),
const SizedBox(
width: 10,
),
InkWell(
child: Container(
height: 30,
width: 30,
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: const Icon(
Icons.edit,
color: Colors.white,
size: 20.0,
),
),
onTap: () {},
),
],
))
],
@ -217,15 +218,15 @@ class _AdditionalItemOfflinePage extends State<AdditionalItemOfflinePage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
'Total',
'Total Market Value',
style:
TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
TextStyle(fontWeight: FontWeight.bold, fontSize: 17),
),
Text(
NumberFormat.currency(locale: 'en-PH', symbol: "")
.format(_totalMarketValue(items)),
.format(_totalMarketValue(state.addItem)),
style:
TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
TextStyle(fontWeight: FontWeight.bold, fontSize: 17),
)
],
),
@ -261,6 +262,19 @@ class _AdditionalItemOfflinePage extends State<AdditionalItemOfflinePage> {
],
);
}
if (state is AdditionalItemsDeletedState) {
if (state.success) {
WidgetsBinding.instance.addPostFrameCallback((_) {
successAlert(context, "Deletion Successful",
"Extra item has been deleted successfully", () {
Navigator.of(context).pop();
context
.read<AdditionalItemsOfflineBloc>()
.add(LoadAdditionalItems());
});
});
}
}
if (state is ShowAddItemsScreen) {
return ConstrainedBox(
constraints: BoxConstraints(maxHeight: 1000.0),
@ -276,7 +290,9 @@ class _AdditionalItemOfflinePage extends State<AdditionalItemOfflinePage> {
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [Expanded(child: AddExtraItemsOffline())],
children: [
Expanded(child: AddExtraItemsOffline(widget.offlineProfile))
],
),
),
);

View File

@ -0,0 +1,336 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:intl/intl.dart';
import 'package:unit2/bloc/offline/offline_passo/building/building_and_structure/building_and_structure_bloc.dart';
import 'package:unit2/model/offline/offline_profile.dart';
import 'package:unit2/screens/offline/passo/building/add/AddBuildingAndStructure..dart';
import '../../../../../utils/alerts.dart';
import '../../../../../widgets/passo/custom_button.dart';
class BuildingAndStructureOfflinePage extends StatefulWidget {
final VoidCallback additionalItemsPrevBtn;
final VoidCallback additionalItemsNextBtn;
final OfflineProfile offlineProfile;
const BuildingAndStructureOfflinePage(this.additionalItemsPrevBtn,
this.additionalItemsNextBtn, this.offlineProfile);
@override
_BuildingAndStructureOfflinePage createState() =>
_BuildingAndStructureOfflinePage();
}
class _BuildingAndStructureOfflinePage
extends State<BuildingAndStructureOfflinePage> {
// void deleteItem(int itemId) {
// context.read<AdditionalItemBloc>().add(DeleteAdditionalItems(id: itemId));
// }
void deleteItem(int itemId) {
context
.read<BuildingAndStructureBloc>()
.add(DeleteBuildingAndStructure(id: itemId));
}
final items = [];
double _totalMarketValue(items) {
double total = 0;
items.forEach((row) {
total += double.parse(row.adjustedMarketValue);
});
return total;
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: BlocConsumer<BuildingAndStructureBloc, BuildingAndStructureState>(
listener: (context, state) {
// TODO: implement listener
},
builder: (context, state) {
if (state is BuildingAndStructureOfflineInitial) {
return Column(children: [
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Column(children: [
Container(
margin: const EdgeInsets.only(
left: 0, top: 20, right: 0, bottom: 10),
child: const Text('BUILDING AND STRUCTURE',
style: TextStyle(
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 NEW'), // <-- Text
SizedBox(
width: 5,
),
Icon(
// <-- Icon
Icons.add,
size: 24.0,
),
],
),
),
)
]))))
]);
}
if (state is BuildingAndStructureLoaded) {
return Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
children: [
Container(
margin: const EdgeInsets.only(
left: 0, top: 20, right: 0, bottom: 10),
child: const Text('BUILDING AND STRUCTURES',
style: TextStyle(
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,
),
Icon(
// <-- Icon
Icons.add,
size: 24.0,
),
],
),
),
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
// ignore: prefer_const_literals_to_create_immutables
columns: [
const DataColumn(
label: Text('Building Core'),
),
const DataColumn(
label: Text('Type'),
),
const DataColumn(
label: Text('Area'),
),
const DataColumn(
label: Text('Unit Value'),
),
const DataColumn(
label: Text('% of BUCC'),
),
const DataColumn(
label: Text('Base Market Value'),
),
const DataColumn(
label: Text('% of Depreciation'),
),
const DataColumn(
label: Text('Depreciation Cost'),
),
const DataColumn(
label: Text('Market Value'),
),
const DataColumn(
label: Text('Action'),
)
],
rows: state.bldgAndStructure.map((dataRow) {
return DataRow(
cells: [
DataCell(Text(dataRow.actualUse!)),
DataCell(Text(dataRow.bldgType!)),
DataCell(Text(dataRow.bldgArea!)),
DataCell(Text(
NumberFormat.currency(
locale: 'en-PH', symbol: "")
.format(double.parse(dataRow.unitValue!)),
)),
const DataCell(Text("100%")),
DataCell(Text(
NumberFormat.currency(
locale: 'en-PH', symbol: "")
.format(
double.parse(dataRow.marketValue!)),
)),
DataCell(Text(dataRow.depRate!)),
DataCell(Text(
NumberFormat.currency(
locale: 'en-PH', symbol: "")
.format(double.parse(dataRow.depAmount!)),
)),
DataCell(Text(
NumberFormat.currency(
locale: 'en-PH', symbol: "")
.format(double.parse(
dataRow.adjustedMarketValue!)),
)),
DataCell(Row(
children: [
InkWell(
child: Container(
height: 30,
width: 30,
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: const Icon(
Icons.delete,
color: Colors.white,
size: 20.0,
),
),
onTap: () {
confirmAlertWithCancel(
context,
() => deleteItem(dataRow.id!),
() => null,
'Delete Item?',
"Are you sure you want to delete this item?");
},
),
],
))
],
);
}).toList(),
),
)
],
),
),
)),
Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
'Total Market Value',
style:
TextStyle(fontWeight: FontWeight.bold, fontSize: 17),
),
Text(
NumberFormat.currency(locale: 'en-PH', symbol: "")
.format(_totalMarketValue(state.bldgAndStructure)),
style:
TextStyle(fontWeight: FontWeight.bold, fontSize: 17),
)
],
),
),
Padding(
padding: const EdgeInsets.all(15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
CustomButton(
icon: const Icon(Icons.chevron_left_rounded,
color: Colors.white),
onPressed: () {
{
widget.additionalItemsPrevBtn();
}
;
},
),
CustomButton(
icon: const Icon(Icons.chevron_right_rounded,
color: Colors.white),
onPressed: () {
{
widget.additionalItemsNextBtn();
}
;
},
)
],
),
),
],
);
}
if (state is BuildingAndStructureDeletedState) {
if (state.success) {
WidgetsBinding.instance.addPostFrameCallback((_) {
successAlert(context, "Deletion Successful",
"Extra item has been deleted successfully", () {
Navigator.of(context).pop();
context
.read<BuildingAndStructureBloc>()
.add(LoadBuildingAndStructure());
});
});
}
}
if (state is ShowBldgAndStructuresScreen) {
return ConstrainedBox(
constraints: BoxConstraints(maxHeight: 1000.0),
child: AlertDialog(
insetPadding: const EdgeInsets.symmetric(
horizontal: 10.0,
vertical: 10.0,
),
title: const Text(
'ADD NEW BLDG & STRUCTURE',
textAlign: TextAlign.center,
),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child:
AddBuildingAndStructureOffline(widget.offlineProfile))
],
),
),
);
}
return Container();
},
));
}
}

View File

@ -6,6 +6,7 @@ import 'package:fluttertoast/fluttertoast.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/model/offline/offline_profile.dart';
import 'package:unit2/screens/offline/passo/building/add/add_building.dart';
import 'package:unit2/screens/passo/Building/add_building_components/general_description.dart';
@ -13,13 +14,15 @@ import '../../../../../model/passo/general_description.dart';
import '../../../../../theme-data.dart/form-style.dart';
import '../../../../../widgets/passo/custom_button.dart';
import '../../../../../widgets/passo/custom_formBuilder_fields.dart';
import 'package:intl/intl.dart';
class GeneralDescriptionOfflinePage extends StatefulWidget {
final VoidCallback onPutGeneralDescription;
final VoidCallback gendescPrevBtn;
final OfflineProfile offlineProfile;
GeneralDescriptionOfflinePage(
this.onPutGeneralDescription, this.gendescPrevBtn);
this.onPutGeneralDescription, this.gendescPrevBtn, this.offlineProfile);
@override
_GeneralDescriptionOfflinePage createState() =>
@ -37,6 +40,13 @@ class _GeneralDescriptionOfflinePage
"Timberland",
];
final DateTime now;
final String formatter;
_GeneralDescriptionOfflinePage()
: now = DateTime.now(),
formatter = DateFormat.yMMMMd('en_US').format(DateTime.now());
@override
Widget build(BuildContext context) {
return BlocConsumer<UnitConstructionAdminBloc, UnitConstructionAdminState>(
@ -88,12 +98,16 @@ class _GeneralDescriptionOfflinePage
// optional flex property if flex is 1 because the default flex is 1
flex: 1,
child: customDatTimePicker(
"Certificate of Occupancy Issued ON",
"",
'date_issued'))
"Date Issued", "", 'date_issued'))
]),
customTextField(
"Condominium Certificate of Title (CCT)", "", 'cct'),
Container(
margin: const EdgeInsets.only(
left: 0, top: 20, right: 0, bottom: 10),
child: const Text('Condominium Certificate of Title (CCT)',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 15),
textAlign: TextAlign.start),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
@ -201,18 +215,21 @@ class _GeneralDescriptionOfflinePage
context.read<GeneralDescriptionBloc>().add(AddGendesc(
id: 1,
bldgapprDetailsId: tempID.getInt('tempid')!,
assessedById: '1',
assessedByName: 'cyril',
assessedById:
widget.offlineProfile.id.toString(),
assessedByName:
widget.offlineProfile.firstName!,
dateCreated: formatter,
dateModified: 'None',
bldgKind: offlineBldgKey
.currentState?.value['bldg_type'].building,
strucType: offlineBldgKey
.currentState?.value['bldg_type'].bldgType,
bldgPermit: offlineBldgKey
.currentState?.value['bldg_permit'],
dateIssued: offlineBldgKey
.currentState!.value['coc_issued']
dateIssued: offlineBldgKey.currentState!.value['coc_issued']
.toString(),
cct: offlineBldgKey.currentState?.value['cct'],
cct: 'None',
certCompletionIssued: offlineBldgKey
.currentState!.value['coc_issued']
.toString(),
@ -233,7 +250,9 @@ class _GeneralDescriptionOfflinePage
area4Thfloor: '0',
totalFloorArea: offlineBldgKey.currentState?.value['total_area'],
floorSketch: null,
actualUse: offlineBldgKey.currentState?.value['actual_use']));
actualUse: offlineBldgKey.currentState?.value['actual_use'],
unitValue: offlineBldgKey.currentState?.value['bldg_type'].unitValue));
widget.onPutGeneralDescription();
}
;
},

View File

@ -7,6 +7,7 @@ import 'package:unit2/bloc/offline/offline_passo/admin/barangay_admin/barangay_a
import 'package:unit2/bloc/offline/offline_passo/admin/municipalities_admin/municipalities_admin_bloc.dart';
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/model/offline/offline_profile.dart';
import 'package:unit2/screens/offline/passo/building/add/add_building.dart';
import '../../../../../model/passo/barangay.dart';
@ -14,18 +15,27 @@ import '../../../../../model/passo/city.dart';
import '../../../../../theme-data.dart/form-style.dart';
import '../../../../../widgets/passo/custom_button.dart';
import '../../../../../widgets/passo/custom_formBuilder_fields.dart';
import 'package:intl/intl.dart';
class LandRefLocationOfflinePage extends StatefulWidget {
final VoidCallback PrevBtn;
final VoidCallback NextBtn;
final OfflineProfile offlineProfile;
LandRefLocationOfflinePage(this.PrevBtn, this.NextBtn);
LandRefLocationOfflinePage(this.PrevBtn, this.NextBtn, this.offlineProfile);
@override
_LandRefLocationOfflinePage createState() => _LandRefLocationOfflinePage();
}
class _LandRefLocationOfflinePage extends State<LandRefLocationOfflinePage> {
final DateTime now;
final String formatter;
_LandRefLocationOfflinePage()
: now = DateTime.now(),
formatter = DateFormat.yMMMMd('en_US').format(DateTime.now());
@override
Widget build(BuildContext context) {
return BlocConsumer<MunicipalitiesAdminBloc, MunicipalitiesAdminState>(
@ -271,8 +281,12 @@ class _LandRefLocationOfflinePage extends State<LandRefLocationOfflinePage> {
id: 1,
bldgapprDetailsId:
tempID.getInt('tempid')!,
assessedById: 'cyril',
assessedByName: 'cyril',
assessedById:
widget.offlineProfile.id.toString(),
assessedByName:
widget.offlineProfile.firstName!,
dateCreated: 'None',
dateModified: 'NOne',
street: offlineBldgKey
.currentState?.value['street'],
barangay: offlineBldgKey
@ -289,8 +303,12 @@ class _LandRefLocationOfflinePage extends State<LandRefLocationOfflinePage> {
id: 1,
bldgapprDetailsId:
tempID.getInt('tempid')!,
assessedById: '1',
assessedByName: 'cyril',
assessedById:
widget.offlineProfile.id.toString(),
assessedByName:
widget.offlineProfile.firstName!,
dateCreated: 'None',
dateModified: 'None',
owner: offlineBldgKey
.currentState?.value['l_owner'],
cloaNo: offlineBldgKey.currentState
@ -306,6 +324,8 @@ class _LandRefLocationOfflinePage extends State<LandRefLocationOfflinePage> {
blkNo: offlineBldgKey
.currentState?.value['blk_no'],
));
widget.NextBtn();
},
);
})

Some files were not shown because too many files have changed in this diff Show More