Compare commits
21 Commits
d7324e34f1
...
a8f7fc8d7c
Author | SHA1 | Date |
---|---|---|
cyzoox | a8f7fc8d7c | |
cyzoox | 5b1752b813 | |
cyzoox | 8204c1fbdf | |
superadmin | 66bd74118d | |
PGAN-MIS | 71c8f306b5 | |
PGAN-MIS | e445c255d9 | |
PGAN-MIS | fe88c5d656 | |
cyrilaquismundo | 5a17258c82 | |
cyzoox | 0b031dd545 | |
cyzoox | c9372f8e50 | |
unknown | b1ea70b9ab | |
unknown | 8dc0529646 | |
unknown | ebb04ad358 | |
PGAN-MIS | f9fd714fa6 | |
rodolfobacuinjr | 65794bf922 | |
PGAN-MIS | deeca18962 | |
PGAN-MIS | ba89592496 | |
PGAN-MIS | 1cc2a70a7f | |
superadmin | 73993f7371 | |
PGAN-MIS | dcfb1ca1a3 | |
PGAN-MIS | fdd2354320 |
|
@ -31,6 +31,7 @@ migrate_working_dir/
|
||||||
.pub-cache/
|
.pub-cache/
|
||||||
.pub/
|
.pub/
|
||||||
/build/
|
/build/
|
||||||
|
pubspeck.lock
|
||||||
|
|
||||||
# Symbolication related
|
# Symbolication related
|
||||||
app.*.symbols
|
app.*.symbols
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 265 KiB |
|
@ -0,0 +1,28 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/utils/global.dart';
|
||||||
|
|
||||||
|
import '../../../model/offline/offlane_modules.dart';
|
||||||
|
import '../../../model/offline/offline_profile.dart';
|
||||||
|
|
||||||
|
part 'offline_event.dart';
|
||||||
|
part 'offline_state.dart';
|
||||||
|
|
||||||
|
class OfflineBloc extends Bloc<OfflineEvent, OfflineState> {
|
||||||
|
OfflineBloc() : super(OfflineInitial()) {
|
||||||
|
on<SwitchOffline>((event, emit) async {
|
||||||
|
try {
|
||||||
|
List<dynamic> modules = await OFFLINE!.get('modules');
|
||||||
|
List<OfflineModules> offlineModules = [];
|
||||||
|
for (var module in modules) {
|
||||||
|
offlineModules.add(module);
|
||||||
|
}
|
||||||
|
OfflineProfile offlineProfile = await OFFLINE!.get('offline_profile');
|
||||||
|
emit(OfflineModeState(
|
||||||
|
offlineModules: offlineModules, offlineProfile: offlineProfile));
|
||||||
|
} catch (e) {
|
||||||
|
emit(OfflineErrorState(message: e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
part of 'offline_bloc.dart';
|
||||||
|
|
||||||
|
class OfflineEvent extends Equatable {
|
||||||
|
const OfflineEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class SwitchOffline extends OfflineEvent {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
part of 'offline_bloc.dart';
|
||||||
|
|
||||||
|
class OfflineState extends Equatable {
|
||||||
|
const OfflineState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class OfflineInitial extends OfflineState {}
|
||||||
|
|
||||||
|
class OfflineModeState extends OfflineState {
|
||||||
|
final OfflineProfile offlineProfile;
|
||||||
|
final List<OfflineModules> offlineModules;
|
||||||
|
const OfflineModeState(
|
||||||
|
{required this.offlineModules, required this.offlineProfile});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [offlineProfile, offlineModules];
|
||||||
|
}
|
||||||
|
|
||||||
|
class OfflineLoadingState extends OfflineState {}
|
||||||
|
|
||||||
|
class OfflineErrorState extends OfflineState {
|
||||||
|
final String message;
|
||||||
|
const OfflineErrorState({required this.message});
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
|
||||||
|
import '../../../../../model/passo/barangay.dart';
|
||||||
|
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
|
||||||
|
part 'barangay_admin_event.dart';
|
||||||
|
part 'barangay_admin_state.dart';
|
||||||
|
|
||||||
|
class BarangayAdminBloc extends Bloc<BarangayAdminEvent, BarangayAdminState> {
|
||||||
|
BarangayAdminBloc() : super(BarangayAdminInitial()) {
|
||||||
|
List<Brgy> brgy = [];
|
||||||
|
on<LoadBarangay>((event, emit) async {
|
||||||
|
brgy = await SQLServices.instance.readAllBarangay();
|
||||||
|
|
||||||
|
emit(BarangayLoaded(brgy: brgy));
|
||||||
|
});
|
||||||
|
on<LoadBarangayInMunicipality>((event, emit) async {
|
||||||
|
brgy = await SQLServices.instance
|
||||||
|
.readBrgyInSelectedMunicipality(event.cityCode);
|
||||||
|
|
||||||
|
emit(BarangayLoaded(brgy: brgy));
|
||||||
|
});
|
||||||
|
on<AddBarangay>((event, emit) async {
|
||||||
|
await SQLServices.instance.createBarangay(
|
||||||
|
Brgy(
|
||||||
|
id: event.id,
|
||||||
|
barangayId: event.barangayId,
|
||||||
|
barangayCode: event.barangayCode,
|
||||||
|
cityCode: event.cityCode,
|
||||||
|
barangayDescription: event.barangayDescription),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
part of 'barangay_admin_bloc.dart';
|
||||||
|
|
||||||
|
class BarangayAdminEvent extends Equatable {
|
||||||
|
const BarangayAdminEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddBarangay extends BarangayAdminEvent {
|
||||||
|
final int id;
|
||||||
|
final int barangayId;
|
||||||
|
final String barangayCode;
|
||||||
|
final String cityCode;
|
||||||
|
final String barangayDescription;
|
||||||
|
|
||||||
|
const AddBarangay({
|
||||||
|
required this.id,
|
||||||
|
required this.barangayId,
|
||||||
|
required this.barangayCode,
|
||||||
|
required this.cityCode,
|
||||||
|
required this.barangayDescription,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
id,
|
||||||
|
barangayId,
|
||||||
|
barangayCode,
|
||||||
|
cityCode,
|
||||||
|
barangayDescription,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadBarangay extends BarangayAdminEvent {
|
||||||
|
const LoadBarangay();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadBarangayInMunicipality extends BarangayAdminEvent {
|
||||||
|
final String cityCode;
|
||||||
|
const LoadBarangayInMunicipality({required this.cityCode});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [cityCode];
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
part of 'barangay_admin_bloc.dart';
|
||||||
|
|
||||||
|
class BarangayAdminState extends Equatable {
|
||||||
|
const BarangayAdminState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class BarangayAdminInitial extends BarangayAdminState {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class BarangayLoaded extends BarangayAdminState {
|
||||||
|
final List<Brgy> brgy;
|
||||||
|
|
||||||
|
const BarangayLoaded({required this.brgy});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [brgy];
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
|
||||||
|
import '../../../../../model/passo/class_components _offline.dart';
|
||||||
|
import '../../../../../model/passo/class_components.dart';
|
||||||
|
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
|
||||||
|
part 'class_components_admin_event.dart';
|
||||||
|
part 'class_components_admin_state.dart';
|
||||||
|
|
||||||
|
class ClassComponentsAdminBloc
|
||||||
|
extends Bloc<ClassComponentsAdminEvent, ClassComponentsAdminState> {
|
||||||
|
ClassComponentsAdminBloc() : super(ClassComponentsAdminInitial()) {
|
||||||
|
List<ClassComponentsOffline> classes = [];
|
||||||
|
on<LoadClassComponents>((event, emit) async {
|
||||||
|
classes = await SQLServices.instance.readAllClassComponents();
|
||||||
|
|
||||||
|
emit(ClassComponentsAdminLoaded(classes: classes));
|
||||||
|
});
|
||||||
|
on<AddClassComponents>((event, emit) async {
|
||||||
|
await SQLServices.instance.createClassComponents(
|
||||||
|
ClassComponentsOffline(
|
||||||
|
componentName: event.componentName,
|
||||||
|
minBaseUnitvalPercent: event.minBaseUnitvalPercent,
|
||||||
|
maxBaseUnitvalPercent: event.maxBaseUnitvalPercent,
|
||||||
|
minUnitvalSqrmtr: event.minUnitvalSqrmtr,
|
||||||
|
maxUnitvalSqrmtr: event.maxUnitvalSqrmtr,
|
||||||
|
minAddBaseunitval: event.minAddBaseunitval,
|
||||||
|
maxAddBaseunitval: event.maxAddBaseunitval,
|
||||||
|
minDeductBaserate: event.minDeductBaserate,
|
||||||
|
maxDeductBaserate: event.maxDeductBaserate,
|
||||||
|
minLinearMeter: event.minLinearMeter,
|
||||||
|
maxLinearMeter: event.maxLinearMeter,
|
||||||
|
minSpacing: event.minSpacing,
|
||||||
|
maxSpacing: event.maxSpacing,
|
||||||
|
roughFinish: event.roughFinish,
|
||||||
|
highFinish: event.highFinish,
|
||||||
|
withoutBucc: event.withoutBucc),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
part of 'class_components_admin_bloc.dart';
|
||||||
|
|
||||||
|
class ClassComponentsAdminEvent extends Equatable {
|
||||||
|
const ClassComponentsAdminEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddClassComponents extends ClassComponentsAdminEvent {
|
||||||
|
final String componentName;
|
||||||
|
final String minBaseUnitvalPercent;
|
||||||
|
final String maxBaseUnitvalPercent;
|
||||||
|
final String minUnitvalSqrmtr;
|
||||||
|
final String maxUnitvalSqrmtr;
|
||||||
|
final String minAddBaseunitval;
|
||||||
|
final String maxAddBaseunitval;
|
||||||
|
final String minDeductBaserate;
|
||||||
|
final String maxDeductBaserate;
|
||||||
|
final String minLinearMeter;
|
||||||
|
final String maxLinearMeter;
|
||||||
|
final String minSpacing;
|
||||||
|
final String maxSpacing;
|
||||||
|
final String roughFinish;
|
||||||
|
final String highFinish;
|
||||||
|
final int withoutBucc;
|
||||||
|
|
||||||
|
const AddClassComponents({
|
||||||
|
required this.componentName,
|
||||||
|
required this.minBaseUnitvalPercent,
|
||||||
|
required this.maxBaseUnitvalPercent,
|
||||||
|
required this.minUnitvalSqrmtr,
|
||||||
|
required this.maxUnitvalSqrmtr,
|
||||||
|
required this.minAddBaseunitval,
|
||||||
|
required this.maxAddBaseunitval,
|
||||||
|
required this.minDeductBaserate,
|
||||||
|
required this.maxDeductBaserate,
|
||||||
|
required this.minLinearMeter,
|
||||||
|
required this.maxLinearMeter,
|
||||||
|
required this.minSpacing,
|
||||||
|
required this.maxSpacing,
|
||||||
|
required this.roughFinish,
|
||||||
|
required this.highFinish,
|
||||||
|
required this.withoutBucc,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
componentName,
|
||||||
|
minBaseUnitvalPercent,
|
||||||
|
maxBaseUnitvalPercent,
|
||||||
|
minUnitvalSqrmtr,
|
||||||
|
maxUnitvalSqrmtr,
|
||||||
|
minAddBaseunitval,
|
||||||
|
maxAddBaseunitval,
|
||||||
|
minDeductBaserate,
|
||||||
|
maxDeductBaserate,
|
||||||
|
minLinearMeter,
|
||||||
|
maxLinearMeter,
|
||||||
|
minSpacing,
|
||||||
|
maxSpacing,
|
||||||
|
roughFinish,
|
||||||
|
highFinish,
|
||||||
|
withoutBucc,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadClassComponents extends ClassComponentsAdminEvent {
|
||||||
|
const LoadClassComponents();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
part of 'class_components_admin_bloc.dart';
|
||||||
|
|
||||||
|
class ClassComponentsAdminState extends Equatable {
|
||||||
|
const ClassComponentsAdminState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class ClassComponentsAdminInitial extends ClassComponentsAdminState {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class ClassComponentsAdminLoaded extends ClassComponentsAdminState {
|
||||||
|
final List<ClassComponentsOffline> classes;
|
||||||
|
|
||||||
|
const ClassComponentsAdminLoaded({required this.classes});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [classes];
|
||||||
|
}
|
|
@ -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));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 => [];
|
||||||
|
}
|
|
@ -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];
|
||||||
|
}
|
|
@ -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));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -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];
|
||||||
|
}
|
|
@ -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];
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/memoranda.dart';
|
||||||
|
|
||||||
|
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
|
||||||
|
part 'memoranda_admin_event.dart';
|
||||||
|
part 'memoranda_admin_state.dart';
|
||||||
|
|
||||||
|
class MemorandaAdminBloc
|
||||||
|
extends Bloc<MemorandaAdminEvent, MemorandaAdminState> {
|
||||||
|
MemorandaAdminBloc() : super(MemorandaAdminInitial()) {
|
||||||
|
List<Memoranda> memo = [];
|
||||||
|
on<LoadMemoranda>((event, emit) async {
|
||||||
|
memo = await SQLServices.instance.readAllMemoranda();
|
||||||
|
|
||||||
|
emit(MemorandaLoaded(memo: memo));
|
||||||
|
});
|
||||||
|
on<AddMemoranda>((event, emit) async {
|
||||||
|
await SQLServices.instance.createMemoranda(Memoranda(
|
||||||
|
id: event.id,
|
||||||
|
code: event.code,
|
||||||
|
memoranda: event.memoranda,
|
||||||
|
));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
part of 'memoranda_admin_bloc.dart';
|
||||||
|
|
||||||
|
class MemorandaAdminEvent extends Equatable {
|
||||||
|
const MemorandaAdminEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddMemoranda extends MemorandaAdminEvent {
|
||||||
|
final int id;
|
||||||
|
final String code;
|
||||||
|
final String memoranda;
|
||||||
|
|
||||||
|
const AddMemoranda({
|
||||||
|
required this.id,
|
||||||
|
required this.code,
|
||||||
|
required this.memoranda,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
id,
|
||||||
|
code,
|
||||||
|
memoranda,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadMemoranda extends MemorandaAdminEvent {
|
||||||
|
const LoadMemoranda();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
part of 'memoranda_admin_bloc.dart';
|
||||||
|
|
||||||
|
class MemorandaAdminState extends Equatable {
|
||||||
|
const MemorandaAdminState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class MemorandaAdminInitial extends MemorandaAdminState {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class MemorandaLoaded extends MemorandaAdminState {
|
||||||
|
final List<Memoranda> memo;
|
||||||
|
|
||||||
|
const MemorandaLoaded({required this.memo});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [memo];
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/city.dart';
|
||||||
|
import 'package:unit2/sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
|
||||||
|
part 'municipalities_admin_event.dart';
|
||||||
|
part 'municipalities_admin_state.dart';
|
||||||
|
|
||||||
|
class MunicipalitiesAdminBloc
|
||||||
|
extends Bloc<MunicipalitiesAdminEvent, MunicipalitiesAdminState> {
|
||||||
|
MunicipalitiesAdminBloc() : super(MunicipalitiesAdminInitial()) {
|
||||||
|
List<City> city = [];
|
||||||
|
on<LoadMunicipalities>((event, emit) async {
|
||||||
|
city = await SQLServices.instance.readAllMunicipalities();
|
||||||
|
|
||||||
|
emit(MunicipalitiesLoaded(city: city));
|
||||||
|
});
|
||||||
|
on<AddMunicipality>((event, emit) async {
|
||||||
|
await SQLServices.instance.createMunicipalities(
|
||||||
|
City(
|
||||||
|
id: event.id,
|
||||||
|
cityCode: event.cityCode,
|
||||||
|
cityDescription: event.cityDescription,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
part of 'municipalities_admin_bloc.dart';
|
||||||
|
|
||||||
|
class MunicipalitiesAdminEvent extends Equatable {
|
||||||
|
const MunicipalitiesAdminEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddMunicipality extends MunicipalitiesAdminEvent {
|
||||||
|
final int id;
|
||||||
|
final String cityCode;
|
||||||
|
final String cityDescription;
|
||||||
|
|
||||||
|
const AddMunicipality({
|
||||||
|
required this.id,
|
||||||
|
required this.cityCode,
|
||||||
|
required this.cityDescription,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
id,
|
||||||
|
cityCode,
|
||||||
|
cityDescription,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadMunicipalities extends MunicipalitiesAdminEvent {
|
||||||
|
const LoadMunicipalities();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
part of 'municipalities_admin_bloc.dart';
|
||||||
|
|
||||||
|
class MunicipalitiesAdminState extends Equatable {
|
||||||
|
const MunicipalitiesAdminState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class MunicipalitiesAdminInitial extends MunicipalitiesAdminState {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class MunicipalitiesLoaded extends MunicipalitiesAdminState {
|
||||||
|
final List<City> city;
|
||||||
|
|
||||||
|
const MunicipalitiesLoaded({required this.city});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [city];
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
|
||||||
|
import '../../../../../model/passo/signatories.dart';
|
||||||
|
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
|
||||||
|
part 'signatories_admin_event.dart';
|
||||||
|
part 'signatories_admin_state.dart';
|
||||||
|
|
||||||
|
class SignatoriesAdminBloc
|
||||||
|
extends Bloc<SignatoriesAdminEvent, SignatoriesAdminState> {
|
||||||
|
SignatoriesAdminBloc() : super(SignatoriesAdminInitial()) {
|
||||||
|
List<Signatories> signatories = [];
|
||||||
|
on<LoadSignatories>((event, emit) async {
|
||||||
|
signatories = await SQLServices.instance.readAllSignatories();
|
||||||
|
|
||||||
|
emit(SignatoriesLoaded(signatories: signatories));
|
||||||
|
});
|
||||||
|
on<AddSignatories>((event, emit) async {
|
||||||
|
await SQLServices.instance.createSignatories(Signatories(
|
||||||
|
id: event.id,
|
||||||
|
signatoryId: event.signatoryId,
|
||||||
|
firstname: event.firstname,
|
||||||
|
middlename: event.middlename,
|
||||||
|
lastname: event.lastname,
|
||||||
|
designation: event.designation,
|
||||||
|
// status: event.status
|
||||||
|
// genCode: event.genCode
|
||||||
|
));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
part of 'signatories_admin_bloc.dart';
|
||||||
|
|
||||||
|
class SignatoriesAdminEvent extends Equatable {
|
||||||
|
const SignatoriesAdminEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddSignatories extends SignatoriesAdminEvent {
|
||||||
|
final int id;
|
||||||
|
final int signatoryId;
|
||||||
|
final String firstname;
|
||||||
|
final String middlename;
|
||||||
|
final String lastname;
|
||||||
|
final String genCode;
|
||||||
|
final String designation;
|
||||||
|
// final String status;
|
||||||
|
|
||||||
|
const AddSignatories({
|
||||||
|
required this.id,
|
||||||
|
required this.signatoryId,
|
||||||
|
required this.firstname,
|
||||||
|
required this.middlename,
|
||||||
|
required this.lastname,
|
||||||
|
required this.genCode,
|
||||||
|
required this.designation,
|
||||||
|
// required this.status
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
id,
|
||||||
|
signatoryId,
|
||||||
|
firstname,
|
||||||
|
middlename,
|
||||||
|
lastname,
|
||||||
|
genCode,
|
||||||
|
designation,
|
||||||
|
// status
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadSignatories extends SignatoriesAdminEvent {
|
||||||
|
const LoadSignatories();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
part of 'signatories_admin_bloc.dart';
|
||||||
|
|
||||||
|
class SignatoriesAdminState extends Equatable {
|
||||||
|
const SignatoriesAdminState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class SignatoriesAdminInitial extends SignatoriesAdminState {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class SignatoriesLoaded extends SignatoriesAdminState {
|
||||||
|
final List<Signatories> signatories;
|
||||||
|
|
||||||
|
const SignatoriesLoaded({required this.signatories});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [signatories];
|
||||||
|
}
|
|
@ -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));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 => [];
|
||||||
|
}
|
|
@ -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];
|
||||||
|
}
|
|
@ -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));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 => [];
|
||||||
|
}
|
|
@ -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];
|
||||||
|
}
|
|
@ -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,
|
||||||
|
));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 => [];
|
||||||
|
}
|
|
@ -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];
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
|
||||||
|
import '../../../../../model/passo/unit_construct.dart';
|
||||||
|
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
|
||||||
|
part 'unit_construction_admin_event.dart';
|
||||||
|
part 'unit_construction_admin_state.dart';
|
||||||
|
|
||||||
|
class UnitConstructionAdminBloc
|
||||||
|
extends Bloc<UnitConstructionAdminEvent, UnitConstructionAdminState> {
|
||||||
|
UnitConstructionAdminBloc() : super(UnitConstructionAdminInitial()) {
|
||||||
|
List<UnitConstruct> unit = [];
|
||||||
|
on<LoadUnitConstruct>((event, emit) async {
|
||||||
|
unit = await SQLServices.instance.readAllUnitConstruct();
|
||||||
|
|
||||||
|
emit(UnitConstructLoaded(unit: unit));
|
||||||
|
});
|
||||||
|
on<AddUnitConstruct>((event, emit) async {
|
||||||
|
await SQLServices.instance.createUnitConstruction(
|
||||||
|
UnitConstruct(
|
||||||
|
id: event.id,
|
||||||
|
bldgType: event.bldgType,
|
||||||
|
building: event.building,
|
||||||
|
unitValue: event.unitValue,
|
||||||
|
genCode: event.genCode),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
part of 'unit_construction_admin_bloc.dart';
|
||||||
|
|
||||||
|
class UnitConstructionAdminEvent extends Equatable {
|
||||||
|
const UnitConstructionAdminEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddUnitConstruct extends UnitConstructionAdminEvent {
|
||||||
|
final int id;
|
||||||
|
final String bldgType;
|
||||||
|
final String building;
|
||||||
|
final String unitValue;
|
||||||
|
final String genCode;
|
||||||
|
|
||||||
|
const AddUnitConstruct({
|
||||||
|
required this.id,
|
||||||
|
required this.bldgType,
|
||||||
|
required this.building,
|
||||||
|
required this.unitValue,
|
||||||
|
required this.genCode,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [id, bldgType, building, unitValue, genCode];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadUnitConstruct extends UnitConstructionAdminEvent {
|
||||||
|
const LoadUnitConstruct();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
part of 'unit_construction_admin_bloc.dart';
|
||||||
|
|
||||||
|
class UnitConstructionAdminState extends Equatable {
|
||||||
|
const UnitConstructionAdminState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UnitConstructionAdminInitial extends UnitConstructionAdminState {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UnitConstructLoaded extends UnitConstructionAdminState {
|
||||||
|
final List<UnitConstruct> unit;
|
||||||
|
|
||||||
|
const UnitConstructLoaded({required this.unit});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [unit];
|
||||||
|
}
|
|
@ -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,
|
||||||
|
));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 => [];
|
||||||
|
}
|
|
@ -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];
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/bloc/passo/bulding/additional_item/additional_item_bloc.dart';
|
||||||
|
import 'package:unit2/sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
|
||||||
|
import '../../../../../model/passo/additional_items.dart';
|
||||||
|
import '../../../../../sevices/offline/offline_passo/building/property_owner_info_service.dart';
|
||||||
|
|
||||||
|
part 'additional_items_offline_event.dart';
|
||||||
|
part 'additional_items_offline_state.dart';
|
||||||
|
|
||||||
|
class AdditionalItemsOfflineBloc
|
||||||
|
extends Bloc<AdditionalItemsOfflineEvent, AdditionalItemsOfflineState> {
|
||||||
|
AdditionalItemsOfflineBloc() : super(AdditionalItemsOfflineInitial()) {
|
||||||
|
List<AdditionalItems> addItems = [];
|
||||||
|
on<LoadAdditionalItems>((event, emit) async {
|
||||||
|
emit(AdditionalItemsOfflineInitial());
|
||||||
|
try {
|
||||||
|
emit(AdditionalItemsLoaded(addItem: addItems));
|
||||||
|
} catch (e) {
|
||||||
|
emit(AdditionalItemsErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<LoadAdditionalItemsEdit>((event, emit) async {
|
||||||
|
emit(AdditionalItemsOfflineInitial());
|
||||||
|
List<Map<String, dynamic>> result =
|
||||||
|
await SQLServices.instance.getAdditionalItems(event.id);
|
||||||
|
|
||||||
|
if (result.isNotEmpty) {
|
||||||
|
addItems = result.map((map) => AdditionalItems.fromJson(map)).toList();
|
||||||
|
|
||||||
|
emit(AdditionalItemsLoaded(addItem: addItems));
|
||||||
|
} else {
|
||||||
|
print('No data found.');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
on<AddAdditionalItems>((event, emit) async {
|
||||||
|
try {
|
||||||
|
AdditionalItems item = await SQLServices.instance.createAdditionalItems(
|
||||||
|
AdditionalItems(
|
||||||
|
id: event.id,
|
||||||
|
bldgapprDetailsId: event.bldgapprDetailsId,
|
||||||
|
classId: event.classId,
|
||||||
|
className: event.className,
|
||||||
|
structType: event.structType,
|
||||||
|
unitValue: event.unitValue,
|
||||||
|
baseUnitValue: event.baseUnitValue,
|
||||||
|
area: event.area,
|
||||||
|
marketValue: event.marketValue,
|
||||||
|
depreciationRate: event.depreciationRate,
|
||||||
|
adjustedMarketVal: event.adjustedMarketVal,
|
||||||
|
amtDepreciation: event.amtDepreciation,
|
||||||
|
painted: event.painted == true ? '1' : '0',
|
||||||
|
secondhand: event.secondhand == true ? '1' : '0',
|
||||||
|
paintedUnitval: event.paintedUnitval,
|
||||||
|
secondhandUnitval: event.secondhandUnitval,
|
||||||
|
actualUse: event.actualUse,
|
||||||
|
genCode: event.genCode));
|
||||||
|
|
||||||
|
print(item.toJson());
|
||||||
|
|
||||||
|
addItems.add(item);
|
||||||
|
|
||||||
|
emit(AdditionalItemsLoaded(addItem: addItems));
|
||||||
|
} 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<DeleteAdditionalItems>((event, emit) async {
|
||||||
|
addItems
|
||||||
|
.removeWhere(((AdditionalItems element) => element.id == event.id));
|
||||||
|
await SQLServices.instance.deleteAdditionalItems(id: event.id);
|
||||||
|
emit(const AdditionalItemsDeletedState(success: true));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,134 @@
|
||||||
|
part of 'additional_items_offline_bloc.dart';
|
||||||
|
|
||||||
|
class AdditionalItemsOfflineEvent extends Equatable {
|
||||||
|
const AdditionalItemsOfflineEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadAdditionalItems extends AdditionalItemsOfflineEvent {
|
||||||
|
final List<AdditionalItems> items;
|
||||||
|
|
||||||
|
const LoadAdditionalItems({this.items = const <AdditionalItems>[]});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [items];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadAdditionalItemsEdit extends AdditionalItemsOfflineEvent {
|
||||||
|
final List<AdditionalItems> items;
|
||||||
|
final int? id;
|
||||||
|
|
||||||
|
const LoadAdditionalItemsEdit({required this.items, this.id});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [items];
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
final dynamic baseUnitValue;
|
||||||
|
final dynamic area;
|
||||||
|
final dynamic marketValue;
|
||||||
|
final dynamic depreciationRate;
|
||||||
|
final dynamic adjustedMarketVal;
|
||||||
|
final dynamic amtDepreciation;
|
||||||
|
final bool painted;
|
||||||
|
final bool secondhand;
|
||||||
|
final dynamic paintedUnitval;
|
||||||
|
final dynamic secondhandUnitval;
|
||||||
|
final String actualUse;
|
||||||
|
final String genCode;
|
||||||
|
|
||||||
|
const AddAdditionalItems({
|
||||||
|
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,
|
||||||
|
required this.baseUnitValue,
|
||||||
|
required this.area,
|
||||||
|
required this.marketValue,
|
||||||
|
required this.depreciationRate,
|
||||||
|
required this.adjustedMarketVal,
|
||||||
|
required this.amtDepreciation,
|
||||||
|
required this.painted,
|
||||||
|
required this.secondhand,
|
||||||
|
required this.paintedUnitval,
|
||||||
|
required this.secondhandUnitval,
|
||||||
|
required this.actualUse,
|
||||||
|
required this.genCode,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
id,
|
||||||
|
bldgapprDetailsId,
|
||||||
|
classId,
|
||||||
|
assessedById,
|
||||||
|
assessedByName,
|
||||||
|
dateCreated,
|
||||||
|
dateModified,
|
||||||
|
className,
|
||||||
|
structType,
|
||||||
|
unitValue,
|
||||||
|
baseUnitValue,
|
||||||
|
area,
|
||||||
|
marketValue,
|
||||||
|
depreciationRate,
|
||||||
|
adjustedMarketVal,
|
||||||
|
amtDepreciation,
|
||||||
|
painted,
|
||||||
|
secondhand,
|
||||||
|
paintedUnitval,
|
||||||
|
secondhandUnitval,
|
||||||
|
actualUse,
|
||||||
|
genCode
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdateAdditionalItems extends AdditionalItemsOfflineEvent {
|
||||||
|
final AdditionalItems addItems;
|
||||||
|
const UpdateAdditionalItems({required this.addItems});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [addItems];
|
||||||
|
}
|
||||||
|
|
||||||
|
class FetchAdditionalItems extends AdditionalItemsOfflineEvent {
|
||||||
|
const FetchAdditionalItems();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class FetchSpecificAdditionalItems extends AdditionalItemsOfflineEvent {
|
||||||
|
final int id;
|
||||||
|
const FetchSpecificAdditionalItems({required this.id});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [id];
|
||||||
|
}
|
||||||
|
|
||||||
|
class DeleteAdditionalItems extends AdditionalItemsOfflineEvent {
|
||||||
|
final int id;
|
||||||
|
const DeleteAdditionalItems({required this.id});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [id];
|
||||||
|
}
|
||||||
|
|
||||||
|
class ShowAdditionalItems extends AdditionalItemsOfflineEvent {}
|
|
@ -0,0 +1,46 @@
|
||||||
|
part of 'additional_items_offline_bloc.dart';
|
||||||
|
|
||||||
|
class AdditionalItemsOfflineState extends Equatable {
|
||||||
|
const AdditionalItemsOfflineState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AdditionalItemsOfflineInitial extends AdditionalItemsOfflineState {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AdditionalItemsLoaded extends AdditionalItemsOfflineState {
|
||||||
|
final List<AdditionalItems> addItem;
|
||||||
|
|
||||||
|
const AdditionalItemsLoaded({required this.addItem});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [addItem];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadSpecificAdditionalItems extends AdditionalItemsOfflineState {
|
||||||
|
final AdditionalItems addItem;
|
||||||
|
|
||||||
|
const LoadSpecificAdditionalItems({required this.addItem});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [addItem];
|
||||||
|
}
|
||||||
|
|
||||||
|
class ShowAddItemsScreen extends AdditionalItemsOfflineState {}
|
||||||
|
|
||||||
|
class AdditionalItemsErrorState extends AdditionalItemsOfflineState {
|
||||||
|
const AdditionalItemsErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AdditionalItemsDeletedState extends AdditionalItemsOfflineState {
|
||||||
|
final bool success;
|
||||||
|
const AdditionalItemsDeletedState({required this.success});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [success];
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/property_appraisal.dart';
|
||||||
|
|
||||||
|
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
|
||||||
|
part 'bldg_appraisal_offline_event.dart';
|
||||||
|
part 'bldg_appraisal_offline_state.dart';
|
||||||
|
|
||||||
|
class BldgAppraisalOfflineBloc
|
||||||
|
extends Bloc<BldgAppraisalOfflineEvent, BldgAppraisalOfflineState> {
|
||||||
|
BldgAppraisalOfflineBloc() : super(BldgAppraisalOfflineInitial()) {
|
||||||
|
List<PropertyAppraisal> appraisal = [];
|
||||||
|
on<AddBldgAppraisal>((event, emit) async {
|
||||||
|
await SQLServices.instance.createBldgAppraisal(PropertyAppraisal(
|
||||||
|
id: event.id,
|
||||||
|
bldgapprDetailsId: event.bldgapprDetailsId,
|
||||||
|
assessedById: event.assessedById,
|
||||||
|
assessedByName: event.assessedByName,
|
||||||
|
dateCreated: event.dateCreated,
|
||||||
|
dateModified: event.dateModified,
|
||||||
|
unitconstructCost: event.unitconstructCost,
|
||||||
|
buildingCore: event.buildingCore,
|
||||||
|
unitconstructSubtotal: event.unitconstructSubtotal,
|
||||||
|
depreciationRate: event.depreciationRate,
|
||||||
|
depreciationCost: event.depreciationCost,
|
||||||
|
costAddItems: event.costAddItems,
|
||||||
|
addItemsSubtotal: event.addItemsSubtotal,
|
||||||
|
totalpercentDepreciation: event.totalpercentDepreciation,
|
||||||
|
marketValue: event.marketValue,
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,89 @@
|
||||||
|
part of 'bldg_appraisal_offline_bloc.dart';
|
||||||
|
|
||||||
|
class BldgAppraisalOfflineEvent extends Equatable {
|
||||||
|
const BldgAppraisalOfflineEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddBldgAppraisal extends BldgAppraisalOfflineEvent {
|
||||||
|
final int id;
|
||||||
|
final int bldgapprDetailsId;
|
||||||
|
final String assessedById;
|
||||||
|
final String assessedByName;
|
||||||
|
final String dateCreated;
|
||||||
|
final String dateModified;
|
||||||
|
final String unitconstructCost;
|
||||||
|
final String buildingCore;
|
||||||
|
final String unitconstructSubtotal;
|
||||||
|
final String depreciationRate;
|
||||||
|
final String depreciationCost;
|
||||||
|
final String costAddItems;
|
||||||
|
final String addItemsSubtotal;
|
||||||
|
final String totalpercentDepreciation;
|
||||||
|
final String marketValue;
|
||||||
|
final String totalArea;
|
||||||
|
final String actualUse;
|
||||||
|
final String genCode;
|
||||||
|
|
||||||
|
const AddBldgAppraisal(
|
||||||
|
{required this.id,
|
||||||
|
required this.bldgapprDetailsId,
|
||||||
|
required this.assessedById,
|
||||||
|
required this.assessedByName,
|
||||||
|
required this.dateCreated,
|
||||||
|
required this.dateModified,
|
||||||
|
required this.unitconstructCost,
|
||||||
|
required this.buildingCore,
|
||||||
|
required this.unitconstructSubtotal,
|
||||||
|
required this.depreciationRate,
|
||||||
|
required this.depreciationCost,
|
||||||
|
required this.costAddItems,
|
||||||
|
required this.addItemsSubtotal,
|
||||||
|
required this.totalpercentDepreciation,
|
||||||
|
required this.marketValue,
|
||||||
|
required this.totalArea,
|
||||||
|
required this.actualUse,
|
||||||
|
required this.genCode});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
id,
|
||||||
|
bldgapprDetailsId,
|
||||||
|
assessedById,
|
||||||
|
assessedByName,
|
||||||
|
dateCreated,
|
||||||
|
dateModified,
|
||||||
|
unitconstructCost,
|
||||||
|
buildingCore,
|
||||||
|
unitconstructSubtotal,
|
||||||
|
depreciationRate,
|
||||||
|
depreciationCost,
|
||||||
|
costAddItems,
|
||||||
|
addItemsSubtotal,
|
||||||
|
totalpercentDepreciation,
|
||||||
|
marketValue,
|
||||||
|
totalArea,
|
||||||
|
actualUse,
|
||||||
|
genCode
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
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];
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
part of 'bldg_appraisal_offline_bloc.dart';
|
||||||
|
|
||||||
|
class BldgAppraisalOfflineState extends Equatable {
|
||||||
|
const BldgAppraisalOfflineState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class BldgAppraisalOfflineInitial extends BldgAppraisalOfflineState {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class BldgAppraisalOfflineLoaded extends BldgAppraisalOfflineState {
|
||||||
|
final List<PropertyAppraisal> appraisal;
|
||||||
|
|
||||||
|
const BldgAppraisalOfflineLoaded({required this.appraisal});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [appraisal];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadSpecificBldgAppraisalOffline extends BldgAppraisalOfflineState {
|
||||||
|
final PropertyAppraisal appraisal;
|
||||||
|
|
||||||
|
const LoadSpecificBldgAppraisalOffline({required this.appraisal});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [appraisal];
|
||||||
|
}
|
||||||
|
|
||||||
|
class SpecificBldgAppraisalLoaded extends BldgAppraisalOfflineState {
|
||||||
|
final PropertyAppraisal appraisal;
|
||||||
|
|
||||||
|
const SpecificBldgAppraisalLoaded({required this.appraisal});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [appraisal];
|
||||||
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/property_assessment.dart';
|
||||||
|
|
||||||
|
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
|
||||||
|
part 'bldg_assessment_offline_event.dart';
|
||||||
|
part 'bldg_assessment_offline_state.dart';
|
||||||
|
|
||||||
|
class BldgAssessmentOfflineBloc
|
||||||
|
extends Bloc<BldgAssessmentOfflineEvent, BldgAssessmentOfflineState> {
|
||||||
|
BldgAssessmentOfflineBloc() : super(BldgAssessmentOfflineInitial()) {
|
||||||
|
List<PropertyAssessment> assessment = [];
|
||||||
|
on<AddBldgAssessment>((event, emit) async {
|
||||||
|
await SQLServices.instance.createBldgAssessment(PropertyAssessment(
|
||||||
|
id: event.id,
|
||||||
|
bldgapprDetailsId: event.bldgapprDetailsId,
|
||||||
|
assessedById: event.assessedById,
|
||||||
|
assessedByName: event.assessedByName,
|
||||||
|
dateCreated: event.dateCreated,
|
||||||
|
dateModified: event.dateModified,
|
||||||
|
actualUse: event.actualUse,
|
||||||
|
marketValue: event.marketValue,
|
||||||
|
assessmentLevel: event.assessmentLevel,
|
||||||
|
assessedValue: event.assessedValue,
|
||||||
|
taxable: event.taxable,
|
||||||
|
exempt: event.exempt,
|
||||||
|
qtr: event.qtr,
|
||||||
|
yr: event.yr.toString(),
|
||||||
|
appraisedbyName: event.appraisedbyName,
|
||||||
|
appraisedbyDate: event.appraisedbyDate,
|
||||||
|
recommendapprName: event.recommendapprName,
|
||||||
|
recommendapprDate: event.recommendapprDate,
|
||||||
|
approvedbyName: event.approvedbyName,
|
||||||
|
memoranda: event.memoranda,
|
||||||
|
swornstatementNo: event.swornstatementNo,
|
||||||
|
dateReceived: event.dateReceived,
|
||||||
|
entryDateAssessment: event.entryDateAssessment,
|
||||||
|
entryDateBy: event.entryDateBy,
|
||||||
|
note: event.note,
|
||||||
|
genCode: event.genCode,
|
||||||
|
appraisedbyDesignation: event.appraisedbyDesignation,
|
||||||
|
approvedbyDesignation: event.approvedbyDesignation,
|
||||||
|
recommendapprDesignation: event.recommendapprDesignation));
|
||||||
|
});
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,123 @@
|
||||||
|
part of 'bldg_assessment_offline_bloc.dart';
|
||||||
|
|
||||||
|
class BldgAssessmentOfflineEvent extends Equatable {
|
||||||
|
const BldgAssessmentOfflineEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
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 String taxable;
|
||||||
|
final String exempt;
|
||||||
|
final String qtr;
|
||||||
|
final int yr;
|
||||||
|
final String appraisedbyName;
|
||||||
|
final String appraisedbyDate;
|
||||||
|
final String recommendapprName;
|
||||||
|
final String recommendapprDate;
|
||||||
|
final String approvedbyName;
|
||||||
|
final String memoranda;
|
||||||
|
final String swornstatementNo;
|
||||||
|
final String dateReceived;
|
||||||
|
final String entryDateAssessment;
|
||||||
|
final String entryDateBy;
|
||||||
|
final String genCode;
|
||||||
|
final String note;
|
||||||
|
final String appraisedbyDesignation;
|
||||||
|
final String recommendapprDesignation;
|
||||||
|
final String approvedbyDesignation;
|
||||||
|
|
||||||
|
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,
|
||||||
|
required this.assessedValue,
|
||||||
|
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.memoranda,
|
||||||
|
required this.swornstatementNo,
|
||||||
|
required this.dateReceived,
|
||||||
|
required this.entryDateAssessment,
|
||||||
|
required this.entryDateBy,
|
||||||
|
required this.genCode,
|
||||||
|
required this.note,
|
||||||
|
required this.appraisedbyDesignation,
|
||||||
|
required this.recommendapprDesignation,
|
||||||
|
required this.approvedbyDesignation,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
id,
|
||||||
|
bldgapprDetailsId,
|
||||||
|
assessedById,
|
||||||
|
assessedByName,
|
||||||
|
dateCreated,
|
||||||
|
dateModified,
|
||||||
|
actualUse,
|
||||||
|
marketValue,
|
||||||
|
assessmentLevel,
|
||||||
|
assessedValue,
|
||||||
|
taxable,
|
||||||
|
exempt,
|
||||||
|
qtr,
|
||||||
|
yr,
|
||||||
|
appraisedbyName,
|
||||||
|
appraisedbyDate,
|
||||||
|
recommendapprName,
|
||||||
|
recommendapprDate,
|
||||||
|
approvedbyName,
|
||||||
|
memoranda,
|
||||||
|
swornstatementNo,
|
||||||
|
dateReceived,
|
||||||
|
entryDateAssessment,
|
||||||
|
entryDateBy,
|
||||||
|
genCode,
|
||||||
|
note,
|
||||||
|
appraisedbyDesignation,
|
||||||
|
recommendapprDesignation,
|
||||||
|
approvedbyDesignation,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
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];
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
part of 'bldg_assessment_offline_bloc.dart';
|
||||||
|
|
||||||
|
class BldgAssessmentOfflineState extends Equatable {
|
||||||
|
const BldgAssessmentOfflineState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class BldgAssessmentOfflineInitial extends BldgAssessmentOfflineState {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class BldgAssessmentOfflineLoaded extends BldgAssessmentOfflineState {
|
||||||
|
final List<PropertyAssessment> assessment;
|
||||||
|
|
||||||
|
const BldgAssessmentOfflineLoaded({required this.assessment});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [assessment];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadSpecificBldgAssessmentOffline extends BldgAssessmentOfflineState {
|
||||||
|
final PropertyAssessment assessment;
|
||||||
|
|
||||||
|
const LoadSpecificBldgAssessmentOffline({required this.assessment});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [assessment];
|
||||||
|
}
|
||||||
|
|
||||||
|
class SpecificBldgAssessmentLoaded extends BldgAssessmentOfflineState {
|
||||||
|
final PropertyAssessment assessment;
|
||||||
|
|
||||||
|
const SpecificBldgAssessmentLoaded({required this.assessment});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [assessment];
|
||||||
|
}
|
|
@ -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));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 {}
|
|
@ -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];
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/general_description.dart';
|
||||||
|
import 'package:unit2/sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
|
||||||
|
import '../../../../../sevices/offline/offline_passo/building/property_owner_info_service.dart';
|
||||||
|
|
||||||
|
part 'general_description_event.dart';
|
||||||
|
part 'general_description_state.dart';
|
||||||
|
|
||||||
|
class GeneralDescriptionBloc
|
||||||
|
extends Bloc<GeneralDescriptionEvent, GeneralDescriptionState> {
|
||||||
|
GeneralDescriptionBloc() : super(GeneralDescriptionInitial()) {
|
||||||
|
List<GeneralDesc> todos = [];
|
||||||
|
on<AddGendesc>((event, emit) async {
|
||||||
|
await SQLServices.instance.createBldgGeneralDescription(GeneralDesc(
|
||||||
|
bldgapprDetailsId: event.bldgapprDetailsId,
|
||||||
|
assessedById: event.assessedById,
|
||||||
|
assessedByName: event.assessedByName,
|
||||||
|
bldgKind: event.bldgKind,
|
||||||
|
strucType: event.strucType,
|
||||||
|
bldgPermit: event.bldgPermit,
|
||||||
|
dateIssued: event.dateIssued.toString(),
|
||||||
|
cct: event.cct,
|
||||||
|
certCompletionIssued: event.certCompletionIssued.toString(),
|
||||||
|
certOccupancyIssued: event.certOccupancyIssued.toString(),
|
||||||
|
dateCompleted: event.dateCompleted.toString(),
|
||||||
|
dateOccupied: event.dateOccupied.toString(),
|
||||||
|
bldgAge: event.bldgAge,
|
||||||
|
noStoreys: event.noStoreys,
|
||||||
|
area1Stfloor: event.area1Stfloor,
|
||||||
|
area2Ndfloor: event.area2Ndfloor,
|
||||||
|
area3Rdfloor: event.area3Rdfloor,
|
||||||
|
area4Thfloor: event.area4Thfloor,
|
||||||
|
totalFloorArea: event.totalFloorArea,
|
||||||
|
floorSketch: event.floorSketch,
|
||||||
|
actualUse: event.actualUse,
|
||||||
|
unitValue: event.unitValue,
|
||||||
|
genCode: event.genCode));
|
||||||
|
});
|
||||||
|
on<FetchSingleGeneralDescription>((event, emit) async {
|
||||||
|
List<Map<String, dynamic>> result =
|
||||||
|
await SQLServices.instance.getGeneralDescription(event.id);
|
||||||
|
|
||||||
|
if (result.isNotEmpty) {
|
||||||
|
List<GeneralDesc> genDescList =
|
||||||
|
result.map((map) => GeneralDesc.fromJson2(map)).toList();
|
||||||
|
|
||||||
|
// Choose a specific element from locationList
|
||||||
|
GeneralDesc firstGenDesc =
|
||||||
|
genDescList.first; // You can change this to select a specific item
|
||||||
|
|
||||||
|
print('location test result');
|
||||||
|
print(firstGenDesc);
|
||||||
|
emit(SpecificGeneralDescriptionLoaded(gendesc: firstGenDesc));
|
||||||
|
} else {
|
||||||
|
print('No data found.');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<UpdateGeneralDescription>((event, emit) async {
|
||||||
|
await SQLServices.instance
|
||||||
|
.updateGeneralDescription(event.id, event.gendesc);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,113 @@
|
||||||
|
part of 'general_description_bloc.dart';
|
||||||
|
|
||||||
|
class GeneralDescriptionEvent extends Equatable {
|
||||||
|
const GeneralDescriptionEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddGendesc extends GeneralDescriptionEvent {
|
||||||
|
final int id;
|
||||||
|
final int bldgapprDetailsId;
|
||||||
|
final String assessedById;
|
||||||
|
final String assessedByName;
|
||||||
|
final String dateCreated;
|
||||||
|
final String dateModified;
|
||||||
|
final String bldgKind;
|
||||||
|
final String strucType;
|
||||||
|
final String bldgPermit;
|
||||||
|
final String dateIssued;
|
||||||
|
final String cct;
|
||||||
|
final String certCompletionIssued;
|
||||||
|
final String certOccupancyIssued;
|
||||||
|
final String dateCompleted;
|
||||||
|
final String dateOccupied;
|
||||||
|
final String bldgAge;
|
||||||
|
final String noStoreys;
|
||||||
|
final String area1Stfloor;
|
||||||
|
final String area2Ndfloor;
|
||||||
|
final String area3Rdfloor;
|
||||||
|
final String area4Thfloor;
|
||||||
|
final String totalFloorArea;
|
||||||
|
final dynamic floorSketch;
|
||||||
|
final String actualUse;
|
||||||
|
final String unitValue;
|
||||||
|
final String genCode;
|
||||||
|
|
||||||
|
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,
|
||||||
|
required this.genCode});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
id,
|
||||||
|
bldgapprDetailsId,
|
||||||
|
assessedById,
|
||||||
|
assessedByName,
|
||||||
|
dateCreated,
|
||||||
|
dateModified,
|
||||||
|
bldgKind,
|
||||||
|
strucType,
|
||||||
|
bldgPermit,
|
||||||
|
dateIssued,
|
||||||
|
cct,
|
||||||
|
certCompletionIssued,
|
||||||
|
certOccupancyIssued,
|
||||||
|
dateCompleted,
|
||||||
|
dateOccupied,
|
||||||
|
bldgAge,
|
||||||
|
noStoreys,
|
||||||
|
area1Stfloor,
|
||||||
|
area2Ndfloor,
|
||||||
|
area3Rdfloor,
|
||||||
|
area4Thfloor,
|
||||||
|
totalFloorArea,
|
||||||
|
floorSketch,
|
||||||
|
actualUse,
|
||||||
|
unitValue,
|
||||||
|
genCode
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class FetchSingleGeneralDescription extends GeneralDescriptionEvent {
|
||||||
|
final int id;
|
||||||
|
const FetchSingleGeneralDescription({required this.id});
|
||||||
|
|
||||||
|
@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];
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
part of 'general_description_bloc.dart';
|
||||||
|
|
||||||
|
class GeneralDescriptionState extends Equatable {
|
||||||
|
const GeneralDescriptionState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class GeneralDescriptionInitial extends GeneralDescriptionState {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LocationLoaded extends GeneralDescriptionState {
|
||||||
|
final List<GeneralDesc> gendesc;
|
||||||
|
|
||||||
|
const LocationLoaded({required this.gendesc});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [gendesc];
|
||||||
|
}
|
||||||
|
|
||||||
|
class SpecificGeneralDescriptionLoaded extends GeneralDescriptionState {
|
||||||
|
final GeneralDesc gendesc;
|
||||||
|
|
||||||
|
const SpecificGeneralDescriptionLoaded({required this.gendesc});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [gendesc];
|
||||||
|
}
|
|
@ -0,0 +1,83 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
|
||||||
|
import '../../../../../model/passo/land_ref.dart';
|
||||||
|
import '../../../../../model/passo/todo.dart';
|
||||||
|
import '../../../../../sevices/offline/offline_passo/building/property_owner_info_service.dart';
|
||||||
|
|
||||||
|
part 'landref_location_event.dart';
|
||||||
|
part 'landref_location_state.dart';
|
||||||
|
|
||||||
|
class LandrefLocationBloc
|
||||||
|
extends Bloc<LandrefLocationEvent, LandrefLocationState> {
|
||||||
|
LandrefLocationBloc() : super(LandrefInitial()) {
|
||||||
|
List<LandRef> todos = [];
|
||||||
|
on<AddLandRef>((event, emit) async {
|
||||||
|
await SQLServices.instance.createBldgLandRef(
|
||||||
|
LandRef(
|
||||||
|
id: event.id,
|
||||||
|
bldgapprDetailsId: event.bldgapprDetailsId,
|
||||||
|
assessedById: event.assessedById,
|
||||||
|
assessedByName: event.assessedByName,
|
||||||
|
owner: event.owner,
|
||||||
|
cloaNo: event.cloaNo,
|
||||||
|
lotNo: event.lotNo,
|
||||||
|
tdn: event.tdn,
|
||||||
|
area: event.area,
|
||||||
|
surveyNo: event.surveyNo,
|
||||||
|
blkNo: event.blkNo,
|
||||||
|
genCode: event.genCode),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
// on<UpdateTodo>((event, emit) async {
|
||||||
|
// await PropertyOwnerInfoServices.instance.update(
|
||||||
|
// todo: event.todo,
|
||||||
|
// );
|
||||||
|
// });
|
||||||
|
|
||||||
|
// on<FetchLanRef>((event, emit) async {
|
||||||
|
// landref = await PropertyOwnerInfoServices.instance.readAllTodos();
|
||||||
|
// emit(LandrefLoaded(landref: landref));
|
||||||
|
// });
|
||||||
|
|
||||||
|
on<FetchSingleLandref>((event, emit) async {
|
||||||
|
List<Map<String, dynamic>> result =
|
||||||
|
await SQLServices.instance.getLandRef(event.id);
|
||||||
|
|
||||||
|
if (result.isNotEmpty) {
|
||||||
|
LandRef firstRow = LandRef(
|
||||||
|
id: result[0]["id"],
|
||||||
|
bldgapprDetailsId: result[0]["bldgapprDetailsId"],
|
||||||
|
assessedById: result[0]["assessedById"],
|
||||||
|
assessedByName: result[0]["assessedByName"],
|
||||||
|
dateCreated: DateTime.now().toString(),
|
||||||
|
dateModified: DateTime.now().toString(),
|
||||||
|
owner: result[0]["owner"],
|
||||||
|
cloaNo: result[0]["cloaNo"],
|
||||||
|
lotNo: result[0]["lotNo"],
|
||||||
|
tdn: result[0]["tdn"],
|
||||||
|
area: result[0]["area"],
|
||||||
|
surveyNo: result[0]["surveyNo"],
|
||||||
|
blkNo: result[0]["blkNo"],
|
||||||
|
);
|
||||||
|
|
||||||
|
print('landref test result');
|
||||||
|
print(firstRow);
|
||||||
|
emit(SpecificLandrefLoaded(landref: firstRow));
|
||||||
|
} else {
|
||||||
|
print('No data found.');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
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());
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,91 @@
|
||||||
|
part of 'landref_location_bloc.dart';
|
||||||
|
|
||||||
|
class LandrefLocationEvent extends Equatable {
|
||||||
|
const LandrefLocationEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddLandRef extends LandrefLocationEvent {
|
||||||
|
final int id;
|
||||||
|
final int bldgapprDetailsId;
|
||||||
|
final String assessedById;
|
||||||
|
final String assessedByName;
|
||||||
|
final dynamic owner;
|
||||||
|
final dynamic cloaNo;
|
||||||
|
final dynamic lotNo;
|
||||||
|
final dynamic tdn;
|
||||||
|
final dynamic area;
|
||||||
|
final dynamic surveyNo;
|
||||||
|
final dynamic blkNo;
|
||||||
|
final String dateCreated;
|
||||||
|
final String dateModified;
|
||||||
|
final String genCode;
|
||||||
|
|
||||||
|
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,
|
||||||
|
required this.genCode});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
id,
|
||||||
|
bldgapprDetailsId,
|
||||||
|
assessedById,
|
||||||
|
assessedByName,
|
||||||
|
owner,
|
||||||
|
cloaNo,
|
||||||
|
lotNo,
|
||||||
|
tdn,
|
||||||
|
area,
|
||||||
|
surveyNo,
|
||||||
|
blkNo,
|
||||||
|
dateCreated,
|
||||||
|
dateModified,
|
||||||
|
genCode
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdateBldgLandRef extends LandrefLocationEvent {
|
||||||
|
final LandRef landRef;
|
||||||
|
final int id;
|
||||||
|
|
||||||
|
UpdateBldgLandRef({required this.id, required this.landRef});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [id, landRef];
|
||||||
|
}
|
||||||
|
|
||||||
|
class FetchLanRef extends LandrefLocationEvent {
|
||||||
|
const FetchLanRef();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class FetchSingleLandref extends LandrefLocationEvent {
|
||||||
|
final int id;
|
||||||
|
const FetchSingleLandref({required this.id});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [id];
|
||||||
|
}
|
||||||
|
|
||||||
|
// class DeleteTodo extends LandrefLocationEvent {
|
||||||
|
// final int id;
|
||||||
|
// const DeleteTodo({required this.id});
|
||||||
|
// @override
|
||||||
|
// List<Object> get props => [id];
|
||||||
|
// }
|
|
@ -0,0 +1,29 @@
|
||||||
|
part of 'landref_location_bloc.dart';
|
||||||
|
|
||||||
|
class LandrefLocationState extends Equatable {
|
||||||
|
const LandrefLocationState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LandrefInitial extends LandrefLocationState {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LandrefLoaded extends LandrefLocationState {
|
||||||
|
final List<LandRef> landref;
|
||||||
|
|
||||||
|
const LandrefLoaded({required this.landref});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [landref];
|
||||||
|
}
|
||||||
|
|
||||||
|
class SpecificLandrefLoaded extends LandrefLocationState {
|
||||||
|
final LandRef landref;
|
||||||
|
|
||||||
|
const SpecificLandrefLoaded({required this.landref});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [landref];
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
|
||||||
|
import '../../../../../model/passo/bldg_loc.dart';
|
||||||
|
|
||||||
|
part 'location_event.dart';
|
||||||
|
part 'location_state.dart';
|
||||||
|
|
||||||
|
class LocationBloc extends Bloc<LocationEvent, LocationState> {
|
||||||
|
LocationBloc() : super(LocationInitial()) {
|
||||||
|
List<BldgLoc> todos = [];
|
||||||
|
on<AddLocation>((event, emit) async {
|
||||||
|
await SQLServices.instance.createBldglocation(BldgLoc(
|
||||||
|
id: event.id,
|
||||||
|
bldgapprDetailsId: event.bldgapprDetailsId,
|
||||||
|
assessedById: event.assessedById,
|
||||||
|
assessedByName: event.assessedByName,
|
||||||
|
street: event.street,
|
||||||
|
barangay: event.barangay,
|
||||||
|
municipality: event.municipality,
|
||||||
|
province: event.province,
|
||||||
|
genCode: event.genCode));
|
||||||
|
});
|
||||||
|
on<FetchSingleLocation>((event, emit) async {
|
||||||
|
List<Map<String, dynamic>> result =
|
||||||
|
await SQLServices.instance.getLocation(event.id);
|
||||||
|
|
||||||
|
if (result.isNotEmpty) {
|
||||||
|
List<BldgLoc> locationList =
|
||||||
|
result.map((map) => BldgLoc.fromJson(map)).toList();
|
||||||
|
|
||||||
|
// Choose a specific element from locationList
|
||||||
|
BldgLoc firstLocation =
|
||||||
|
locationList.first; // You can change this to select a specific item
|
||||||
|
|
||||||
|
print('location test result');
|
||||||
|
print(firstLocation);
|
||||||
|
emit(SpecificLocationLoaded(location: firstLocation));
|
||||||
|
} else {
|
||||||
|
print('No data found.');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<UpdateBldgLoc>((event, emit) async {
|
||||||
|
await SQLServices.instance.updateLocation(event.id, event.bldgLoc);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,81 @@
|
||||||
|
part of 'location_bloc.dart';
|
||||||
|
|
||||||
|
class LocationEvent extends Equatable {
|
||||||
|
const LocationEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddLocation extends LocationEvent {
|
||||||
|
final int id;
|
||||||
|
final int bldgapprDetailsId;
|
||||||
|
final String assessedById;
|
||||||
|
final String assessedByName;
|
||||||
|
final String street;
|
||||||
|
final String barangay;
|
||||||
|
final String municipality;
|
||||||
|
final String province;
|
||||||
|
final String dateCreated;
|
||||||
|
final String dateModified;
|
||||||
|
final String genCode;
|
||||||
|
|
||||||
|
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,
|
||||||
|
required this.genCode});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
bldgapprDetailsId,
|
||||||
|
assessedById,
|
||||||
|
assessedByName,
|
||||||
|
street,
|
||||||
|
barangay,
|
||||||
|
municipality,
|
||||||
|
province,
|
||||||
|
dateCreated,
|
||||||
|
dateModified,
|
||||||
|
genCode
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdateBldgLoc extends LocationEvent {
|
||||||
|
final BldgLoc bldgLoc;
|
||||||
|
final int id;
|
||||||
|
|
||||||
|
UpdateBldgLoc({required this.id, required this.bldgLoc});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [id, bldgLoc];
|
||||||
|
}
|
||||||
|
|
||||||
|
class FetchLanRef extends LocationEvent {
|
||||||
|
const FetchLanRef();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class FetchSingleLocation extends LocationEvent {
|
||||||
|
final int id;
|
||||||
|
const FetchSingleLocation({required this.id});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [id];
|
||||||
|
}
|
||||||
|
|
||||||
|
// class DeleteTodo extends LocationEvent {
|
||||||
|
// final int id;
|
||||||
|
// const DeleteTodo({required this.id});
|
||||||
|
// @override
|
||||||
|
// List<Object> get props => [id];
|
||||||
|
// }
|
|
@ -0,0 +1,29 @@
|
||||||
|
part of 'location_bloc.dart';
|
||||||
|
|
||||||
|
class LocationState extends Equatable {
|
||||||
|
const LocationState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LocationInitial extends LocationState {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LocationLoaded extends LocationState {
|
||||||
|
final List<BldgLoc> location;
|
||||||
|
|
||||||
|
const LocationLoaded({required this.location});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [location];
|
||||||
|
}
|
||||||
|
|
||||||
|
class SpecificLocationLoaded extends LocationState {
|
||||||
|
final BldgLoc location;
|
||||||
|
|
||||||
|
const SpecificLocationLoaded({required this.location});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [location];
|
||||||
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
import '../../../../../model/passo/property_info.dart';
|
||||||
|
import '../../../../../model/passo/todo.dart';
|
||||||
|
import '../../../../../sevices/offline/offline_passo/building/property_owner_info_service.dart';
|
||||||
|
|
||||||
|
part 'crud_event.dart';
|
||||||
|
part 'crud_state.dart';
|
||||||
|
|
||||||
|
class CrudBloc extends Bloc<CrudEvent, CrudState> {
|
||||||
|
CrudBloc() : super(CrudInitial()) {
|
||||||
|
List<PropertyInfo> propertyOwner = [];
|
||||||
|
on<AddTodo>((event, emit) async {
|
||||||
|
try {
|
||||||
|
PropertyInfo ownerInfo;
|
||||||
|
ownerInfo = await SQLServices.instance.createBldgOwner(
|
||||||
|
PropertyInfo(
|
||||||
|
transCode: event.transCode,
|
||||||
|
tdn: event.tdn,
|
||||||
|
pin: event.pin,
|
||||||
|
fname: event.fname,
|
||||||
|
mname: event.mname,
|
||||||
|
lname: event.lname,
|
||||||
|
bday: event.bday,
|
||||||
|
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,
|
||||||
|
genCode: event.genCode),
|
||||||
|
);
|
||||||
|
|
||||||
|
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<UpdatePropertyOwnerInfo>((event, emit) async {
|
||||||
|
await SQLServices.instance.updateBldgOwner(event.id, event.propertyInfo);
|
||||||
|
});
|
||||||
|
|
||||||
|
on<FetchTodos>((event, emit) async {
|
||||||
|
propertyOwner = await SQLServices.instance.readAllBldgOwner();
|
||||||
|
emit(PropertyInfoLoaded(propertyInfos: propertyOwner));
|
||||||
|
});
|
||||||
|
|
||||||
|
// on<FetchSpecificTodo>((event, emit) async {
|
||||||
|
// Prop todo = await PropertyOwnerInfoServices.instance.readTodo(id: event.id);
|
||||||
|
// emit(DisplaySpecificTodo(todo: todo));
|
||||||
|
// });
|
||||||
|
|
||||||
|
on<DeleteTodo>((event, emit) async {
|
||||||
|
await SQLServices.instance.deleteBldgOwner(id: event.id);
|
||||||
|
add(const FetchTodos());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,109 @@
|
||||||
|
part of 'crud_bloc.dart';
|
||||||
|
|
||||||
|
abstract class CrudEvent extends Equatable {
|
||||||
|
const CrudEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddTodo extends CrudEvent {
|
||||||
|
final String id;
|
||||||
|
final String transCode;
|
||||||
|
final String tdn;
|
||||||
|
final String pin;
|
||||||
|
final String fname;
|
||||||
|
final String mname;
|
||||||
|
final String lname;
|
||||||
|
final String bday;
|
||||||
|
final String address;
|
||||||
|
final String telno;
|
||||||
|
final String tin;
|
||||||
|
final String adminUser;
|
||||||
|
final String adminAddress;
|
||||||
|
final String adminTelno;
|
||||||
|
final String adminTin;
|
||||||
|
final String faasType;
|
||||||
|
final String assessedById;
|
||||||
|
final String assessedByName;
|
||||||
|
final String dateCreated;
|
||||||
|
final String dateModified;
|
||||||
|
final String genCode;
|
||||||
|
|
||||||
|
const AddTodo(
|
||||||
|
{required this.id,
|
||||||
|
required this.transCode,
|
||||||
|
required this.tdn,
|
||||||
|
required this.pin,
|
||||||
|
required this.fname,
|
||||||
|
required this.mname,
|
||||||
|
required this.lname,
|
||||||
|
required this.bday,
|
||||||
|
required this.address,
|
||||||
|
required this.telno,
|
||||||
|
required this.tin,
|
||||||
|
required this.adminUser,
|
||||||
|
required this.adminAddress,
|
||||||
|
required this.adminTelno,
|
||||||
|
required this.adminTin,
|
||||||
|
required this.faasType,
|
||||||
|
required this.assessedById,
|
||||||
|
required this.assessedByName,
|
||||||
|
required this.dateCreated,
|
||||||
|
required this.dateModified,
|
||||||
|
required this.genCode});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object?> get props => [
|
||||||
|
id,
|
||||||
|
transCode,
|
||||||
|
tdn,
|
||||||
|
pin,
|
||||||
|
fname,
|
||||||
|
mname,
|
||||||
|
lname,
|
||||||
|
bday,
|
||||||
|
address,
|
||||||
|
telno,
|
||||||
|
tin,
|
||||||
|
adminUser,
|
||||||
|
adminAddress,
|
||||||
|
adminTelno,
|
||||||
|
adminTin,
|
||||||
|
faasType,
|
||||||
|
assessedById,
|
||||||
|
assessedByName,
|
||||||
|
dateCreated,
|
||||||
|
dateModified,
|
||||||
|
genCode
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdatePropertyOwnerInfo extends CrudEvent {
|
||||||
|
final PropertyInfo propertyInfo;
|
||||||
|
final int id;
|
||||||
|
|
||||||
|
UpdatePropertyOwnerInfo({required this.id, required this.propertyInfo});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [id, propertyInfo];
|
||||||
|
}
|
||||||
|
|
||||||
|
class FetchTodos extends CrudEvent {
|
||||||
|
const FetchTodos();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object?> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class FetchSpecificTodo extends CrudEvent {
|
||||||
|
final int id;
|
||||||
|
const FetchSpecificTodo({required this.id});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object?> get props => [id];
|
||||||
|
}
|
||||||
|
|
||||||
|
class DeleteTodo extends CrudEvent {
|
||||||
|
final int id;
|
||||||
|
const DeleteTodo({required this.id});
|
||||||
|
@override
|
||||||
|
List<Object?> get props => [id];
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
part of 'crud_bloc.dart';
|
||||||
|
|
||||||
|
abstract class CrudState extends Equatable {
|
||||||
|
const CrudState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class CrudInitial extends CrudState {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class PropertyOwnerInfoLoading extends CrudState {
|
||||||
|
@override
|
||||||
|
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 {
|
||||||
|
final Todo todo;
|
||||||
|
|
||||||
|
const DisplaySpecificTodo({required this.todo});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [todo];
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
|
||||||
|
import '../../../../../model/passo/structural_materials_ii.dart';
|
||||||
|
import '../../../../../model/passo/structureMaterial.dart';
|
||||||
|
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
|
||||||
|
part 'structural_material_offline_event.dart';
|
||||||
|
part 'structural_material_offline_state.dart';
|
||||||
|
|
||||||
|
class StructuralMaterialOfflineBloc extends Bloc<StructuralMaterialOfflineEvent,
|
||||||
|
StructuralMaterialOfflineState> {
|
||||||
|
StructuralMaterialOfflineBloc() : super(StructuralMaterialOfflineInitial()) {
|
||||||
|
List<StructureMaterials> materials = [];
|
||||||
|
on<AddStructuralMaterial>((event, emit) async {
|
||||||
|
await SQLServices.instance.createStructuralMaterials(StructureMaterialsII(
|
||||||
|
id: event.id,
|
||||||
|
bldgapprDetailsId: event.bldgapprDetailsId,
|
||||||
|
foundation: event.foundation!.join(', ').split(', '),
|
||||||
|
columns: event.columns!.join(', ').split(', '),
|
||||||
|
beams: event.beams!.join(', ').split(', '),
|
||||||
|
trussFraming: event.trussFraming!.join(', ').split(', '),
|
||||||
|
roof: event.roof!.join(', ').split(', '),
|
||||||
|
flooring: event.flooring!.join(', ').split(', '),
|
||||||
|
walls: event.walls!.join(', ').split(', '),
|
||||||
|
others: event.others!.join(', ').split(', '),
|
||||||
|
genCode: event.genCode,
|
||||||
|
assessedById: event.assessedById,
|
||||||
|
assessedByName: event.assessedByName,
|
||||||
|
dateCreated: event.dateCreated,
|
||||||
|
dateModified: event.dateModified));
|
||||||
|
});
|
||||||
|
on<FetchSingleStructuralMaterial>((event, emit) async {
|
||||||
|
List<Map<String, dynamic>> result =
|
||||||
|
await SQLServices.instance.getStructuralMaterials(event.id);
|
||||||
|
|
||||||
|
if (result.isNotEmpty) {
|
||||||
|
List<StructureMaterials> materialList =
|
||||||
|
result.map((map) => StructureMaterials.fromJson2(map)).toList();
|
||||||
|
|
||||||
|
// Choose a specific element from locationList
|
||||||
|
StructureMaterials firstMaterial =
|
||||||
|
materialList.first; // You can change this to select a specific item
|
||||||
|
|
||||||
|
print('struct mat test result');
|
||||||
|
print(firstMaterial);
|
||||||
|
emit(SpecificStructuralMaterialLoaded(materials: firstMaterial));
|
||||||
|
} else {
|
||||||
|
print('No data found.');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<UpdateStructuralMaterials>((event, emit) async {
|
||||||
|
await SQLServices.instance
|
||||||
|
.updateStructuralMaterial(event.id, event.materials);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
part of 'structural_material_offline_bloc.dart';
|
||||||
|
|
||||||
|
class StructuralMaterialOfflineEvent extends Equatable {
|
||||||
|
const StructuralMaterialOfflineEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddStructuralMaterial extends StructuralMaterialOfflineEvent {
|
||||||
|
final int id;
|
||||||
|
final int bldgapprDetailsId;
|
||||||
|
final List<String>? foundation;
|
||||||
|
final List<String>? columns;
|
||||||
|
final List<String>? beams;
|
||||||
|
final List<String>? trussFraming;
|
||||||
|
final List<String>? roof;
|
||||||
|
final List<String>? flooring;
|
||||||
|
final List<String>? walls;
|
||||||
|
final List<String>? others;
|
||||||
|
final String assessedById;
|
||||||
|
final String assessedByName;
|
||||||
|
final String dateCreated;
|
||||||
|
final String dateModified;
|
||||||
|
final String genCode;
|
||||||
|
|
||||||
|
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,
|
||||||
|
required this.genCode});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
id,
|
||||||
|
bldgapprDetailsId,
|
||||||
|
...?foundation,
|
||||||
|
...?columns,
|
||||||
|
...?beams,
|
||||||
|
...?trussFraming,
|
||||||
|
...?roof,
|
||||||
|
...?flooring,
|
||||||
|
...?walls,
|
||||||
|
...?others,
|
||||||
|
assessedById,
|
||||||
|
assessedByName,
|
||||||
|
dateCreated,
|
||||||
|
dateModified,
|
||||||
|
genCode
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class FetchSingleStructuralMaterial extends StructuralMaterialOfflineEvent {
|
||||||
|
final int id;
|
||||||
|
const FetchSingleStructuralMaterial({required this.id});
|
||||||
|
|
||||||
|
@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];
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
part of 'structural_material_offline_bloc.dart';
|
||||||
|
|
||||||
|
class StructuralMaterialOfflineState extends Equatable {
|
||||||
|
const StructuralMaterialOfflineState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class StructuralMaterialOfflineInitial extends StructuralMaterialOfflineState {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class StructuralMaterialLoaded extends StructuralMaterialOfflineState {
|
||||||
|
final List<StructureMaterials> materials;
|
||||||
|
|
||||||
|
const StructuralMaterialLoaded({required this.materials});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [materials];
|
||||||
|
}
|
||||||
|
|
||||||
|
class SpecificStructuralMaterialLoaded extends StructuralMaterialOfflineState {
|
||||||
|
final StructureMaterials materials;
|
||||||
|
|
||||||
|
const SpecificStructuralMaterialLoaded({required this.materials});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [materials];
|
||||||
|
}
|
|
@ -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));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 {}
|
|
@ -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];
|
||||||
|
}
|
|
@ -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));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 {}
|
|
@ -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];
|
||||||
|
}
|
|
@ -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);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -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];
|
||||||
|
}
|
|
@ -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];
|
||||||
|
}
|
|
@ -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);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -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];
|
||||||
|
}
|
|
@ -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];
|
||||||
|
}
|
|
@ -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());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -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];
|
||||||
|
}
|
|
@ -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];
|
||||||
|
}
|
|
@ -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());
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
}
|
|
@ -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];
|
||||||
|
}
|
|
@ -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];
|
||||||
|
}
|
|
@ -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));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 {}
|
|
@ -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];
|
||||||
|
}
|
|
@ -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));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 {}
|
|
@ -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];
|
||||||
|
}
|
|
@ -16,11 +16,6 @@ class AdditionalItemBloc
|
||||||
on<LoadAdditionalItems>((event, emit) async {
|
on<LoadAdditionalItems>((event, emit) async {
|
||||||
emit(AdditionalItemsLoading());
|
emit(AdditionalItemsLoading());
|
||||||
try {
|
try {
|
||||||
// final tempID = await SharedPreferences.getInstance();
|
|
||||||
// print(tempID.getInt('tempid'));
|
|
||||||
// final additionalItem = await GetAdditionalItems.getAdditionalItems(
|
|
||||||
// tempID.getInt('tempid'));
|
|
||||||
|
|
||||||
emit(AdditionalItemsLoaded(globalAdditionalItems));
|
emit(AdditionalItemsLoaded(globalAdditionalItems));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(AdditionalItemsErrorState(e.toString()));
|
emit(AdditionalItemsErrorState(e.toString()));
|
||||||
|
|
|
@ -51,10 +51,13 @@ class LearningDevelopmentBloc
|
||||||
attachmentCategories =
|
attachmentCategories =
|
||||||
await AttachmentServices.instance.getCategories();
|
await AttachmentServices.instance.getCategories();
|
||||||
}
|
}
|
||||||
|
if(learningsAndDevelopments.isEmpty){
|
||||||
List<LearningDevelopement> learnings = await LearningDevelopmentServices
|
List<LearningDevelopement> learnings = await LearningDevelopmentServices
|
||||||
.instance
|
.instance
|
||||||
.getLearningDevelopments(event.profileId, event.token);
|
.getLearningDevelopments(event.profileId, event.token);
|
||||||
learningsAndDevelopments = learnings;
|
learningsAndDevelopments = learnings;
|
||||||
|
}
|
||||||
|
|
||||||
emit(LearningDevelopmentLoadedState(
|
emit(LearningDevelopmentLoadedState(
|
||||||
learningsAndDevelopment: learningsAndDevelopments,attachmentCategory: attachmentCategories));
|
learningsAndDevelopment: learningsAndDevelopments,attachmentCategory: attachmentCategories));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -64,6 +64,7 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
|
||||||
primaryBasicInformation: globalCurrentProfile!));
|
primaryBasicInformation: globalCurrentProfile!));
|
||||||
} else {
|
} else {
|
||||||
currentProfileInformation = event.primaryBasicInformation;
|
currentProfileInformation = event.primaryBasicInformation;
|
||||||
|
globalCurrentProfile = currentProfileInformation;
|
||||||
emit(BasicInformationProfileLoaded(
|
emit(BasicInformationProfileLoaded(
|
||||||
primaryBasicInformation: currentProfileInformation!));
|
primaryBasicInformation: currentProfileInformation!));
|
||||||
}
|
}
|
||||||
|
@ -108,7 +109,7 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
|
||||||
0, ProfileOtherInfo(id: null, name: "NONE", description: null));
|
0, ProfileOtherInfo(id: null, name: "NONE", description: null));
|
||||||
}
|
}
|
||||||
emit(BasicInformationEditingState(
|
emit(BasicInformationEditingState(
|
||||||
primaryInformation: currentProfileInformation!,
|
primaryInformation: globalCurrentProfile!,
|
||||||
extensions: nameExtensions,
|
extensions: nameExtensions,
|
||||||
sexes: sexes,
|
sexes: sexes,
|
||||||
bloodTypes: bloodType,
|
bloodTypes: bloodType,
|
||||||
|
|
|
@ -13,9 +13,12 @@ class GetAgencies extends AgencyEvent{
|
||||||
class AddAgency extends AgencyEvent{
|
class AddAgency extends AgencyEvent{
|
||||||
final Agency agency;
|
final Agency agency;
|
||||||
const AddAgency({required this.agency});
|
const AddAgency({required this.agency});
|
||||||
|
List<Object> get props => [agency
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
class GetEstPointPersonAgencies extends AgencyEvent{
|
class GetEstPointPersonAgencies extends AgencyEvent{
|
||||||
final List<AssignedArea>? assignedAreas;
|
final List<AssignedArea>? assignedAreas;
|
||||||
const GetEstPointPersonAgencies({required this.assignedAreas});
|
const GetEstPointPersonAgencies({required this.assignedAreas});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ class AssignAreaBloc extends Bloc<AssignAreaEvent, AssignAreaState> {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
on<AddAssignArea>((event, emit) async {
|
on<AddAssignArea>((event, emit) async {
|
||||||
// try {
|
try {
|
||||||
emit(AssignAreaLoadingState());
|
emit(AssignAreaLoadingState());
|
||||||
Map<dynamic, dynamic> response = await RbacAssignedAreaServices.instance
|
Map<dynamic, dynamic> response = await RbacAssignedAreaServices.instance
|
||||||
.add(
|
.add(
|
||||||
|
@ -77,11 +77,6 @@ class AssignAreaBloc extends Bloc<AssignAreaEvent, AssignAreaState> {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// newAssignArea = userAssignedAreas.firstWhere((var element) {
|
|
||||||
// return element.assignedRole?.role?.id == event.roleId &&
|
|
||||||
// element.assignedRole?.user?.id == event.userId;
|
|
||||||
// });
|
|
||||||
|
|
||||||
if (newAssignArea?.assignedArea != null) {
|
if (newAssignArea?.assignedArea != null) {
|
||||||
userAssignedAreas.removeWhere((element) =>
|
userAssignedAreas.removeWhere((element) =>
|
||||||
element.assignedRole!.role!.id == event.roleId &&
|
element.assignedRole!.role!.id == event.roleId &&
|
||||||
|
@ -120,8 +115,8 @@ class AssignAreaBloc extends Bloc<AssignAreaEvent, AssignAreaState> {
|
||||||
newAreas.add(newArea);
|
newAreas.add(newArea);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newAssignArea?.assignedArea = newAreas;
|
newAssignArea.assignedArea = newAreas;
|
||||||
userAssignedAreas.add(newAssignArea!);
|
userAssignedAreas.add(newAssignArea);
|
||||||
//// purok
|
//// purok
|
||||||
}
|
}
|
||||||
if (event.areaTypeId == 2) {
|
if (event.areaTypeId == 2) {
|
||||||
|
@ -149,8 +144,8 @@ class AssignAreaBloc extends Bloc<AssignAreaEvent, AssignAreaState> {
|
||||||
newAreas.add(newArea);
|
newAreas.add(newArea);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newAssignArea?.assignedArea = newAreas;
|
newAssignArea.assignedArea = newAreas;
|
||||||
userAssignedAreas.add(newAssignArea!);
|
userAssignedAreas.add(newAssignArea);
|
||||||
}
|
}
|
||||||
////statiom
|
////statiom
|
||||||
if (event.areaTypeId == 4) {
|
if (event.areaTypeId == 4) {
|
||||||
|
@ -200,8 +195,8 @@ class AssignAreaBloc extends Bloc<AssignAreaEvent, AssignAreaState> {
|
||||||
newAreas.add(newArea);
|
newAreas.add(newArea);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newAssignArea?.assignedArea = newAreas;
|
newAssignArea.assignedArea = newAreas;
|
||||||
userAssignedAreas.add(newAssignArea!);
|
userAssignedAreas.add(newAssignArea);
|
||||||
}
|
}
|
||||||
////agency
|
////agency
|
||||||
if (event.areaTypeId == 3) {
|
if (event.areaTypeId == 3) {
|
||||||
|
@ -231,16 +226,16 @@ class AssignAreaBloc extends Bloc<AssignAreaEvent, AssignAreaState> {
|
||||||
newAreas.add(newArea);
|
newAreas.add(newArea);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newAssignArea?.assignedArea = newAreas;
|
newAssignArea.assignedArea = newAreas;
|
||||||
userAssignedAreas.add(newAssignArea!);
|
userAssignedAreas.add(newAssignArea);
|
||||||
}
|
}
|
||||||
emit(AssignAreaAddedState(response: response));
|
emit(AssignAreaAddedState(response: response));
|
||||||
} else {
|
} else {
|
||||||
emit(AssignAreaAddedState(response: response));
|
emit(AssignAreaAddedState(response: response));
|
||||||
}
|
}
|
||||||
// } catch (e) {
|
} catch (e) {
|
||||||
// emit(AssignAreaErorState(message: e.toString()));
|
emit(AssignAreaErorState(message: e.toString()));
|
||||||
// }
|
}
|
||||||
});
|
});
|
||||||
on<LoadAssignedAreas>((event, emit) async {
|
on<LoadAssignedAreas>((event, emit) async {
|
||||||
emit(AssignedAreaLoadedState(
|
emit(AssignedAreaLoadedState(
|
||||||
|
|
|
@ -66,7 +66,7 @@ class ModuleObjectsBloc extends Bloc<ModuleObjectsEvent, ModuleObjectsState> {
|
||||||
emit(ModuleObjectLoadingState());
|
emit(ModuleObjectLoadingState());
|
||||||
try {
|
try {
|
||||||
bool success = await RbacModuleObjectsServices.instance
|
bool success = await RbacModuleObjectsServices.instance
|
||||||
.deleteRbacModuleObject(moduleObjectId: event.moduleObjectId);
|
.delete(moduleObjectId: event.moduleObjectId);
|
||||||
if (success) {
|
if (success) {
|
||||||
moduleObjects
|
moduleObjects
|
||||||
.removeWhere((element) => element.id == event.moduleObjectId);
|
.removeWhere((element) => element.id == event.moduleObjectId);
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/rbac/permission.dart';
|
||||||
|
import 'package:unit2/model/rbac/permission_assignment.dart';
|
||||||
|
import 'package:unit2/model/rbac/rbac.dart';
|
||||||
|
import 'package:unit2/sevices/roles/rbac_operations/permission_assignment_services.dart';
|
||||||
|
import 'package:unit2/sevices/roles/rbac_operations/permission_service.dart';
|
||||||
|
import 'package:unit2/sevices/roles/rbac_operations/role_services.dart';
|
||||||
|
|
||||||
|
part 'permission_assignment_event.dart';
|
||||||
|
part 'permission_assignment_state.dart';
|
||||||
|
|
||||||
|
class PermissionAssignmentBloc
|
||||||
|
extends Bloc<PermissionAssignmentEvent, PermissionAssignmentState> {
|
||||||
|
PermissionAssignmentBloc() : super(PermissionAssignmentInitial()) {
|
||||||
|
List<PermissionAssignment> permissionAssignments = [];
|
||||||
|
List<RBACPermission> permissions = [];
|
||||||
|
List<RBAC> roles = [];
|
||||||
|
on<GetPermissionAssignments>((event, emit) async {
|
||||||
|
try {
|
||||||
|
emit(PermissionAssignmentLoadingScreen());
|
||||||
|
if (permissionAssignments.isEmpty) {
|
||||||
|
permissionAssignments = await RbacPermissionAssignmentServices
|
||||||
|
.instance
|
||||||
|
.getPermissionAssignment();
|
||||||
|
}
|
||||||
|
if (permissions.isEmpty) {
|
||||||
|
permissions =
|
||||||
|
await RbacPermissionServices.instance.getRbacPermission();
|
||||||
|
}
|
||||||
|
if (roles.isEmpty) {
|
||||||
|
roles = await RbacRoleServices.instance.getRbacRoles();
|
||||||
|
}
|
||||||
|
emit(PermissionAssignmentLoadedState(
|
||||||
|
permissionAssignments: permissionAssignments,
|
||||||
|
permissions: permissions,
|
||||||
|
roles: roles));
|
||||||
|
} catch (e) {
|
||||||
|
emit(PermissionAssignmentErrorState(message: e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<AddPersmissionAssignment>((event, emit) async {
|
||||||
|
try {
|
||||||
|
emit(PermissionAssignmentLoadingScreen());
|
||||||
|
Map<dynamic, dynamic> statusResponse =
|
||||||
|
await RbacPermissionAssignmentServices.instance
|
||||||
|
.addPermissionAssignment(
|
||||||
|
assignerId: event.assignerId,
|
||||||
|
opsId: event.opsId,
|
||||||
|
roleId: event.roleId);
|
||||||
|
if (statusResponse['success']) {
|
||||||
|
if (statusResponse['data'] != null) {
|
||||||
|
for (var rbac in statusResponse['data']) {
|
||||||
|
PermissionAssignment permissionAssignment =
|
||||||
|
PermissionAssignment.fromJson(rbac);
|
||||||
|
permissionAssignments.add(permissionAssignment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
emit(PermissionAssignmentAddedState(status: statusResponse));
|
||||||
|
} else {
|
||||||
|
emit(PermissionAssignmentAddedState(status: statusResponse));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
emit(PermissionAssignmentErrorState(message: e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<DeletePermissionAssignment>((event, emit) async {
|
||||||
|
try {
|
||||||
|
emit(PermissionAssignmentLoadingScreen());
|
||||||
|
bool success = await RbacPermissionAssignmentServices.instance
|
||||||
|
.deletePermissionAssignment(id: event.id);
|
||||||
|
if (success) {
|
||||||
|
permissionAssignments
|
||||||
|
.removeWhere((element) => element.id == event.id);
|
||||||
|
}
|
||||||
|
emit(PermissionAssignmentDeletedState(success: success));
|
||||||
|
} catch (e) {
|
||||||
|
emit(PermissionAssignmentErrorState(message: e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
part of 'permission_assignment_bloc.dart';
|
||||||
|
|
||||||
|
class PermissionAssignmentEvent extends Equatable {
|
||||||
|
const PermissionAssignmentEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class GetPermissionAssignments extends PermissionAssignmentEvent{
|
||||||
|
|
||||||
|
}
|
||||||
|
class DeletePermissionAssignment extends PermissionAssignmentEvent{
|
||||||
|
final int id;
|
||||||
|
const DeletePermissionAssignment({required this.id});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [id];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddPersmissionAssignment extends PermissionAssignmentEvent{
|
||||||
|
final int assignerId;
|
||||||
|
final List<int> opsId;
|
||||||
|
final int roleId;
|
||||||
|
const AddPersmissionAssignment({required this.assignerId, required this.opsId, required this.roleId});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [assignerId,opsId,roleId];
|
||||||
|
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue