Merge pull request 'consol/feature/passo/PASSO-#18-Merge-PASSO-App-into-UniT-App__develop' (#33) from consol/feature/passo/PASSO-#18-Merge-PASSO-App-into-UniT-App__develop into develop
Reviewed-on: http://git.agusandelnorte.gov.ph:3000/SoftwareDevelopmentSection/unit2-null-safety-repository/pulls/33feature/passo/PASSO-#1-Sync-data-from-device-to-postgre-and-vice-versa
commit
f791d26712
|
@ -27,7 +27,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion flutter.compileSdkVersion
|
compileSdkVersion flutter.compileSdkVersion
|
||||||
ndkVersion flutter.ndkVersion
|
ndkVersion "25.1.8937393"
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/barangay.dart';
|
||||||
|
import 'package:unit2/sevices/passo/barangay.dart';
|
||||||
|
|
||||||
|
part 'barangay_event.dart';
|
||||||
|
part 'barangay_state.dart';
|
||||||
|
|
||||||
|
class BarangayBloc extends Bloc<BarangayEvent, BarangayState> {
|
||||||
|
BarangayBloc() : super(BarangayInitial()) {
|
||||||
|
on<LoadBarangay>((event, emit) async {
|
||||||
|
emit(BarangayLoading());
|
||||||
|
try {
|
||||||
|
final barangay = await BarangayServices.instance.fetch(event.id);
|
||||||
|
emit(BarangayLoaded(barangay));
|
||||||
|
} catch (e) {
|
||||||
|
emit(BarangayErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
part of 'barangay_bloc.dart';
|
||||||
|
|
||||||
|
abstract class BarangayEvent extends Equatable {
|
||||||
|
const BarangayEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadBarangay extends BarangayEvent {
|
||||||
|
final String id;
|
||||||
|
|
||||||
|
const LoadBarangay({required this.id});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [id];
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
part of 'barangay_bloc.dart';
|
||||||
|
|
||||||
|
abstract class BarangayState extends Equatable {
|
||||||
|
const BarangayState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class BarangayInitial extends BarangayState {}
|
||||||
|
|
||||||
|
class BarangayLoading extends BarangayState {}
|
||||||
|
|
||||||
|
class BarangayLoaded extends BarangayState {
|
||||||
|
BarangayLoaded(this.brgy);
|
||||||
|
final List<Brgy> brgy;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [brgy];
|
||||||
|
}
|
||||||
|
|
||||||
|
class BarangayErrorState extends BarangayState {
|
||||||
|
BarangayErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/additional_items.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:unit2/sevices/passo/building/additional_items_services.dart';
|
||||||
|
|
||||||
|
part 'additional_item_event.dart';
|
||||||
|
part 'additional_item_state.dart';
|
||||||
|
|
||||||
|
class AdditionalItemBloc
|
||||||
|
extends Bloc<AdditionalItemEvent, AdditionalItemState> {
|
||||||
|
AdditionalItemBloc() : super(AdditionalItemsLoading()) {
|
||||||
|
List<AdditionalItems> globalAdditionalItems = [];
|
||||||
|
on<LoadAdditionalItems>((event, emit) async {
|
||||||
|
emit(AdditionalItemsLoading());
|
||||||
|
try {
|
||||||
|
// final tempID = await SharedPreferences.getInstance();
|
||||||
|
// print(tempID.getInt('tempid'));
|
||||||
|
// final additionalItem = await GetAdditionalItems.getAdditionalItems(
|
||||||
|
// tempID.getInt('tempid'));
|
||||||
|
|
||||||
|
emit(AdditionalItemsLoaded(globalAdditionalItems));
|
||||||
|
} catch (e) {
|
||||||
|
emit(AdditionalItemsErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<AddAdditionalItems>((event, emit) async {
|
||||||
|
http.Response response =
|
||||||
|
(await AdditionalItemsServices.instance.add(event.items))!;
|
||||||
|
print(response.body);
|
||||||
|
|
||||||
|
if (response.statusCode == 201) {
|
||||||
|
var jsonResponse = jsonDecode(response.body);
|
||||||
|
AdditionalItems newAdditional =
|
||||||
|
AdditionalItems.fromJson(jsonResponse['data']);
|
||||||
|
print(jsonResponse['data']);
|
||||||
|
globalAdditionalItems.add(newAdditional);
|
||||||
|
|
||||||
|
emit(AdditionalItemsLoaded(globalAdditionalItems));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<DeleteAdditionalItems>((event, emit) async {
|
||||||
|
print(event.id);
|
||||||
|
http.Response response =
|
||||||
|
(await AdditionalItemsServices.instance.remove(event.id));
|
||||||
|
print(response.statusCode);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
globalAdditionalItems
|
||||||
|
.removeWhere(((AdditionalItems element) => element.id == event.id));
|
||||||
|
emit(AdditionalItemsDeletedState(success: true));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
on<ShowAdditionalItems>((event, emit) async {
|
||||||
|
emit(ShowAddItemsScreen());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
part of 'additional_item_bloc.dart';
|
||||||
|
|
||||||
|
abstract class AdditionalItemEvent extends Equatable {
|
||||||
|
const AdditionalItemEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadAdditionalItems extends AdditionalItemEvent {
|
||||||
|
final List<AdditionalItems> items;
|
||||||
|
|
||||||
|
const LoadAdditionalItems({this.items = const <AdditionalItems>[]});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [items];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddAdditionalItems extends AdditionalItemEvent {
|
||||||
|
final AdditionalItems items;
|
||||||
|
|
||||||
|
const AddAdditionalItems({required this.items});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [items];
|
||||||
|
}
|
||||||
|
|
||||||
|
class DeleteAdditionalItems extends AdditionalItemEvent {
|
||||||
|
final int id;
|
||||||
|
|
||||||
|
const DeleteAdditionalItems({required this.id});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [id];
|
||||||
|
}
|
||||||
|
|
||||||
|
class ShowAdditionalItems extends AdditionalItemEvent {}
|
|
@ -0,0 +1,35 @@
|
||||||
|
part of 'additional_item_bloc.dart';
|
||||||
|
|
||||||
|
abstract class AdditionalItemState extends Equatable {
|
||||||
|
const AdditionalItemState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AdditionalItemsLoading extends AdditionalItemState {}
|
||||||
|
|
||||||
|
class AdditionalItemsLoaded extends AdditionalItemState {
|
||||||
|
const AdditionalItemsLoaded(this.items);
|
||||||
|
final List<AdditionalItems> items;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [items];
|
||||||
|
}
|
||||||
|
|
||||||
|
class ShowAddItemsScreen extends AdditionalItemState {}
|
||||||
|
|
||||||
|
class AdditionalItemsErrorState extends AdditionalItemState {
|
||||||
|
const AdditionalItemsErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AdditionalItemsDeletedState extends AdditionalItemState {
|
||||||
|
final bool success;
|
||||||
|
const AdditionalItemsDeletedState({required this.success});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [success];
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/additional_items.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:unit2/sevices/passo/building/additional_items_services.dart';
|
||||||
|
part 'additional_items_edit_event.dart';
|
||||||
|
part 'additional_items_edit_state.dart';
|
||||||
|
|
||||||
|
class AdditionalItemsEditBloc
|
||||||
|
extends Bloc<AdditionalItemsEditEvent, AdditionalItemsEditState> {
|
||||||
|
AdditionalItemsEditBloc() : super(AdditionalItemsEditInitial()) {
|
||||||
|
List<AdditionalItems> globalAdditionalItemsEdit = [];
|
||||||
|
on<LoadAdditionalItemsEdit>((event, emit) async {
|
||||||
|
if (globalAdditionalItemsEdit.isEmpty) {
|
||||||
|
emit(AdditionalItemsEditLoading());
|
||||||
|
try {
|
||||||
|
final additionalItems =
|
||||||
|
await AdditionalItemsServices.instance.fetch(event.id);
|
||||||
|
|
||||||
|
globalAdditionalItemsEdit
|
||||||
|
.addAll(additionalItems); // Append fetched data
|
||||||
|
emit(AdditionalItemsEditLoaded(globalAdditionalItemsEdit));
|
||||||
|
} catch (e) {
|
||||||
|
emit(AdditionalItemsEditErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
emit(AdditionalItemsEditLoaded(globalAdditionalItemsEdit));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
on<AddAdditionalItemsEdit>((event, emit) async {
|
||||||
|
http.Response response =
|
||||||
|
(await AdditionalItemsServices.instance.add(event.items))!;
|
||||||
|
print(response.statusCode);
|
||||||
|
|
||||||
|
if (response.statusCode == 201) {
|
||||||
|
var jsonResponse = jsonDecode(response.body);
|
||||||
|
AdditionalItems newAdditional =
|
||||||
|
AdditionalItems.fromJson(jsonResponse['data']);
|
||||||
|
print(jsonResponse['data']);
|
||||||
|
globalAdditionalItemsEdit.add(newAdditional);
|
||||||
|
|
||||||
|
emit(AdditionalItemsEditLoaded(globalAdditionalItemsEdit));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<ShowAdditionalItemsEdit>((event, emit) async {
|
||||||
|
emit(ShowAddItemsScreenEdit());
|
||||||
|
});
|
||||||
|
on<DeleteAdditionalItemsEdit>((event, emit) async {
|
||||||
|
print(event.id);
|
||||||
|
http.Response response =
|
||||||
|
(await AdditionalItemsServices.instance.remove(event.id));
|
||||||
|
print(response.statusCode);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
globalAdditionalItemsEdit
|
||||||
|
.removeWhere(((AdditionalItems element) => element.id == event.id));
|
||||||
|
emit(AdditionalItemsEditDeletedState(success: true));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
part of 'additional_items_edit_bloc.dart';
|
||||||
|
|
||||||
|
abstract class AdditionalItemsEditEvent extends Equatable {
|
||||||
|
const AdditionalItemsEditEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadAdditionalItemsEdit extends AdditionalItemsEditEvent {
|
||||||
|
final List<AdditionalItems> items;
|
||||||
|
final int? id;
|
||||||
|
|
||||||
|
const LoadAdditionalItemsEdit({required this.items, this.id});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [items];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddAdditionalItemsEdit extends AdditionalItemsEditEvent {
|
||||||
|
final AdditionalItems items;
|
||||||
|
|
||||||
|
const AddAdditionalItemsEdit({required this.items});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [items];
|
||||||
|
}
|
||||||
|
|
||||||
|
class ShowAdditionalItemsEdit extends AdditionalItemsEditEvent {}
|
||||||
|
|
||||||
|
class DeleteAdditionalItemsEdit extends AdditionalItemsEditEvent {
|
||||||
|
final int id;
|
||||||
|
|
||||||
|
const DeleteAdditionalItemsEdit({required this.id});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [id];
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
part of 'additional_items_edit_bloc.dart';
|
||||||
|
|
||||||
|
abstract class AdditionalItemsEditState extends Equatable {
|
||||||
|
const AdditionalItemsEditState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AdditionalItemsEditInitial extends AdditionalItemsEditState {}
|
||||||
|
|
||||||
|
class AdditionalItemsEditLoading extends AdditionalItemsEditState {}
|
||||||
|
|
||||||
|
class AdditionalItemsEditLoaded extends AdditionalItemsEditState {
|
||||||
|
const AdditionalItemsEditLoaded(this.items);
|
||||||
|
final List<AdditionalItems> items;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [items];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AdditionalItemsEditErrorState extends AdditionalItemsEditState {
|
||||||
|
const AdditionalItemsEditErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
||||||
|
|
||||||
|
class ShowAddItemsScreenEdit extends AdditionalItemsEditState {}
|
||||||
|
|
||||||
|
class AdditionalItemsEditDeletedState extends AdditionalItemsEditState {
|
||||||
|
final bool success;
|
||||||
|
const AdditionalItemsEditDeletedState({required this.success});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [success];
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/class_components.dart';
|
||||||
|
import 'package:unit2/sevices/passo/class_components_services.dart';
|
||||||
|
|
||||||
|
part 'class_components_event.dart';
|
||||||
|
part 'class_components_state.dart';
|
||||||
|
|
||||||
|
class ClassComponentsBloc
|
||||||
|
extends Bloc<ClassComponentsEvent, ClassComponentsState> {
|
||||||
|
ClassComponentsBloc() : super(ClassComponentLoading()) {
|
||||||
|
on<LoadClassComponents>((event, emit) async {
|
||||||
|
emit(ClassComponentLoading());
|
||||||
|
try {
|
||||||
|
final classs = await ClassComponentService.instance.fetch();
|
||||||
|
emit(ClassComponentLoaded(classs));
|
||||||
|
} catch (e) {
|
||||||
|
emit(ClassComponentErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
part of 'class_components_bloc.dart';
|
||||||
|
|
||||||
|
abstract class ClassComponentsEvent extends Equatable {
|
||||||
|
const ClassComponentsEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadClassComponents extends ClassComponentsEvent {
|
||||||
|
final List<ClassComponents> classes;
|
||||||
|
|
||||||
|
const LoadClassComponents({this.classes = const <ClassComponents>[]});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [classes];
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
part of 'class_components_bloc.dart';
|
||||||
|
|
||||||
|
abstract class ClassComponentsState extends Equatable {
|
||||||
|
const ClassComponentsState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class ClassComponentLoading extends ClassComponentsState {}
|
||||||
|
|
||||||
|
class ClassComponentLoaded extends ClassComponentsState {
|
||||||
|
ClassComponentLoaded(this.classes);
|
||||||
|
final List<ClassComponents> classes;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [classes];
|
||||||
|
}
|
||||||
|
|
||||||
|
class ClassComponentErrorState extends ClassComponentsState {
|
||||||
|
ClassComponentErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/general_description.dart';
|
||||||
|
import 'package:unit2/sevices/passo/building/general_description_services.dart';
|
||||||
|
|
||||||
|
part 'general_description_event.dart';
|
||||||
|
part 'general_description_state.dart';
|
||||||
|
|
||||||
|
class GeneralDescriptionBloc
|
||||||
|
extends Bloc<GeneralDescriptionEvent, GeneralDescriptionState> {
|
||||||
|
GeneralDescriptionBloc() : super(GenDescLoading()) {
|
||||||
|
on<LoadGenDesc>((event, emit) async {
|
||||||
|
emit(GenDescLoading());
|
||||||
|
try {
|
||||||
|
final gendesc =
|
||||||
|
await GeneralDescriptionServices.instance.fetch(event.id);
|
||||||
|
emit(GenDescLoaded(gendesc));
|
||||||
|
} catch (e) {
|
||||||
|
emit(GenDescErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
part of 'general_description_bloc.dart';
|
||||||
|
|
||||||
|
abstract class GeneralDescriptionEvent extends Equatable {
|
||||||
|
const GeneralDescriptionEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadGenDesc extends GeneralDescriptionEvent {
|
||||||
|
final GeneralDesc gendesc;
|
||||||
|
final int? id;
|
||||||
|
|
||||||
|
const LoadGenDesc({required this.gendesc, required this.id});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [gendesc];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdateGenDesc extends GeneralDescriptionEvent {
|
||||||
|
final GeneralDesc gendesc;
|
||||||
|
|
||||||
|
const UpdateGenDesc(this.gendesc);
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [gendesc];
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
part of 'general_description_bloc.dart';
|
||||||
|
|
||||||
|
abstract class GeneralDescriptionState extends Equatable {
|
||||||
|
const GeneralDescriptionState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class GenDescLoading extends GeneralDescriptionState {}
|
||||||
|
|
||||||
|
class GenDescLoaded extends GeneralDescriptionState {
|
||||||
|
GenDescLoaded(this.gendesc);
|
||||||
|
final GeneralDesc gendesc;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [gendesc];
|
||||||
|
}
|
||||||
|
|
||||||
|
class GenDescErrorState extends GeneralDescriptionState {
|
||||||
|
GenDescErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/land_ref.dart';
|
||||||
|
import 'package:unit2/sevices/passo/building/landref_services.dart';
|
||||||
|
|
||||||
|
part 'landref_event.dart';
|
||||||
|
part 'landref_state.dart';
|
||||||
|
|
||||||
|
class LandrefBloc extends Bloc<LandrefEvent, LandrefState> {
|
||||||
|
LandrefBloc() : super(LandrefLoading()) {
|
||||||
|
on<LoadLandref>((event, emit) async {
|
||||||
|
emit(LandrefLoading());
|
||||||
|
try {
|
||||||
|
final landRef = await LandRefServices.instance.fetch(event.id);
|
||||||
|
emit(LandrefLoaded(landRef));
|
||||||
|
} catch (e) {
|
||||||
|
emit(LandrefErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
part of 'landref_bloc.dart';
|
||||||
|
|
||||||
|
abstract class LandrefEvent extends Equatable {
|
||||||
|
const LandrefEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadLandref extends LandrefEvent {
|
||||||
|
final LandRef landRef;
|
||||||
|
final int? id;
|
||||||
|
|
||||||
|
const LoadLandref({required this.landRef, required this.id});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [landRef];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdateLandref extends LandrefEvent {
|
||||||
|
final LandRef landRef;
|
||||||
|
|
||||||
|
const UpdateLandref(this.landRef);
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [landRef];
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
part of 'landref_bloc.dart';
|
||||||
|
|
||||||
|
abstract class LandrefState extends Equatable {
|
||||||
|
const LandrefState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LandrefLoading extends LandrefState {}
|
||||||
|
|
||||||
|
class LandrefLoaded extends LandrefState {
|
||||||
|
LandrefLoaded(this.landRef);
|
||||||
|
final LandRef landRef;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [landRef];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LandrefErrorState extends LandrefState {
|
||||||
|
LandrefErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/bldg_loc.dart';
|
||||||
|
import 'package:unit2/sevices/passo/building/location_landref_services.dart';
|
||||||
|
|
||||||
|
part 'location_event.dart';
|
||||||
|
part 'location_state.dart';
|
||||||
|
|
||||||
|
class LocationBloc extends Bloc<LocationEvent, LocationState> {
|
||||||
|
LocationBloc() : super(LocationLoading()) {
|
||||||
|
on<LoadLocation>((event, emit) async {
|
||||||
|
emit(LocationLoading());
|
||||||
|
try {
|
||||||
|
final bldgloc = await LocationLandrefServices.instance.fetch(event.id);
|
||||||
|
emit(LocationLoaded(bldgloc));
|
||||||
|
} catch (e) {
|
||||||
|
emit(LocationErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
part of 'location_bloc.dart';
|
||||||
|
|
||||||
|
abstract class LocationEvent extends Equatable {
|
||||||
|
const LocationEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadLocation extends LocationEvent {
|
||||||
|
final BldgLoc bldgloc;
|
||||||
|
final int? id;
|
||||||
|
|
||||||
|
const LoadLocation({required this.bldgloc, required this.id});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [bldgloc];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdateLocation extends LocationEvent {
|
||||||
|
final BldgLoc bldgloc;
|
||||||
|
|
||||||
|
const UpdateLocation(this.bldgloc);
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [bldgloc];
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
part of 'location_bloc.dart';
|
||||||
|
|
||||||
|
abstract class LocationState extends Equatable {
|
||||||
|
const LocationState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LocationLoading extends LocationState {}
|
||||||
|
|
||||||
|
class LocationLoaded extends LocationState {
|
||||||
|
LocationLoaded(this.bldgloc);
|
||||||
|
final BldgLoc bldgloc;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [bldgloc];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LocationErrorState extends LocationState {
|
||||||
|
LocationErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
import 'package:unit2/model/passo/property_appraisal.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:unit2/sevices/passo/building/property_appraisal_services.dart';
|
||||||
|
|
||||||
|
part 'property_appraisal_event.dart';
|
||||||
|
part 'property_appraisal_state.dart';
|
||||||
|
|
||||||
|
class PropertyAppraisalBloc
|
||||||
|
extends Bloc<PropertyAppraisalEvent, PropertyAppraisalState> {
|
||||||
|
PropertyAppraisalBloc() : super(PropertyAppraisalInitial()) {
|
||||||
|
List<PropertyAppraisal> globalPropertyAppraisal = [];
|
||||||
|
on<LoadPropertyAppraisal>((event, emit) async {
|
||||||
|
emit(PropertyAppraisalLoading());
|
||||||
|
try {
|
||||||
|
final appraisal = await PropertyAppraisalServices.instance.fetch();
|
||||||
|
|
||||||
|
emit(PropertyAppraisalLoaded(appraisal));
|
||||||
|
} catch (e) {
|
||||||
|
emit(PropertyAppraisalErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<AddPropertyAppraisal>((event, emit) async {
|
||||||
|
final tempID = await SharedPreferences.getInstance();
|
||||||
|
|
||||||
|
http.Response response = (await PropertyAppraisalServices.instance
|
||||||
|
.update(event.appraisal, tempID.getInt('tempid')! - 1))!;
|
||||||
|
|
||||||
|
if (response.statusCode == 201) {
|
||||||
|
var jsonResponse = jsonDecode(response.body);
|
||||||
|
PropertyAppraisal newAppraisal =
|
||||||
|
PropertyAppraisal.fromJson(jsonResponse['data']);
|
||||||
|
print("PA");
|
||||||
|
print(newAppraisal);
|
||||||
|
print(response.statusCode);
|
||||||
|
|
||||||
|
emit(PropertyAppraisalLoaded(newAppraisal));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
part of 'property_appraisal_bloc.dart';
|
||||||
|
|
||||||
|
abstract class PropertyAppraisalEvent extends Equatable {
|
||||||
|
const PropertyAppraisalEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadPropertyAppraisal extends PropertyAppraisalEvent {
|
||||||
|
final PropertyAppraisal appraisal;
|
||||||
|
|
||||||
|
const LoadPropertyAppraisal({required this.appraisal});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [appraisal];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddPropertyAppraisal extends PropertyAppraisalEvent {
|
||||||
|
final PropertyAppraisal appraisal;
|
||||||
|
|
||||||
|
const AddPropertyAppraisal({required this.appraisal});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [appraisal];
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
part of 'property_appraisal_bloc.dart';
|
||||||
|
|
||||||
|
abstract class PropertyAppraisalState extends Equatable {
|
||||||
|
const PropertyAppraisalState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class PropertyAppraisalInitial extends PropertyAppraisalState {}
|
||||||
|
|
||||||
|
class PropertyAppraisalLoading extends PropertyAppraisalState {}
|
||||||
|
|
||||||
|
class PropertyAppraisalLoaded extends PropertyAppraisalState {
|
||||||
|
PropertyAppraisalLoaded(this.appraisal);
|
||||||
|
final PropertyAppraisal appraisal;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [appraisal];
|
||||||
|
}
|
||||||
|
|
||||||
|
class PropertyAppraisalErrorState extends PropertyAppraisalState {
|
||||||
|
PropertyAppraisalErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/property_appraisal_edit.dart';
|
||||||
|
import 'package:unit2/sevices/passo/building/property_appraisal_services.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
|
part 'property_appraisal_edit_event.dart';
|
||||||
|
part 'property_appraisal_edit_state.dart';
|
||||||
|
|
||||||
|
class PropertyAppraisalEditBloc
|
||||||
|
extends Bloc<PropertyAppraisalEditEvent, PropertyAppraisalEditState> {
|
||||||
|
PropertyAppraisalEditBloc() : super(PropertyAppraisalEditLoading()) {
|
||||||
|
on<LoadPropertyAppraisalEdit>((event, emit) async {
|
||||||
|
emit(PropertyAppraisalEditLoading());
|
||||||
|
try {
|
||||||
|
final appraisalEdit =
|
||||||
|
await PropertyAppraisalServices.instance.fetchEdit(event.id);
|
||||||
|
emit(PropertyAppraisalEditLoaded(appraisalEdit));
|
||||||
|
} catch (e) {
|
||||||
|
emit(PropertyAppraisalEditErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<UpdatePropertyAppraisalEdit>((event, emit) async {
|
||||||
|
http.Response response = (await PropertyAppraisalServices.instance
|
||||||
|
.updateAppraisal(event.appraisalEdit!, event.id))!;
|
||||||
|
|
||||||
|
if (response.statusCode == 201) {
|
||||||
|
var jsonResponse = jsonDecode(response.body);
|
||||||
|
PropertyAppraisalEdit newAppraisal =
|
||||||
|
PropertyAppraisalEdit.fromJson(jsonResponse['data']);
|
||||||
|
print(response.statusCode);
|
||||||
|
emit(PropertyAppraisalEditLoaded(newAppraisal));
|
||||||
|
|
||||||
|
// emit(PropertyAppraisalLoaded(globalPropertyAppraisal));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
part of 'property_appraisal_edit_bloc.dart';
|
||||||
|
|
||||||
|
abstract class PropertyAppraisalEditEvent extends Equatable {
|
||||||
|
const PropertyAppraisalEditEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadPropertyAppraisalEdit extends PropertyAppraisalEditEvent {
|
||||||
|
final PropertyAppraisalEdit appraisalEdit;
|
||||||
|
final int? id;
|
||||||
|
|
||||||
|
const LoadPropertyAppraisalEdit(
|
||||||
|
{required this.appraisalEdit, required this.id});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [appraisalEdit];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdatePropertyAppraisalEdit extends PropertyAppraisalEditEvent {
|
||||||
|
final PropertyAppraisalEdit? appraisalEdit;
|
||||||
|
final int? id;
|
||||||
|
const UpdatePropertyAppraisalEdit({this.appraisalEdit, required this.id});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [appraisalEdit!];
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
part of 'property_appraisal_edit_bloc.dart';
|
||||||
|
|
||||||
|
abstract class PropertyAppraisalEditState extends Equatable {
|
||||||
|
const PropertyAppraisalEditState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class PropertyAppraisalEditLoading extends PropertyAppraisalEditState {}
|
||||||
|
|
||||||
|
class PropertyAppraisalEditLoaded extends PropertyAppraisalEditState {
|
||||||
|
PropertyAppraisalEditLoaded(this.appraisalEdit);
|
||||||
|
final PropertyAppraisalEdit appraisalEdit;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [appraisalEdit];
|
||||||
|
}
|
||||||
|
|
||||||
|
class PropertyAppraisalEditErrorState extends PropertyAppraisalEditState {
|
||||||
|
PropertyAppraisalEditErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
import 'package:unit2/model/passo/property_assessment.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:unit2/sevices/passo/building/property_assessment_services.dart';
|
||||||
|
|
||||||
|
part 'property_assessment_event.dart';
|
||||||
|
part 'property_assessment_state.dart';
|
||||||
|
|
||||||
|
class PropertyAssessmentBloc
|
||||||
|
extends Bloc<PropertyAssessmentEvent, PropertyAssessmentState> {
|
||||||
|
PropertyAssessmentBloc() : super(PropertyAssessmentInitial()) {
|
||||||
|
List<PropertyAssessment> globalPropertyAssessment = [];
|
||||||
|
on<LoadPropertyAssessment>((event, emit) async {
|
||||||
|
emit(PropertyAssessmentLoading());
|
||||||
|
try {
|
||||||
|
final tempID = await SharedPreferences.getInstance();
|
||||||
|
|
||||||
|
final assessments = await PropertyAssessmentServices.instance
|
||||||
|
.fetch(tempID.getInt('tempid')! + 1);
|
||||||
|
|
||||||
|
emit(PropertyAssessmentLoaded(assessments));
|
||||||
|
} catch (e) {
|
||||||
|
emit(PropertyAssessmentErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<AddPropertyAssessment>((event, emit) async {
|
||||||
|
http.Response response =
|
||||||
|
(await PropertyAssessmentServices.instance.add(event.assessments))!;
|
||||||
|
print('Assessment');
|
||||||
|
print(response.statusCode);
|
||||||
|
print(response.body);
|
||||||
|
if (response.statusCode == 201) {
|
||||||
|
var jsonResponse = jsonDecode(response.body);
|
||||||
|
PropertyAssessment newAssessment =
|
||||||
|
PropertyAssessment.fromJson(jsonResponse['data']);
|
||||||
|
|
||||||
|
globalPropertyAssessment.add(newAssessment);
|
||||||
|
|
||||||
|
emit(PropertyAssessmentLoaded(globalPropertyAssessment));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<UpdatePropertyAssessment>((event, emit) async {
|
||||||
|
final tempID = await SharedPreferences.getInstance();
|
||||||
|
final tempID2 = tempID.getInt('tempid')! - 1;
|
||||||
|
http.Response response = (await PropertyAssessmentServices.instance
|
||||||
|
.update(event.assessment, tempID2))!;
|
||||||
|
print('assessment');
|
||||||
|
print(response.statusCode);
|
||||||
|
print(response.body);
|
||||||
|
// if (response.statusCode == 201) {
|
||||||
|
// final faas = await PropertyInfoRepository.getUsers();
|
||||||
|
// emit(FaasLoaded(faas));
|
||||||
|
// }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
part of 'property_assessment_bloc.dart';
|
||||||
|
|
||||||
|
abstract class PropertyAssessmentEvent extends Equatable {
|
||||||
|
const PropertyAssessmentEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadPropertyAssessment extends PropertyAssessmentEvent {
|
||||||
|
final List<PropertyAssessment> assessments;
|
||||||
|
|
||||||
|
const LoadPropertyAssessment(
|
||||||
|
{this.assessments = const <PropertyAssessment>[]});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [assessments];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddPropertyAssessment extends PropertyAssessmentEvent {
|
||||||
|
final PropertyAssessment assessments;
|
||||||
|
|
||||||
|
const AddPropertyAssessment({required this.assessments});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [assessments];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdatePropertyAssessment extends PropertyAssessmentEvent {
|
||||||
|
// ignore: non_constant_identifier_names
|
||||||
|
final PropertyAssessment assessment;
|
||||||
|
|
||||||
|
// ignore: non_constant_identifier_names
|
||||||
|
const UpdatePropertyAssessment({required this.assessment});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [assessment];
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
part of 'property_assessment_bloc.dart';
|
||||||
|
|
||||||
|
abstract class PropertyAssessmentState extends Equatable {
|
||||||
|
const PropertyAssessmentState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class PropertyAssessmentInitial extends PropertyAssessmentState {}
|
||||||
|
|
||||||
|
class PropertyAssessmentLoading extends PropertyAssessmentState {}
|
||||||
|
|
||||||
|
class PropertyAssessmentLoaded extends PropertyAssessmentState {
|
||||||
|
PropertyAssessmentLoaded(this.assessments);
|
||||||
|
final List<PropertyAssessment> assessments;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [assessments];
|
||||||
|
}
|
||||||
|
|
||||||
|
class PropertyAssessmentErrorState extends PropertyAssessmentState {
|
||||||
|
PropertyAssessmentErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
import 'package:unit2/model/passo/property_assessment_edit.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:unit2/sevices/passo/building/property_assessment_services.dart';
|
||||||
|
part 'property_assessment_edit_event.dart';
|
||||||
|
part 'property_assessment_edit_state.dart';
|
||||||
|
|
||||||
|
class PropertyAssessmentEditBloc
|
||||||
|
extends Bloc<PropertyAssessmentEditEvent, PropertyAssessmentEditState> {
|
||||||
|
PropertyAssessmentEdit globalPropertyAssessmentEdit;
|
||||||
|
PropertyAssessmentEditBloc()
|
||||||
|
: globalPropertyAssessmentEdit = PropertyAssessmentEdit(),
|
||||||
|
super(PropertyAssessmentEditInitial()) {
|
||||||
|
on<LoadPropertyAssessmentEdit>((event, emit) async {
|
||||||
|
emit(PropertyAssessmentEditLoading());
|
||||||
|
try {
|
||||||
|
final tempID = await SharedPreferences.getInstance();
|
||||||
|
|
||||||
|
final assessments =
|
||||||
|
await PropertyAssessmentServices.instance.fetchEdit(event.id);
|
||||||
|
|
||||||
|
emit(PropertyAssessmentEditLoaded(assessments));
|
||||||
|
} catch (e) {
|
||||||
|
emit(PropertyAssessmentEditErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<AddPropertyAssessmentEdit>((event, emit) async {
|
||||||
|
http.Response response = (await PropertyAssessmentServices.instance
|
||||||
|
.addEdit(event.assessmentsEdit))!;
|
||||||
|
print('Assessment');
|
||||||
|
print(response.statusCode);
|
||||||
|
print(response.body);
|
||||||
|
if (response.statusCode == 201) {
|
||||||
|
var jsonResponse = jsonDecode(response.body);
|
||||||
|
PropertyAssessmentEdit newAssessment =
|
||||||
|
PropertyAssessmentEdit.fromJson(jsonResponse['data']);
|
||||||
|
|
||||||
|
globalPropertyAssessmentEdit = newAssessment;
|
||||||
|
|
||||||
|
emit(PropertyAssessmentEditLoaded(globalPropertyAssessmentEdit));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<UpdatePropertyAssessmentEdit>((event, emit) async {
|
||||||
|
final tempID = await SharedPreferences.getInstance();
|
||||||
|
final tempID2 = tempID.getInt('tempid')! - 1;
|
||||||
|
http.Response response = (await PropertyAssessmentServices.instance
|
||||||
|
.updateEdit(event.assessmentsEdit, tempID2))!;
|
||||||
|
print('assessment');
|
||||||
|
print(response.statusCode);
|
||||||
|
print(response.body);
|
||||||
|
// if (response.statusCode == 201) {
|
||||||
|
// final faas = await PropertyInfoRepository.getUsers();
|
||||||
|
// emit(FaasLoaded(faas));
|
||||||
|
// }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
part of 'property_assessment_edit_bloc.dart';
|
||||||
|
|
||||||
|
abstract class PropertyAssessmentEditEvent extends Equatable {
|
||||||
|
const PropertyAssessmentEditEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadPropertyAssessmentEdit extends PropertyAssessmentEditEvent {
|
||||||
|
final PropertyAssessmentEdit assessmentsEdit;
|
||||||
|
final int? id;
|
||||||
|
|
||||||
|
const LoadPropertyAssessmentEdit(
|
||||||
|
{required this.assessmentsEdit, required this.id});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [assessmentsEdit];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddPropertyAssessmentEdit extends PropertyAssessmentEditEvent {
|
||||||
|
final PropertyAssessmentEdit assessmentsEdit;
|
||||||
|
|
||||||
|
const AddPropertyAssessmentEdit({required this.assessmentsEdit});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [assessmentsEdit];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdatePropertyAssessmentEdit extends PropertyAssessmentEditEvent {
|
||||||
|
// ignore: non_constant_identifier_names
|
||||||
|
final PropertyAssessmentEdit assessmentsEdit;
|
||||||
|
|
||||||
|
// ignore: non_constant_identifier_names
|
||||||
|
const UpdatePropertyAssessmentEdit({required this.assessmentsEdit});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [assessmentsEdit];
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
part of 'property_assessment_edit_bloc.dart';
|
||||||
|
|
||||||
|
abstract class PropertyAssessmentEditState extends Equatable {
|
||||||
|
const PropertyAssessmentEditState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class PropertyAssessmentEditInitial extends PropertyAssessmentEditState {}
|
||||||
|
|
||||||
|
class PropertyAssessmentEditLoading extends PropertyAssessmentEditState {}
|
||||||
|
|
||||||
|
class PropertyAssessmentEditLoaded extends PropertyAssessmentEditState {
|
||||||
|
PropertyAssessmentEditLoaded(this.assessmentsEdit);
|
||||||
|
final PropertyAssessmentEdit assessmentsEdit;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [assessmentsEdit];
|
||||||
|
}
|
||||||
|
|
||||||
|
class PropertyAssessmentEditErrorState extends PropertyAssessmentEditState {
|
||||||
|
PropertyAssessmentEditErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
|
@ -0,0 +1,112 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
import 'package:unit2/model/passo/bldg_loc.dart';
|
||||||
|
import 'package:unit2/model/passo/general_description.dart';
|
||||||
|
import 'package:unit2/model/passo/land_ref.dart';
|
||||||
|
import 'package:unit2/model/passo/property_info.dart';
|
||||||
|
import 'package:unit2/model/passo/structural_materials_ii.dart';
|
||||||
|
import 'package:unit2/sevices/passo/building/general_description_services.dart';
|
||||||
|
import 'package:unit2/sevices/passo/building/property_info_services.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
|
import 'package:unit2/sevices/passo/building/structural_material_services.dart';
|
||||||
|
|
||||||
|
part 'property_info_event.dart';
|
||||||
|
part 'property_info_state.dart';
|
||||||
|
|
||||||
|
class PropertyInfoBloc extends Bloc<PropertyInfoEvent, PropertyInfoState> {
|
||||||
|
PropertyInfoBloc() : super(PropertyInfoLoading()) {
|
||||||
|
on<LoadPropertyInfo>((event, emit) async {
|
||||||
|
emit(PropertyInfoLoading());
|
||||||
|
try {
|
||||||
|
final property_info = await PropertyInfoService.instance.fetch();
|
||||||
|
emit(PropertyInfoLoaded(property_info));
|
||||||
|
} catch (e) {
|
||||||
|
emit(PropertyInfoErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<AddPropertyInfo>((event, emit) async {
|
||||||
|
final state = this.state;
|
||||||
|
try {
|
||||||
|
http.Response response =
|
||||||
|
(await PropertyInfoService.instance.add(event.property_info))!;
|
||||||
|
print(response.body);
|
||||||
|
|
||||||
|
if (response.statusCode == 201) {
|
||||||
|
var jsonResponse = jsonDecode(response.body);
|
||||||
|
final tempID = await SharedPreferences.getInstance();
|
||||||
|
print(jsonResponse['data']);
|
||||||
|
await tempID.setInt('tempid', jsonResponse['data']['id'] + 1);
|
||||||
|
final faas = await PropertyInfoService.instance.fetch();
|
||||||
|
emit(PropertyInfoLoaded(faas));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
emit(PropertyInfoErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<UpdatPropertyInfo>(((event, emit) async {
|
||||||
|
final state = this.state;
|
||||||
|
try {
|
||||||
|
http.Response response = (await PropertyInfoService.instance
|
||||||
|
.update(event.property_info, event.property_info.id))!;
|
||||||
|
print('property_info');
|
||||||
|
print(response.body);
|
||||||
|
} catch (e) {
|
||||||
|
emit(PropertyInfoErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
on<UpdateBldgLoc>(((event, emit) async {
|
||||||
|
final state = this.state;
|
||||||
|
try {
|
||||||
|
http.Response response = (await PropertyInfoService.instance
|
||||||
|
.updateBldg(event.bldg_loc, event.bldg_loc.id))!;
|
||||||
|
print('bldgLoc');
|
||||||
|
print(response.statusCode);
|
||||||
|
} catch (e) {
|
||||||
|
emit(PropertyInfoErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
on<UpdateLandRef>(
|
||||||
|
(event, emit) async {
|
||||||
|
final state = this.state;
|
||||||
|
try {
|
||||||
|
http.Response response = (await PropertyInfoService.instance
|
||||||
|
.updateLandRef(event.land_ref, event.land_ref.id))!;
|
||||||
|
print('landref');
|
||||||
|
print(response.body);
|
||||||
|
} catch (e) {
|
||||||
|
emit(PropertyInfoErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
on<UpdateGeneralDesc>((event, emit) async {
|
||||||
|
final state = this.state;
|
||||||
|
try {
|
||||||
|
http.Response response = (await PropertyInfoService.instance
|
||||||
|
.updateGenDesc(event.gen_desc, event.gen_desc.id))!;
|
||||||
|
print('genDesc');
|
||||||
|
print(response.body);
|
||||||
|
} catch (e) {
|
||||||
|
emit(PropertyInfoErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
on<UpdateStrucMaterials>((event, emit) async {
|
||||||
|
final state = this.state;
|
||||||
|
try {
|
||||||
|
final tempID = await SharedPreferences.getInstance();
|
||||||
|
print(tempID.getInt('tempid')! - 1);
|
||||||
|
http.Response response = (await StrucMaterialServices.instance
|
||||||
|
.update(event.data, event.data.id))!;
|
||||||
|
print('struc Material');
|
||||||
|
print(response.body);
|
||||||
|
} catch (e) {
|
||||||
|
emit(PropertyInfoErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
part of 'property_info_bloc.dart';
|
||||||
|
|
||||||
|
abstract class PropertyInfoEvent extends Equatable {
|
||||||
|
const PropertyInfoEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadPropertyInfo extends PropertyInfoEvent {
|
||||||
|
final List<PropertyInfo> property_info;
|
||||||
|
|
||||||
|
const LoadPropertyInfo({this.property_info = const <PropertyInfo>[]});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [property_info];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddPropertyInfo extends PropertyInfoEvent {
|
||||||
|
final PropertyInfo property_info;
|
||||||
|
|
||||||
|
const AddPropertyInfo({required this.property_info});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [property_info];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdatPropertyInfo extends PropertyInfoEvent {
|
||||||
|
// ignore: non_constant_identifier_names
|
||||||
|
final PropertyInfo property_info;
|
||||||
|
|
||||||
|
// ignore: non_constant_identifier_names
|
||||||
|
const UpdatPropertyInfo({required this.property_info});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [property_info];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdateBldgLoc extends PropertyInfoEvent {
|
||||||
|
// ignore: non_constant_identifier_names
|
||||||
|
final BldgLoc bldg_loc;
|
||||||
|
|
||||||
|
// ignore: non_constant_identifier_names
|
||||||
|
const UpdateBldgLoc({required this.bldg_loc});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [bldg_loc];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdateLandRef extends PropertyInfoEvent {
|
||||||
|
final LandRef land_ref;
|
||||||
|
|
||||||
|
const UpdateLandRef({required this.land_ref});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [land_ref];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdateGeneralDesc extends PropertyInfoEvent {
|
||||||
|
final GeneralDesc gen_desc;
|
||||||
|
|
||||||
|
const UpdateGeneralDesc({required this.gen_desc});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [gen_desc];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdateStrucMaterials extends PropertyInfoEvent {
|
||||||
|
final StructureMaterialsII data;
|
||||||
|
|
||||||
|
const UpdateStrucMaterials({required this.data});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [data];
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
part of 'property_info_bloc.dart';
|
||||||
|
|
||||||
|
abstract class PropertyInfoState extends Equatable {
|
||||||
|
const PropertyInfoState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class PropertyInfoLoading extends PropertyInfoState {}
|
||||||
|
|
||||||
|
class PropertyInfoLoaded extends PropertyInfoState {
|
||||||
|
const PropertyInfoLoaded(this.property_info);
|
||||||
|
final List<PropertyInfo> property_info;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [property_info];
|
||||||
|
}
|
||||||
|
|
||||||
|
class PropertyInfoErrorState extends PropertyInfoState {
|
||||||
|
const PropertyInfoErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/structural_materials_ii.dart';
|
||||||
|
import 'package:unit2/model/passo/structureMaterial.dart';
|
||||||
|
import 'package:unit2/sevices/passo/building/structural_material_services.dart';
|
||||||
|
|
||||||
|
part 'structural_material_event.dart';
|
||||||
|
part 'structural_material_state.dart';
|
||||||
|
|
||||||
|
class StructuralMaterialBloc
|
||||||
|
extends Bloc<StructuralMaterialEvent, StructuralMaterialState> {
|
||||||
|
StructuralMaterialBloc() : super(StructuralMaterialInitial()) {
|
||||||
|
on<LoadStructuralMaterial>((event, emit) async {
|
||||||
|
emit(StructuralMaterialsLoading());
|
||||||
|
try {
|
||||||
|
final structure = await StrucMaterialServices.instance.fetch(event.id);
|
||||||
|
emit(StructuralMaterialsLoaded(structure));
|
||||||
|
} catch (e) {
|
||||||
|
emit(StructuralMaterialsErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
part of 'structural_material_bloc.dart';
|
||||||
|
|
||||||
|
class StructuralMaterialEvent extends Equatable {
|
||||||
|
const StructuralMaterialEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadStructuralMaterial extends StructuralMaterialEvent {
|
||||||
|
final StructureMaterials structure;
|
||||||
|
final int? id;
|
||||||
|
|
||||||
|
const LoadStructuralMaterial({required this.structure, required this.id});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [structure];
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
part of 'structural_material_bloc.dart';
|
||||||
|
|
||||||
|
class StructuralMaterialState extends Equatable {
|
||||||
|
const StructuralMaterialState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class StructuralMaterialInitial extends StructuralMaterialState {}
|
||||||
|
|
||||||
|
class StructuralMaterialsLoading extends StructuralMaterialState {}
|
||||||
|
|
||||||
|
class StructuralMaterialsLoaded extends StructuralMaterialState {
|
||||||
|
const StructuralMaterialsLoaded(this.structure);
|
||||||
|
final StructureMaterials structure;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [structure];
|
||||||
|
}
|
||||||
|
|
||||||
|
class StructuralMaterialsErrorState extends StructuralMaterialState {
|
||||||
|
const StructuralMaterialsErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/unit_construct.dart';
|
||||||
|
import 'package:unit2/sevices/passo/unit_construct_services.dart';
|
||||||
|
|
||||||
|
part 'unit_construct_event.dart';
|
||||||
|
part 'unit_construct_state.dart';
|
||||||
|
|
||||||
|
class UnitConstructBloc extends Bloc<UnitConstructEvent, UnitConstructState> {
|
||||||
|
UnitConstructBloc() : super(UnitConstructLoading()) {
|
||||||
|
on<LoadUnitConstruct>((event, emit) async {
|
||||||
|
emit(UnitConstructLoading());
|
||||||
|
try {
|
||||||
|
final unit = await UnitConstructService.instance.fetch();
|
||||||
|
emit(UnitConstructLoaded(unit));
|
||||||
|
} catch (e) {
|
||||||
|
emit(UnitConstructErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
part of 'unit_construct_bloc.dart';
|
||||||
|
|
||||||
|
abstract class UnitConstructEvent extends Equatable {
|
||||||
|
const UnitConstructEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadUnitConstruct extends UnitConstructEvent {
|
||||||
|
final List<UnitConstruct> unit;
|
||||||
|
|
||||||
|
const LoadUnitConstruct({this.unit = const <UnitConstruct>[]});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [unit];
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
part of 'unit_construct_bloc.dart';
|
||||||
|
|
||||||
|
abstract class UnitConstructState extends Equatable {
|
||||||
|
const UnitConstructState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UnitConstructLoading extends UnitConstructState {}
|
||||||
|
|
||||||
|
class UnitConstructLoaded extends UnitConstructState {
|
||||||
|
UnitConstructLoaded(this.unit);
|
||||||
|
final List<UnitConstruct> unit;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [unit];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UnitConstructErrorState extends UnitConstructState {
|
||||||
|
UnitConstructErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
import 'package:unit2/model/passo/land_appr.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:unit2/sevices/passo/land/land_appraisal.dart';
|
||||||
|
part 'land_appraisal_event.dart';
|
||||||
|
part 'land_appraisal_state.dart';
|
||||||
|
|
||||||
|
class LandAppraisalBloc extends Bloc<LandAppraisalEvent, LandAppraisalState> {
|
||||||
|
LandAppraisalBloc() : super(LandAppraisalLoading()) {
|
||||||
|
List<LandAppr> globalLandAppraisal = [];
|
||||||
|
on<LoadLandAppraisal>((event, emit) async {
|
||||||
|
emit(LandAppraisalLoading());
|
||||||
|
try {
|
||||||
|
final tempID = await SharedPreferences.getInstance();
|
||||||
|
print(tempID.getInt('landid'));
|
||||||
|
final additionalItems =
|
||||||
|
await LandAppraisalServices.instance.fetch(tempID.getInt('tempid'));
|
||||||
|
|
||||||
|
globalLandAppraisal
|
||||||
|
.addAll(additionalItems); // Append all items to the list
|
||||||
|
emit(LandAppraisalLoaded(globalLandAppraisal));
|
||||||
|
} catch (e) {
|
||||||
|
emit(LandAppraisalErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<AddLandAppraisal>((event, emit) async {
|
||||||
|
http.Response response =
|
||||||
|
(await LandAppraisalServices.instance.add(event.land_appr))!;
|
||||||
|
print(response.body);
|
||||||
|
|
||||||
|
if (response.statusCode == 201) {
|
||||||
|
var jsonResponse = jsonDecode(response.body);
|
||||||
|
LandAppr newAdditional = LandAppr.fromJson(jsonResponse['data']);
|
||||||
|
print(jsonResponse['data']);
|
||||||
|
globalLandAppraisal.add(newAdditional);
|
||||||
|
|
||||||
|
emit(LandAppraisalLoaded(globalLandAppraisal));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<DeleteLandAppraisal>((event, emit) async {
|
||||||
|
print(event.id);
|
||||||
|
http.Response response =
|
||||||
|
(await LandAppraisalServices.instance.remove(event.id));
|
||||||
|
print(response.statusCode);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
globalLandAppraisal
|
||||||
|
.removeWhere(((LandAppr element) => element.id == event.id));
|
||||||
|
emit(LandAppraisalDeletedState(success: true));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
on<ShowLandAppraisal>((event, emit) async {
|
||||||
|
emit(ShowAddLandAppraisalScreen());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
part of 'land_appraisal_bloc.dart';
|
||||||
|
|
||||||
|
class LandAppraisalEvent extends Equatable {
|
||||||
|
const LandAppraisalEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadLandAppraisal extends LandAppraisalEvent {
|
||||||
|
final List<LandAppr> land_appr;
|
||||||
|
|
||||||
|
const LoadLandAppraisal({this.land_appr = const <LandAppr>[]});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [land_appr];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddLandAppraisal extends LandAppraisalEvent {
|
||||||
|
final LandAppr land_appr;
|
||||||
|
|
||||||
|
const AddLandAppraisal({required this.land_appr});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [land_appr];
|
||||||
|
}
|
||||||
|
|
||||||
|
class DeleteLandAppraisal extends LandAppraisalEvent {
|
||||||
|
final int id;
|
||||||
|
|
||||||
|
const DeleteLandAppraisal({required this.id});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [id];
|
||||||
|
}
|
||||||
|
|
||||||
|
class ShowLandAppraisal extends LandAppraisalEvent {}
|
|
@ -0,0 +1,35 @@
|
||||||
|
part of 'land_appraisal_bloc.dart';
|
||||||
|
|
||||||
|
class LandAppraisalState extends Equatable {
|
||||||
|
const LandAppraisalState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LandAppraisalLoading extends LandAppraisalState {}
|
||||||
|
|
||||||
|
class LandAppraisalLoaded extends LandAppraisalState {
|
||||||
|
const LandAppraisalLoaded(this.land_appr);
|
||||||
|
final List<LandAppr> land_appr;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [land_appr];
|
||||||
|
}
|
||||||
|
|
||||||
|
class ShowAddLandAppraisalScreen extends LandAppraisalState {}
|
||||||
|
|
||||||
|
class LandAppraisalErrorState extends LandAppraisalState {
|
||||||
|
const LandAppraisalErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LandAppraisalDeletedState extends LandAppraisalState {
|
||||||
|
final bool success;
|
||||||
|
const LandAppraisalDeletedState({required this.success});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [success];
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/land_classification.dart';
|
||||||
|
import 'package:unit2/sevices/passo/land/land_classification.dart';
|
||||||
|
|
||||||
|
part 'land_classification_event.dart';
|
||||||
|
part 'land_classification_state.dart';
|
||||||
|
|
||||||
|
class LandClassificationBloc
|
||||||
|
extends Bloc<LandClassificationEvent, LandClassificationState> {
|
||||||
|
LandClassificationBloc() : super(LandClassificationLoading()) {
|
||||||
|
on<LoadLandClassification>((event, emit) async {
|
||||||
|
emit(LandClassificationLoading());
|
||||||
|
try {
|
||||||
|
final classs = await LandClassificationService.instance.fetch();
|
||||||
|
emit(LandClassificationLoaded(classs));
|
||||||
|
} catch (e) {
|
||||||
|
emit(LandClassificationErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
part of 'land_classification_bloc.dart';
|
||||||
|
|
||||||
|
class LandClassificationEvent extends Equatable {
|
||||||
|
const LandClassificationEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadLandClassification extends LandClassificationEvent {
|
||||||
|
final List<LandClassification> land_classification;
|
||||||
|
|
||||||
|
const LoadLandClassification(
|
||||||
|
{this.land_classification = const <LandClassification>[]});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [land_classification];
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
part of 'land_classification_bloc.dart';
|
||||||
|
|
||||||
|
class LandClassificationState extends Equatable {
|
||||||
|
const LandClassificationState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LandClassificationLoading extends LandClassificationState {}
|
||||||
|
|
||||||
|
class LandClassificationLoaded extends LandClassificationState {
|
||||||
|
LandClassificationLoaded(this.land_classification);
|
||||||
|
final List<LandClassification> land_classification;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [land_classification];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LandClassificationErrorState extends LandClassificationState {
|
||||||
|
LandClassificationErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
import 'package:unit2/model/passo/land_ext.dart';
|
||||||
|
import 'package:unit2/sevices/passo/land/land_ext.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
part 'land_ext_event.dart';
|
||||||
|
part 'land_ext_state.dart';
|
||||||
|
|
||||||
|
class LandExtBloc extends Bloc<LandExtEvent, LandExtState> {
|
||||||
|
LandExtBloc() : super(LandExtInitial()) {
|
||||||
|
List<LandExt> globalLandExt = [];
|
||||||
|
on<LoadLandExt>((event, emit) async {
|
||||||
|
emit(LandExtLoading());
|
||||||
|
try {
|
||||||
|
final tempID = await SharedPreferences.getInstance();
|
||||||
|
|
||||||
|
final assessments =
|
||||||
|
await LandExtServices.instance.fetch(tempID.getInt('tempid')! + 1);
|
||||||
|
|
||||||
|
emit(LandExtLoaded(assessments));
|
||||||
|
} catch (e) {
|
||||||
|
emit(LandExtErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<AddLandExt>((event, emit) async {
|
||||||
|
http.Response response =
|
||||||
|
(await LandExtServices.instance.add(event.landext))!;
|
||||||
|
print('landext');
|
||||||
|
print(response.statusCode);
|
||||||
|
print(response.body);
|
||||||
|
if (response.statusCode == 201) {
|
||||||
|
var jsonResponse = jsonDecode(response.body);
|
||||||
|
LandExt newAssessment = LandExt.fromJson(jsonResponse['data']);
|
||||||
|
|
||||||
|
globalLandExt.add(newAssessment);
|
||||||
|
|
||||||
|
emit(LandExtLoaded(globalLandExt));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<UpdateLandExt>((event, emit) async {
|
||||||
|
final tempID = await SharedPreferences.getInstance();
|
||||||
|
final tempID2 = tempID.getInt('tempid')! - 1;
|
||||||
|
http.Response response =
|
||||||
|
(await LandExtServices.instance.update(event.landext, tempID2))!;
|
||||||
|
print('landext');
|
||||||
|
print(response.statusCode);
|
||||||
|
print(response.body);
|
||||||
|
// if (response.statusCode == 201) {
|
||||||
|
// final faas = await PropertyInfoRepository.getUsers();
|
||||||
|
// emit(FaasLoaded(faas));
|
||||||
|
// }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
part of 'land_ext_bloc.dart';
|
||||||
|
|
||||||
|
class LandExtEvent extends Equatable {
|
||||||
|
const LandExtEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadLandExt extends LandExtEvent {
|
||||||
|
final List<LandExt> landext;
|
||||||
|
|
||||||
|
const LoadLandExt({this.landext = const <LandExt>[]});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [landext];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddLandExt extends LandExtEvent {
|
||||||
|
final LandExt landext;
|
||||||
|
|
||||||
|
const AddLandExt({required this.landext});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [landext];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdateLandExt extends LandExtEvent {
|
||||||
|
// ignore: non_constant_identifier_names
|
||||||
|
final LandExt landext;
|
||||||
|
|
||||||
|
// ignore: non_constant_identifier_names
|
||||||
|
const UpdateLandExt({required this.landext});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [landext];
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
part of 'land_ext_bloc.dart';
|
||||||
|
|
||||||
|
class LandExtState extends Equatable {
|
||||||
|
const LandExtState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LandExtInitial extends LandExtState {}
|
||||||
|
|
||||||
|
class LandExtLoading extends LandExtState {}
|
||||||
|
|
||||||
|
class LandExtLoaded extends LandExtState {
|
||||||
|
LandExtLoaded(this.landext);
|
||||||
|
final List<LandExt> landext;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [landext];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LandExtErrorState extends LandExtState {
|
||||||
|
LandExtErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
import 'package:unit2/model/passo/land_property_assessment.dart';
|
||||||
|
import 'package:unit2/sevices/passo/land/land_property_assessment.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
|
part 'land_property_assessment_event.dart';
|
||||||
|
part 'land_property_assessment_state.dart';
|
||||||
|
|
||||||
|
class LandPropertyAssessmentBloc
|
||||||
|
extends Bloc<LandPropertyAssessmentEvent, LandPropertyAssessmentState> {
|
||||||
|
LandPropertyAssessmentBloc() : super(LandPropertyAssessmentLoading()) {
|
||||||
|
List<LandPropertyAssessment> globalLandPropertyAssessment = [];
|
||||||
|
on<LoadLandPropertyAssessment>((event, emit) async {
|
||||||
|
emit(LandPropertyAssessmentLoading());
|
||||||
|
try {
|
||||||
|
final tempID = await SharedPreferences.getInstance();
|
||||||
|
print(tempID.getInt('landid'));
|
||||||
|
final additionalItems = await LandPropertyAssessmentServices.instance
|
||||||
|
.fetch(tempID.getInt('tempid'));
|
||||||
|
|
||||||
|
globalLandPropertyAssessment
|
||||||
|
.addAll(additionalItems); // Append all items to the list
|
||||||
|
emit(LandPropertyAssessmentLoaded(globalLandPropertyAssessment));
|
||||||
|
} catch (e) {
|
||||||
|
emit(LandPropertyAssessmentErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<AddLandPropertyAssessment>((event, emit) async {
|
||||||
|
http.Response response = (await LandPropertyAssessmentServices.instance
|
||||||
|
.add(event.assessment))!;
|
||||||
|
print(response.body);
|
||||||
|
|
||||||
|
if (response.statusCode == 201) {
|
||||||
|
var jsonResponse = jsonDecode(response.body);
|
||||||
|
LandPropertyAssessment newAdditional =
|
||||||
|
LandPropertyAssessment.fromJson(jsonResponse['data']);
|
||||||
|
print(jsonResponse['data']);
|
||||||
|
globalLandPropertyAssessment.add(newAdditional);
|
||||||
|
|
||||||
|
emit(LandPropertyAssessmentLoaded(globalLandPropertyAssessment));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<DeleteLandPropertyAssessment>((event, emit) async {
|
||||||
|
print(event.id);
|
||||||
|
http.Response response =
|
||||||
|
(await LandPropertyAssessmentServices.instance.remove(event.id));
|
||||||
|
print(response.statusCode);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
globalLandPropertyAssessment.removeWhere(
|
||||||
|
((LandPropertyAssessment element) => element.id == event.id));
|
||||||
|
emit(LandPropertyAssessmentDeletedState(success: true));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
on<ShowLandPropertyAssessment>((event, emit) async {
|
||||||
|
emit(ShowAddLandPropertyAssessmentScreen());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
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> assessment;
|
||||||
|
|
||||||
|
const LoadLandPropertyAssessment(
|
||||||
|
{this.assessment = const <LandPropertyAssessment>[]});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [assessment];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddLandPropertyAssessment extends LandPropertyAssessmentEvent {
|
||||||
|
final LandPropertyAssessment assessment;
|
||||||
|
|
||||||
|
const AddLandPropertyAssessment({required this.assessment});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [assessment];
|
||||||
|
}
|
||||||
|
|
||||||
|
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,35 @@
|
||||||
|
part of 'land_property_assessment_bloc.dart';
|
||||||
|
|
||||||
|
class LandPropertyAssessmentState extends Equatable {
|
||||||
|
const LandPropertyAssessmentState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LandPropertyAssessmentLoading extends LandPropertyAssessmentState {}
|
||||||
|
|
||||||
|
class LandPropertyAssessmentLoaded extends LandPropertyAssessmentState {
|
||||||
|
const LandPropertyAssessmentLoaded(this.assessment);
|
||||||
|
final List<LandPropertyAssessment> assessment;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [assessment];
|
||||||
|
}
|
||||||
|
|
||||||
|
class ShowAddLandPropertyAssessmentScreen 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,65 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
import 'package:unit2/model/passo/land_property_boundaries.dart';
|
||||||
|
import 'package:unit2/model/passo/land_property_loc.dart';
|
||||||
|
import 'package:unit2/model/passo/land_property_owner.dart';
|
||||||
|
import 'package:unit2/sevices/passo/land/land_boundaries.dart';
|
||||||
|
import 'package:unit2/sevices/passo/land/land_location.dart';
|
||||||
|
import 'package:unit2/sevices/passo/land/land_property_owner.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
part 'land_property_owner_info_event.dart';
|
||||||
|
part 'land_property_owner_info_state.dart';
|
||||||
|
|
||||||
|
class LandPropertyOwnerInfoBloc
|
||||||
|
extends Bloc<LandPropertyOwnerInfoEvent, LandPropertyOwnerInfoState> {
|
||||||
|
LandPropertyOwnerInfoBloc() : super(LandLoading()) {
|
||||||
|
on<LoadLand>((event, emit) async {
|
||||||
|
emit(LandLoading());
|
||||||
|
try {
|
||||||
|
final faas = await LandServices.instance.fetch();
|
||||||
|
emit(LandLoaded(faas));
|
||||||
|
} catch (e) {
|
||||||
|
emit(LandErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<AddPropertyOwnerLand>((event, emit) async {
|
||||||
|
http.Response response = (await LandServices.instance.add(event.land))!;
|
||||||
|
|
||||||
|
if (response.statusCode == 201) {
|
||||||
|
var jsonResponse = jsonDecode(response.body);
|
||||||
|
var details = jsonResponse['data']['details'];
|
||||||
|
|
||||||
|
if (details != null) {
|
||||||
|
var id = details['id'];
|
||||||
|
final tempID = await SharedPreferences.getInstance();
|
||||||
|
print(id);
|
||||||
|
await tempID.setInt('landid', id + 1);
|
||||||
|
final faas = await LandServices.instance.fetch();
|
||||||
|
emit(LandLoaded(faas));
|
||||||
|
} else {
|
||||||
|
print("No 'details' object found in the response.");
|
||||||
|
// Handle the case when 'details' is missing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
on<UpdateLandLoc>((event, emit) async {
|
||||||
|
final state = this.state;
|
||||||
|
http.Response response = (await LandLocationService.instance
|
||||||
|
.update(event.land_loc, event.land_loc.id))!;
|
||||||
|
print('Land LOc');
|
||||||
|
print(response.body);
|
||||||
|
});
|
||||||
|
|
||||||
|
on<UpdateLandBoundaries>((event, emit) async {
|
||||||
|
final state = this.state;
|
||||||
|
http.Response response = (await LandBoundariesService.instance
|
||||||
|
.update(event.land_boundaries, event.land_boundaries.id))!;
|
||||||
|
print('Land Boundaries');
|
||||||
|
print(response.body);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
part of 'land_property_owner_info_bloc.dart';
|
||||||
|
|
||||||
|
class LandPropertyOwnerInfoEvent extends Equatable {
|
||||||
|
const LandPropertyOwnerInfoEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadLand extends LandPropertyOwnerInfoEvent {
|
||||||
|
final List<LandPropertyOwner> land;
|
||||||
|
|
||||||
|
const LoadLand({this.land = const <LandPropertyOwner>[]});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [land];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddPropertyOwnerLand extends LandPropertyOwnerInfoEvent {
|
||||||
|
final LandPropertyOwner land;
|
||||||
|
|
||||||
|
const AddPropertyOwnerLand({required this.land});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [land];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdateLandLoc extends LandPropertyOwnerInfoEvent {
|
||||||
|
// ignore: non_constant_identifier_names
|
||||||
|
final LandPropertyLoc land_loc;
|
||||||
|
|
||||||
|
// ignore: non_constant_identifier_names
|
||||||
|
const UpdateLandLoc({required this.land_loc});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [land_loc];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdateLandBoundaries extends LandPropertyOwnerInfoEvent {
|
||||||
|
// ignore: non_constant_identifier_names
|
||||||
|
final LandPropertyBoundaries land_boundaries;
|
||||||
|
|
||||||
|
// ignore: non_constant_identifier_names
|
||||||
|
const UpdateLandBoundaries({required this.land_boundaries});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [land_boundaries];
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
part of 'land_property_owner_info_bloc.dart';
|
||||||
|
|
||||||
|
class LandPropertyOwnerInfoState extends Equatable {
|
||||||
|
const LandPropertyOwnerInfoState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LandLoading extends LandPropertyOwnerInfoState {}
|
||||||
|
|
||||||
|
class LandLoaded extends LandPropertyOwnerInfoState {
|
||||||
|
const LandLoaded(this.land);
|
||||||
|
final List<LandPropertyOwner> land;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [land];
|
||||||
|
}
|
||||||
|
|
||||||
|
// class PropertyAppraisalLoaded extends AssessorsState {
|
||||||
|
// PropertyAppraisalLoaded(this.appraisal);
|
||||||
|
// final List<PropertyAppraisal> appraisal;
|
||||||
|
|
||||||
|
// @override
|
||||||
|
// List<Object> get props => [appraisal];
|
||||||
|
// }
|
||||||
|
|
||||||
|
class LandErrorState extends LandPropertyOwnerInfoState {
|
||||||
|
const LandErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/land_classification.dart';
|
||||||
|
import 'package:unit2/model/passo/land_subclassification.dart';
|
||||||
|
import 'package:unit2/sevices/passo/land/land_classification.dart';
|
||||||
|
import 'package:unit2/sevices/passo/land/land_subclassification.dart';
|
||||||
|
|
||||||
|
part 'land_subclassification_event.dart';
|
||||||
|
part 'land_subclassification_state.dart';
|
||||||
|
|
||||||
|
class LandSubClassificationBloc
|
||||||
|
extends Bloc<LandSubClassificationEvent, LandSubClassificationState> {
|
||||||
|
LandSubClassificationBloc() : super(LandSubClassificationLoading()) {
|
||||||
|
on<LoadLandSubClassification>((event, emit) async {
|
||||||
|
emit(LandSubClassificationLoading());
|
||||||
|
try {
|
||||||
|
final classs = await LandSubClassificationService.instance
|
||||||
|
.fetch(event.cityCode, event.classCode);
|
||||||
|
emit(LandSubClassificationLoaded(classs));
|
||||||
|
} catch (e) {
|
||||||
|
emit(LandSubClassificationErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
part of 'land_subclassification_bloc.dart';
|
||||||
|
|
||||||
|
class LandSubClassificationEvent extends Equatable {
|
||||||
|
const LandSubClassificationEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadLandSubClassification extends LandSubClassificationEvent {
|
||||||
|
final String cityCode;
|
||||||
|
final int classCode;
|
||||||
|
|
||||||
|
const LoadLandSubClassification(
|
||||||
|
{required this.cityCode, required this.classCode});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [cityCode, classCode];
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
part of 'land_subclassification_bloc.dart';
|
||||||
|
|
||||||
|
class LandSubClassificationState extends Equatable {
|
||||||
|
const LandSubClassificationState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LandSubClassificationLoading extends LandSubClassificationState {}
|
||||||
|
|
||||||
|
class LandSubClassificationLoaded extends LandSubClassificationState {
|
||||||
|
LandSubClassificationLoaded(this.land_subclassification);
|
||||||
|
final List<LandSubClassification> land_subclassification;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [land_subclassification];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LandSubClassificationErrorState extends LandSubClassificationState {
|
||||||
|
LandSubClassificationErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/trees_improvements.dart';
|
||||||
|
import 'package:unit2/sevices/passo/land/land_trees_improvements.dart';
|
||||||
|
|
||||||
|
part 'land_trees_improvements_event.dart';
|
||||||
|
part 'land_trees_improvements_state.dart';
|
||||||
|
|
||||||
|
class LandTreesImprovementsBloc
|
||||||
|
extends Bloc<LandTreesImprovementsEvent, LandTreesImprovementsState> {
|
||||||
|
LandTreesImprovementsBloc() : super(LandTreesImprovementsInitial()) {
|
||||||
|
on<LoadLandTreesImprovements>((event, emit) async {
|
||||||
|
emit(LandTreesImprovementsLoading());
|
||||||
|
try {
|
||||||
|
final trees_imp = await LandTreesImprovementsServices.instance.fetch();
|
||||||
|
emit(LandTreesImprovementsLoaded(trees_imp));
|
||||||
|
} catch (e) {
|
||||||
|
emit(LandTreesImprovementsErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
part of 'land_trees_improvements_bloc.dart';
|
||||||
|
|
||||||
|
class LandTreesImprovementsEvent extends Equatable {
|
||||||
|
const LandTreesImprovementsEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadLandTreesImprovements extends LandTreesImprovementsEvent {
|
||||||
|
final List<TreesImprovements> trees_imp;
|
||||||
|
const LoadLandTreesImprovements(
|
||||||
|
{this.trees_imp = const <TreesImprovements>[]});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [trees_imp];
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
part of 'land_trees_improvements_bloc.dart';
|
||||||
|
|
||||||
|
class LandTreesImprovementsState extends Equatable {
|
||||||
|
const LandTreesImprovementsState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LandTreesImprovementsInitial extends LandTreesImprovementsState {}
|
||||||
|
|
||||||
|
class LandTreesImprovementsLoading extends LandTreesImprovementsState {}
|
||||||
|
|
||||||
|
class LandTreesImprovementsLoaded extends LandTreesImprovementsState {
|
||||||
|
LandTreesImprovementsLoaded(this.trees_imp);
|
||||||
|
final List<TreesImprovements> trees_imp;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [trees_imp];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LandTreesImprovementsErrorState extends LandTreesImprovementsState {
|
||||||
|
LandTreesImprovementsErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/land_value_adjustment.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:unit2/sevices/passo/land/land_value_adjustment.dart';
|
||||||
|
part 'land_value_adjustments_event.dart';
|
||||||
|
part 'land_value_adjustments_state.dart';
|
||||||
|
|
||||||
|
class LandValueAdjustmentsBloc
|
||||||
|
extends Bloc<LandValueAdjustmentsEvent, LandValueAdjustmentsState> {
|
||||||
|
LandValueAdjustmentsBloc() : super(LandValueAdjustmentsLoading()) {
|
||||||
|
List<ValueAdjustments> globalLandValueAdjustments = [];
|
||||||
|
on<LoadLandValueAdjustments>((event, emit) async {
|
||||||
|
emit(LandValueAdjustmentsLoading());
|
||||||
|
try {
|
||||||
|
// final tempID = await SharedPreferences.getInstance();
|
||||||
|
// print(tempID.getInt('tempid'));
|
||||||
|
// final additionalItem = await GetLandValueAdjustments.getLandValueAdjustments(
|
||||||
|
// tempID.getInt('tempid'));
|
||||||
|
|
||||||
|
emit(LandValueAdjustmentsLoaded(globalLandValueAdjustments));
|
||||||
|
} catch (e) {
|
||||||
|
emit(LandValueAdjustmentsErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<AddLandValueAdjustments>((event, emit) async {
|
||||||
|
http.Response response =
|
||||||
|
(await ValueAdjustmentsServices.instance.add(event.val_adj))!;
|
||||||
|
print(response.body);
|
||||||
|
|
||||||
|
if (response.statusCode == 201) {
|
||||||
|
var jsonResponse = jsonDecode(response.body);
|
||||||
|
ValueAdjustments newAdditional =
|
||||||
|
ValueAdjustments.fromJson(jsonResponse['data']);
|
||||||
|
print(jsonResponse['data']);
|
||||||
|
globalLandValueAdjustments.add(newAdditional);
|
||||||
|
|
||||||
|
emit(LandValueAdjustmentsLoaded(globalLandValueAdjustments));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<DeleteLandValueAdjustments>((event, emit) async {
|
||||||
|
print(event.id);
|
||||||
|
http.Response response =
|
||||||
|
(await ValueAdjustmentsServices.instance.remove(event.id));
|
||||||
|
print(response.statusCode);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
globalLandValueAdjustments.removeWhere(
|
||||||
|
((ValueAdjustments element) => element.id == event.id));
|
||||||
|
emit(LandValueAdjustmentsDeletedState(success: true));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
on<ShowLandValueAdjustments>((event, emit) async {
|
||||||
|
emit(ShowAddLandValueAdjustmentsScreen());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
part of 'land_value_adjustments_bloc.dart';
|
||||||
|
|
||||||
|
class LandValueAdjustmentsEvent extends Equatable {
|
||||||
|
const LandValueAdjustmentsEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadLandValueAdjustments extends LandValueAdjustmentsEvent {
|
||||||
|
final List<ValueAdjustments> val_adj;
|
||||||
|
|
||||||
|
const LoadLandValueAdjustments({this.val_adj = const <ValueAdjustments>[]});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [val_adj];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddLandValueAdjustments extends LandValueAdjustmentsEvent {
|
||||||
|
final ValueAdjustments val_adj;
|
||||||
|
|
||||||
|
const AddLandValueAdjustments({required this.val_adj});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [val_adj];
|
||||||
|
}
|
||||||
|
|
||||||
|
class DeleteLandValueAdjustments extends LandValueAdjustmentsEvent {
|
||||||
|
final int id;
|
||||||
|
|
||||||
|
const DeleteLandValueAdjustments({required this.id});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [id];
|
||||||
|
}
|
||||||
|
|
||||||
|
class ShowLandValueAdjustments extends LandValueAdjustmentsEvent {}
|
|
@ -0,0 +1,35 @@
|
||||||
|
part of 'land_value_adjustments_bloc.dart';
|
||||||
|
|
||||||
|
class LandValueAdjustmentsState extends Equatable {
|
||||||
|
const LandValueAdjustmentsState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LandValueAdjustmentsLoading extends LandValueAdjustmentsState {}
|
||||||
|
|
||||||
|
class LandValueAdjustmentsLoaded extends LandValueAdjustmentsState {
|
||||||
|
const LandValueAdjustmentsLoaded(this.val_adj);
|
||||||
|
final List<ValueAdjustments> val_adj;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [val_adj];
|
||||||
|
}
|
||||||
|
|
||||||
|
class ShowAddLandValueAdjustmentsScreen extends LandValueAdjustmentsState {}
|
||||||
|
|
||||||
|
class LandValueAdjustmentsErrorState extends LandValueAdjustmentsState {
|
||||||
|
const LandValueAdjustmentsErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LandValueAdjustmentsDeletedState extends LandValueAdjustmentsState {
|
||||||
|
final bool success;
|
||||||
|
const LandValueAdjustmentsDeletedState({required this.success});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [success];
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/other_improvements.dart';
|
||||||
|
import 'package:unit2/sevices/passo/land/land_other_improvements.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
part 'other_improvements_event.dart';
|
||||||
|
part 'other_improvements_state.dart';
|
||||||
|
|
||||||
|
class OtherImprovementsBloc
|
||||||
|
extends Bloc<OtherImprovementsEvent, OtherImprovementsState> {
|
||||||
|
OtherImprovementsBloc() : super(OtherImprovementLoading()) {
|
||||||
|
List<OtherImprovements> globalOtherImprovement = [];
|
||||||
|
on<LoadOtherImprovement>((event, emit) async {
|
||||||
|
emit(OtherImprovementLoading());
|
||||||
|
try {
|
||||||
|
// final tempID = await SharedPreferences.getInstance();
|
||||||
|
// print(tempID.getInt('tempid'));
|
||||||
|
// final additionalItem = await GetOtherImprovement.getOtherImprovement(
|
||||||
|
// tempID.getInt('tempid'));
|
||||||
|
|
||||||
|
emit(OtherImprovementLoaded(globalOtherImprovement));
|
||||||
|
} catch (e) {
|
||||||
|
emit(OtherImprovementErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<AddOtherImprovement>((event, emit) async {
|
||||||
|
http.Response response =
|
||||||
|
(await OtherImprovementServices.instance.add(event.other_imp))!;
|
||||||
|
print(response.body);
|
||||||
|
|
||||||
|
if (response.statusCode == 201) {
|
||||||
|
var jsonResponse = jsonDecode(response.body);
|
||||||
|
OtherImprovements newAdditional =
|
||||||
|
OtherImprovements.fromJson(jsonResponse['data']);
|
||||||
|
print(jsonResponse['data']);
|
||||||
|
globalOtherImprovement.add(newAdditional);
|
||||||
|
|
||||||
|
emit(OtherImprovementLoaded(globalOtherImprovement));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<DeleteOtherImprovement>((event, emit) async {
|
||||||
|
print(event.id);
|
||||||
|
http.Response response =
|
||||||
|
(await OtherImprovementServices.instance.remove(event.id));
|
||||||
|
print(response.statusCode);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
globalOtherImprovement.removeWhere(
|
||||||
|
((OtherImprovements element) => element.id == event.id));
|
||||||
|
emit(OtherImprovementDeletedState(success: true));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
on<ShowOtherImprovement>((event, emit) async {
|
||||||
|
emit(ShowAddOtherImprovementScreen());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
part of 'other_improvements_bloc.dart';
|
||||||
|
|
||||||
|
class OtherImprovementsEvent extends Equatable {
|
||||||
|
const OtherImprovementsEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadOtherImprovement extends OtherImprovementsEvent {
|
||||||
|
final List<OtherImprovements> other_imp;
|
||||||
|
|
||||||
|
const LoadOtherImprovement({this.other_imp = const <OtherImprovements>[]});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [other_imp];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddOtherImprovement extends OtherImprovementsEvent {
|
||||||
|
final OtherImprovements other_imp;
|
||||||
|
|
||||||
|
const AddOtherImprovement({required this.other_imp});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [other_imp];
|
||||||
|
}
|
||||||
|
|
||||||
|
class DeleteOtherImprovement extends OtherImprovementsEvent {
|
||||||
|
final int id;
|
||||||
|
|
||||||
|
const DeleteOtherImprovement({required this.id});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [id];
|
||||||
|
}
|
||||||
|
|
||||||
|
class ShowOtherImprovement extends OtherImprovementsEvent {}
|
|
@ -0,0 +1,35 @@
|
||||||
|
part of 'other_improvements_bloc.dart';
|
||||||
|
|
||||||
|
class OtherImprovementsState extends Equatable {
|
||||||
|
const OtherImprovementsState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class OtherImprovementLoading extends OtherImprovementsState {}
|
||||||
|
|
||||||
|
class OtherImprovementLoaded extends OtherImprovementsState {
|
||||||
|
const OtherImprovementLoaded(this.other_imp);
|
||||||
|
final List<OtherImprovements> other_imp;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [other_imp];
|
||||||
|
}
|
||||||
|
|
||||||
|
class ShowAddOtherImprovementScreen extends OtherImprovementsState {}
|
||||||
|
|
||||||
|
class OtherImprovementErrorState extends OtherImprovementsState {
|
||||||
|
const OtherImprovementErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
||||||
|
|
||||||
|
class OtherImprovementDeletedState extends OtherImprovementsState {
|
||||||
|
final bool success;
|
||||||
|
const OtherImprovementDeletedState({required this.success});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [success];
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/type_of_location.dart';
|
||||||
|
import 'package:unit2/sevices/passo/land/type_of_location.dart';
|
||||||
|
|
||||||
|
part 'type_of_location_event.dart';
|
||||||
|
part 'type_of_location_state.dart';
|
||||||
|
|
||||||
|
class TypeOfLocationBloc
|
||||||
|
extends Bloc<TypeOfLocationEvent, TypeOfLocationState> {
|
||||||
|
TypeOfLocationBloc() : super(TypeOfLocationInitial()) {
|
||||||
|
on<LoadTypeOfLocation>((event, emit) async {
|
||||||
|
emit(TypeOfLocationLoading());
|
||||||
|
try {
|
||||||
|
final locType = await TypeOfLocationServices.instance.fetch();
|
||||||
|
emit(TypeOfLocationLoaded(locType));
|
||||||
|
} catch (e) {
|
||||||
|
emit(TypeOfLocationErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
part of 'type_of_location_bloc.dart';
|
||||||
|
|
||||||
|
class TypeOfLocationEvent extends Equatable {
|
||||||
|
const TypeOfLocationEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadTypeOfLocation extends TypeOfLocationEvent {
|
||||||
|
final List<TypeOfLocation> locType;
|
||||||
|
|
||||||
|
const LoadTypeOfLocation({this.locType = const <TypeOfLocation>[]});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [locType];
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
part of 'type_of_location_bloc.dart';
|
||||||
|
|
||||||
|
class TypeOfLocationState extends Equatable {
|
||||||
|
const TypeOfLocationState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class TypeOfLocationInitial extends TypeOfLocationState {}
|
||||||
|
|
||||||
|
class TypeOfLocationLoading extends TypeOfLocationState {}
|
||||||
|
|
||||||
|
class TypeOfLocationLoaded extends TypeOfLocationState {
|
||||||
|
TypeOfLocationLoaded(this.loc_type);
|
||||||
|
final List<TypeOfLocation> loc_type;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [loc_type];
|
||||||
|
}
|
||||||
|
|
||||||
|
class TypeOfLocationErrorState extends TypeOfLocationState {
|
||||||
|
TypeOfLocationErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/type_of_road.dart';
|
||||||
|
import 'package:unit2/sevices/passo/land/type_of_road.dart';
|
||||||
|
|
||||||
|
part 'type_of_road_event.dart';
|
||||||
|
part 'type_of_road_state.dart';
|
||||||
|
|
||||||
|
class TypeOfRoadBloc extends Bloc<TypeOfRoadEvent, TypeOfRoadState> {
|
||||||
|
TypeOfRoadBloc() : super(TypeOfRoadInitial()) {
|
||||||
|
on<LoadTypeOfRoad>((event, emit) async {
|
||||||
|
emit(TypeOfRoadLoading());
|
||||||
|
try {
|
||||||
|
final roadType = await TypeOfRoadServices.instance.fetch();
|
||||||
|
emit(TypeOfRoadLoaded(roadType));
|
||||||
|
} catch (e) {
|
||||||
|
emit(TypeOfRoadErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
part of 'type_of_road_bloc.dart';
|
||||||
|
|
||||||
|
class TypeOfRoadEvent extends Equatable {
|
||||||
|
const TypeOfRoadEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadTypeOfRoad extends TypeOfRoadEvent {
|
||||||
|
final List<TypeOfRoad> roadType;
|
||||||
|
|
||||||
|
const LoadTypeOfRoad({this.roadType = const <TypeOfRoad>[]});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [roadType];
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
part of 'type_of_road_bloc.dart';
|
||||||
|
|
||||||
|
class TypeOfRoadState extends Equatable {
|
||||||
|
const TypeOfRoadState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class TypeOfRoadInitial extends TypeOfRoadState {}
|
||||||
|
|
||||||
|
class TypeOfRoadLoading extends TypeOfRoadState {}
|
||||||
|
|
||||||
|
class TypeOfRoadLoaded extends TypeOfRoadState {
|
||||||
|
TypeOfRoadLoaded(this.road_type);
|
||||||
|
final List<TypeOfRoad> road_type;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [road_type];
|
||||||
|
}
|
||||||
|
|
||||||
|
class TypeOfRoadErrorState extends TypeOfRoadState {
|
||||||
|
TypeOfRoadErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/memoranda.dart';
|
||||||
|
import 'package:unit2/sevices/passo/memoranda.dart';
|
||||||
|
|
||||||
|
part 'memoranda_event.dart';
|
||||||
|
part 'memoranda_state.dart';
|
||||||
|
|
||||||
|
class MemorandaBloc extends Bloc<MemorandaEvent, MemorandaState> {
|
||||||
|
MemorandaBloc() : super(MemorandaInitial()) {
|
||||||
|
on<LoadMemoranda>((event, emit) async {
|
||||||
|
emit(MemorandaLoading());
|
||||||
|
try {
|
||||||
|
final municipality = await MemorandaServices.instance.fetch();
|
||||||
|
emit(MemorandaLoaded(municipality));
|
||||||
|
} catch (e) {
|
||||||
|
emit(MemorandaErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
part of 'memoranda_bloc.dart';
|
||||||
|
|
||||||
|
class MemorandaEvent extends Equatable {
|
||||||
|
const MemorandaEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadMemoranda extends MemorandaEvent {
|
||||||
|
final List<Memoranda> memoranda;
|
||||||
|
const LoadMemoranda({this.memoranda = const <Memoranda>[]});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [memoranda];
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
part of 'memoranda_bloc.dart';
|
||||||
|
|
||||||
|
class MemorandaState extends Equatable {
|
||||||
|
const MemorandaState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class MemorandaInitial extends MemorandaState {}
|
||||||
|
|
||||||
|
class MemorandaLoading extends MemorandaState {}
|
||||||
|
|
||||||
|
class MemorandaLoaded extends MemorandaState {
|
||||||
|
MemorandaLoaded(this.memorada);
|
||||||
|
final List<Memoranda> memorada;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [memorada];
|
||||||
|
}
|
||||||
|
|
||||||
|
class MemorandaErrorState extends MemorandaState {
|
||||||
|
MemorandaErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/city.dart';
|
||||||
|
import 'package:unit2/sevices/passo/municipality.dart';
|
||||||
|
|
||||||
|
part 'municipality_event.dart';
|
||||||
|
part 'municipality_state.dart';
|
||||||
|
|
||||||
|
class MunicipalityBloc extends Bloc<MunicipalityEvent, MunicipalityState> {
|
||||||
|
MunicipalityBloc() : super(MunicipalityInitial()) {
|
||||||
|
on<LoadMunicipality>((event, emit) async {
|
||||||
|
emit(MunicipalityLoading());
|
||||||
|
try {
|
||||||
|
final municipality = await MunicipalityServices.instance.fetch();
|
||||||
|
emit(MunicipalityLoaded(municipality));
|
||||||
|
} catch (e) {
|
||||||
|
emit(MunicipalityErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
part of 'municipality_bloc.dart';
|
||||||
|
|
||||||
|
class MunicipalityEvent extends Equatable {
|
||||||
|
const MunicipalityEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadMunicipality extends MunicipalityEvent {
|
||||||
|
final List<City> municipality;
|
||||||
|
|
||||||
|
const LoadMunicipality({this.municipality = const <City>[]});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [municipality];
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
part of 'municipality_bloc.dart';
|
||||||
|
|
||||||
|
class MunicipalityState extends Equatable {
|
||||||
|
const MunicipalityState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class MunicipalityInitial extends MunicipalityState {}
|
||||||
|
|
||||||
|
class MunicipalityLoading extends MunicipalityState {}
|
||||||
|
|
||||||
|
class MunicipalityLoaded extends MunicipalityState {
|
||||||
|
MunicipalityLoaded(this.municipality);
|
||||||
|
final List<City> municipality;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [municipality];
|
||||||
|
}
|
||||||
|
|
||||||
|
class MunicipalityErrorState extends MunicipalityState {
|
||||||
|
MunicipalityErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/signatories.dart';
|
||||||
|
import 'package:unit2/sevices/passo/signatories_service.dart';
|
||||||
|
|
||||||
|
part 'signatories_event.dart';
|
||||||
|
part 'signatories_state.dart';
|
||||||
|
|
||||||
|
class SignatoriesBloc extends Bloc<SignatoriesEvent, SignatoriesState> {
|
||||||
|
SignatoriesBloc() : super(SignatoriesInitial()) {
|
||||||
|
on<SignatoriesEvent>((event, emit) async {
|
||||||
|
emit(SignatoriesLoading());
|
||||||
|
try {
|
||||||
|
final signatories = await SignatoriesServices.instance.fetch();
|
||||||
|
emit(SignatoriesLoaded(signatories));
|
||||||
|
} catch (e) {
|
||||||
|
emit(SignatoriesErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
part of 'signatories_bloc.dart';
|
||||||
|
|
||||||
|
abstract class SignatoriesEvent extends Equatable {
|
||||||
|
const SignatoriesEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadSignatories extends SignatoriesEvent {
|
||||||
|
final List<Signatories> signatories;
|
||||||
|
|
||||||
|
const LoadSignatories({this.signatories = const <Signatories>[]});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [signatories];
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
part of 'signatories_bloc.dart';
|
||||||
|
|
||||||
|
abstract class SignatoriesState extends Equatable {
|
||||||
|
const SignatoriesState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class SignatoriesInitial extends SignatoriesState {}
|
||||||
|
|
||||||
|
class SignatoriesLoading extends SignatoriesState {}
|
||||||
|
|
||||||
|
class SignatoriesLoaded extends SignatoriesState {
|
||||||
|
SignatoriesLoaded(this.signatories);
|
||||||
|
final List<Signatories> signatories;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [signatories];
|
||||||
|
}
|
||||||
|
|
||||||
|
class SignatoriesErrorState extends SignatoriesState {
|
||||||
|
SignatoriesErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
|
@ -0,0 +1,93 @@
|
||||||
|
// To parse this JSON data, do
|
||||||
|
//
|
||||||
|
// final additionalItems = additionalItemsFromJson(jsonString);
|
||||||
|
|
||||||
|
import 'package:meta/meta.dart';
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
AdditionalItems additionalItemsFromJson(String str) =>
|
||||||
|
AdditionalItems.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String additionalItemsToJson(AdditionalItems data) =>
|
||||||
|
json.encode(data.toJson());
|
||||||
|
|
||||||
|
class AdditionalItems {
|
||||||
|
final int id;
|
||||||
|
final int bldgapprDetailsId;
|
||||||
|
final int classId;
|
||||||
|
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;
|
||||||
|
|
||||||
|
AdditionalItems({
|
||||||
|
required this.id,
|
||||||
|
required this.bldgapprDetailsId,
|
||||||
|
required this.classId,
|
||||||
|
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,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory AdditionalItems.fromJson(Map<String, dynamic> json) =>
|
||||||
|
AdditionalItems(
|
||||||
|
id: json["id"],
|
||||||
|
bldgapprDetailsId: json["bldgappr_details_id"],
|
||||||
|
classId: json["class_id"],
|
||||||
|
className: json["class_name"],
|
||||||
|
structType: json["struct_type"],
|
||||||
|
unitValue: json["unit_value"],
|
||||||
|
baseUnitValue: json["base_unit_value"],
|
||||||
|
area: json["area"],
|
||||||
|
marketValue: json["market_value"],
|
||||||
|
depreciationRate: json["depreciation_rate"],
|
||||||
|
adjustedMarketVal: json["adjusted_market_val"],
|
||||||
|
amtDepreciation: json["amt_depreciation"],
|
||||||
|
painted: json["painted"],
|
||||||
|
secondhand: json["secondhand"],
|
||||||
|
paintedUnitval: json["painted_unitval"],
|
||||||
|
secondhandUnitval: json["secondhand_unitval"],
|
||||||
|
actualUse: json["actual_use"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"id": id,
|
||||||
|
"bldgappr_details_id": bldgapprDetailsId,
|
||||||
|
"class_id": classId,
|
||||||
|
"class_name": className,
|
||||||
|
"struct_type": structType,
|
||||||
|
"unit_value": unitValue,
|
||||||
|
"base_unit_value": baseUnitValue,
|
||||||
|
"area": area,
|
||||||
|
"market_value": marketValue,
|
||||||
|
"depreciation_rate": depreciationRate,
|
||||||
|
"adjusted_market_val": adjustedMarketVal,
|
||||||
|
"amt_depreciation": amtDepreciation,
|
||||||
|
"painted": painted,
|
||||||
|
"secondhand": secondhand,
|
||||||
|
"painted_unitval": paintedUnitval,
|
||||||
|
"secondhand_unitval": secondhandUnitval,
|
||||||
|
"actual_use": actualUse,
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
// To parse this JSON data, do
|
||||||
|
//
|
||||||
|
// final barangay = barangayFromJson(jsonString);
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
Brgy barangayFromJson(String str) => Brgy.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String barangayToJson(Brgy data) => json.encode(data.toJson());
|
||||||
|
|
||||||
|
class Brgy {
|
||||||
|
final int? barangayId;
|
||||||
|
final String? barangayCode;
|
||||||
|
final String? cityCode;
|
||||||
|
final String? barangayDescription;
|
||||||
|
|
||||||
|
Brgy({
|
||||||
|
this.barangayId,
|
||||||
|
this.barangayCode,
|
||||||
|
this.cityCode,
|
||||||
|
this.barangayDescription,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory Brgy.fromJson(Map<String, dynamic> json) => Brgy(
|
||||||
|
barangayId: json["barangay_id"],
|
||||||
|
barangayCode: json["barangay_code"],
|
||||||
|
cityCode: json["city_code"],
|
||||||
|
barangayDescription: json["barangay_description"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"barangay_id": barangayId,
|
||||||
|
"barangay_code": barangayCode,
|
||||||
|
"city_code": cityCode,
|
||||||
|
"barangay_description": barangayDescription,
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
// To parse this JSON data, do
|
||||||
|
//
|
||||||
|
// final bldgLoc = bldgLocFromJson(jsonString);
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
BldgLoc bldgLocFromJson(String str) => BldgLoc.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String bldgLocToJson(BldgLoc data) => json.encode(data.toJson());
|
||||||
|
|
||||||
|
class BldgLoc {
|
||||||
|
final int? id;
|
||||||
|
final int? bldgapprDetailsId;
|
||||||
|
final String? assessedById;
|
||||||
|
final String? assessedByName;
|
||||||
|
final DateTime? dateCreated;
|
||||||
|
final DateTime? dateModified;
|
||||||
|
final dynamic street;
|
||||||
|
final dynamic barangay;
|
||||||
|
final dynamic municipality;
|
||||||
|
final dynamic province;
|
||||||
|
|
||||||
|
BldgLoc({
|
||||||
|
this.id,
|
||||||
|
this.bldgapprDetailsId,
|
||||||
|
this.assessedById,
|
||||||
|
this.assessedByName,
|
||||||
|
this.dateCreated,
|
||||||
|
this.dateModified,
|
||||||
|
this.street,
|
||||||
|
this.barangay,
|
||||||
|
this.municipality,
|
||||||
|
this.province,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory BldgLoc.fromJson(Map<String, dynamic> json) => BldgLoc(
|
||||||
|
id: json["id"],
|
||||||
|
bldgapprDetailsId: json["bldgappr_details_id"],
|
||||||
|
assessedById: json["assessed_by_id"],
|
||||||
|
assessedByName: json["assessed_by_name"],
|
||||||
|
dateCreated: json["date_created"] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json["date_created"]),
|
||||||
|
dateModified: json["date_modified"] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json["date_modified"]),
|
||||||
|
street: json["street"],
|
||||||
|
barangay: json["barangay"],
|
||||||
|
municipality: json["municipality"],
|
||||||
|
province: json["province"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"id": id,
|
||||||
|
"bldgappr_details_id": bldgapprDetailsId,
|
||||||
|
"assessed_by_id": assessedById,
|
||||||
|
"assessed_by_name": assessedByName,
|
||||||
|
"date_created": dateCreated?.toIso8601String(),
|
||||||
|
"date_modified": dateModified?.toIso8601String(),
|
||||||
|
"street": street,
|
||||||
|
"barangay": barangay,
|
||||||
|
"municipality": municipality,
|
||||||
|
"province": province,
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
// To parse this JSON data, do
|
||||||
|
//
|
||||||
|
// final city = cityFromJson(jsonString);
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
City cityFromJson(String str) => City.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String cityToJson(City data) => json.encode(data.toJson());
|
||||||
|
|
||||||
|
class City {
|
||||||
|
final String? cityCode;
|
||||||
|
final String? cityDescription;
|
||||||
|
|
||||||
|
City({
|
||||||
|
this.cityCode,
|
||||||
|
this.cityDescription,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory City.fromJson(Map<String, dynamic> json) => City(
|
||||||
|
cityCode: json["city_code"],
|
||||||
|
cityDescription: json["city_description"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"city_code": cityCode,
|
||||||
|
"city_description": cityDescription,
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,93 @@
|
||||||
|
// To parse this JSON data, do
|
||||||
|
//
|
||||||
|
// final classComponents = classComponentsFromJson(jsonString);
|
||||||
|
|
||||||
|
import 'package:meta/meta.dart';
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
ClassComponents classComponentsFromJson(String str) =>
|
||||||
|
ClassComponents.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String classComponentsToJson(ClassComponents data) =>
|
||||||
|
json.encode(data.toJson());
|
||||||
|
|
||||||
|
class ClassComponents {
|
||||||
|
final int id;
|
||||||
|
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 bool withoutBucc;
|
||||||
|
|
||||||
|
ClassComponents({
|
||||||
|
required this.id,
|
||||||
|
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,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory ClassComponents.fromJson(Map<String, dynamic> json) =>
|
||||||
|
ClassComponents(
|
||||||
|
id: json["id"],
|
||||||
|
componentName: json["component_name"],
|
||||||
|
minBaseUnitvalPercent: json["min_base_unitval_percent"],
|
||||||
|
maxBaseUnitvalPercent: json["max_base_unitval_percent"],
|
||||||
|
minUnitvalSqrmtr: json["min_unitval_sqrmtr"],
|
||||||
|
maxUnitvalSqrmtr: json["max_unitval_sqrmtr"],
|
||||||
|
minAddBaseunitval: json["min_add_baseunitval"],
|
||||||
|
maxAddBaseunitval: json["max_add_baseunitval"],
|
||||||
|
minDeductBaserate: json["min_deduct_baserate"],
|
||||||
|
maxDeductBaserate: json["max_deduct_baserate"],
|
||||||
|
minLinearMeter: json["min_linear_meter"],
|
||||||
|
maxLinearMeter: json["max_linear_meter"],
|
||||||
|
minSpacing: json["min_spacing"],
|
||||||
|
maxSpacing: json["max_spacing"],
|
||||||
|
roughFinish: json["rough_finish"],
|
||||||
|
highFinish: json["high_finish"],
|
||||||
|
withoutBucc: json["without_bucc"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"id": id,
|
||||||
|
"component_name": componentName,
|
||||||
|
"min_base_unitval_percent": minBaseUnitvalPercent,
|
||||||
|
"max_base_unitval_percent": maxBaseUnitvalPercent,
|
||||||
|
"min_unitval_sqrmtr": minUnitvalSqrmtr,
|
||||||
|
"max_unitval_sqrmtr": maxUnitvalSqrmtr,
|
||||||
|
"min_add_baseunitval": minAddBaseunitval,
|
||||||
|
"max_add_baseunitval": maxAddBaseunitval,
|
||||||
|
"min_deduct_baserate": minDeductBaserate,
|
||||||
|
"max_deduct_baserate": maxDeductBaserate,
|
||||||
|
"min_linear_meter": minLinearMeter,
|
||||||
|
"max_linear_meter": maxLinearMeter,
|
||||||
|
"min_spacing": minSpacing,
|
||||||
|
"max_spacing": maxSpacing,
|
||||||
|
"rough_finish": roughFinish,
|
||||||
|
"high_finish": highFinish,
|
||||||
|
"without_bucc": withoutBucc,
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,137 @@
|
||||||
|
// To parse this JSON data, do
|
||||||
|
//
|
||||||
|
// final generalDesc = generalDescFromJson(jsonString);
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
GeneralDesc generalDescFromJson(String str) =>
|
||||||
|
GeneralDesc.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String generalDescToJson(GeneralDesc data) => json.encode(data.toJson());
|
||||||
|
|
||||||
|
class GeneralDesc {
|
||||||
|
final int? id;
|
||||||
|
final int? bldgapprDetailsId;
|
||||||
|
final String? assessedById;
|
||||||
|
final String? assessedByName;
|
||||||
|
final DateTime? dateCreated;
|
||||||
|
final DateTime? dateModified;
|
||||||
|
final String? bldgKind;
|
||||||
|
final String? strucType;
|
||||||
|
final String? bldgPermit;
|
||||||
|
final DateTime? dateIssued;
|
||||||
|
final String? cct;
|
||||||
|
final DateTime? certCompletionIssued;
|
||||||
|
final DateTime? certOccupancyIssued;
|
||||||
|
final DateTime? dateCompleted;
|
||||||
|
final DateTime? dateOccupied;
|
||||||
|
final int? bldgAge;
|
||||||
|
final int? noStoreys;
|
||||||
|
final String? area1Stfloor;
|
||||||
|
final String? area2Ndfloor;
|
||||||
|
final String? area3Rdfloor;
|
||||||
|
final String? area4Thfloor;
|
||||||
|
final String? totalFloorArea;
|
||||||
|
final dynamic floorSketch;
|
||||||
|
final String? actualUse;
|
||||||
|
|
||||||
|
GeneralDesc({
|
||||||
|
this.id,
|
||||||
|
this.bldgapprDetailsId,
|
||||||
|
this.assessedById,
|
||||||
|
this.assessedByName,
|
||||||
|
this.dateCreated,
|
||||||
|
this.dateModified,
|
||||||
|
this.bldgKind,
|
||||||
|
this.strucType,
|
||||||
|
this.bldgPermit,
|
||||||
|
this.dateIssued,
|
||||||
|
this.cct,
|
||||||
|
this.certCompletionIssued,
|
||||||
|
this.certOccupancyIssued,
|
||||||
|
this.dateCompleted,
|
||||||
|
this.dateOccupied,
|
||||||
|
this.bldgAge,
|
||||||
|
this.noStoreys,
|
||||||
|
this.area1Stfloor,
|
||||||
|
this.area2Ndfloor,
|
||||||
|
this.area3Rdfloor,
|
||||||
|
this.area4Thfloor,
|
||||||
|
this.totalFloorArea,
|
||||||
|
this.floorSketch,
|
||||||
|
this.actualUse,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory GeneralDesc.fromJson(Map<String, dynamic> json) => GeneralDesc(
|
||||||
|
id: json["id"],
|
||||||
|
bldgapprDetailsId: json["bldgappr_details_id"],
|
||||||
|
assessedById: json["assessed_by_id"],
|
||||||
|
assessedByName: json["assessed_by_name"],
|
||||||
|
dateCreated: json["date_created"] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json["date_created"]),
|
||||||
|
dateModified: json["date_modified"] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json["date_modified"]),
|
||||||
|
bldgKind: json["bldg_kind"],
|
||||||
|
strucType: json["struc_type"],
|
||||||
|
bldgPermit: json["bldg_permit"],
|
||||||
|
dateIssued: json["date_issued"] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json["date_issued"]),
|
||||||
|
cct: json["cct"],
|
||||||
|
certCompletionIssued: json["cert_completion_issued"] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json["cert_completion_issued"]),
|
||||||
|
certOccupancyIssued: json["cert_occupancy_issued"] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json["cert_occupancy_issued"]),
|
||||||
|
dateCompleted: json["date_completed"] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json["date_completed"]),
|
||||||
|
dateOccupied: json["date_occupied"] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json["date_occupied"]),
|
||||||
|
bldgAge: json["bldg_age"],
|
||||||
|
noStoreys: json["no_storeys"],
|
||||||
|
area1Stfloor: json["area_1stfloor"],
|
||||||
|
area2Ndfloor: json["area_2ndfloor"],
|
||||||
|
area3Rdfloor: json["area_3rdfloor"],
|
||||||
|
area4Thfloor: json["area_4thfloor"],
|
||||||
|
totalFloorArea: json["total_floor_area"],
|
||||||
|
floorSketch: json["floor_sketch"],
|
||||||
|
actualUse: json["actual_use"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"id": id,
|
||||||
|
"bldgappr_details_id": bldgapprDetailsId,
|
||||||
|
"assessed_by_id": assessedById,
|
||||||
|
"assessed_by_name": assessedByName,
|
||||||
|
"date_created": dateCreated?.toIso8601String(),
|
||||||
|
"date_modified": dateModified?.toIso8601String(),
|
||||||
|
"bldg_kind": bldgKind,
|
||||||
|
"struc_type": strucType,
|
||||||
|
"bldg_permit": bldgPermit,
|
||||||
|
"date_issued":
|
||||||
|
"${dateIssued!.year.toString().padLeft(4, '0')}-${dateIssued!.month.toString().padLeft(2, '0')}-${dateIssued!.day.toString().padLeft(2, '0')}",
|
||||||
|
"cct": cct,
|
||||||
|
"cert_completion_issued":
|
||||||
|
"${certCompletionIssued!.year.toString().padLeft(4, '0')}-${certCompletionIssued!.month.toString().padLeft(2, '0')}-${certCompletionIssued!.day.toString().padLeft(2, '0')}",
|
||||||
|
"cert_occupancy_issued":
|
||||||
|
"${certOccupancyIssued!.year.toString().padLeft(4, '0')}-${certOccupancyIssued!.month.toString().padLeft(2, '0')}-${certOccupancyIssued!.day.toString().padLeft(2, '0')}",
|
||||||
|
"date_completed":
|
||||||
|
"${dateCompleted!.year.toString().padLeft(4, '0')}-${dateCompleted!.month.toString().padLeft(2, '0')}-${dateCompleted!.day.toString().padLeft(2, '0')}",
|
||||||
|
"date_occupied":
|
||||||
|
"${dateOccupied!.year.toString().padLeft(4, '0')}-${dateOccupied!.month.toString().padLeft(2, '0')}-${dateOccupied!.day.toString().padLeft(2, '0')}",
|
||||||
|
"bldg_age": bldgAge,
|
||||||
|
"no_storeys": noStoreys,
|
||||||
|
"area_1stfloor": area1Stfloor,
|
||||||
|
"area_2ndfloor": area2Ndfloor,
|
||||||
|
"area_3rdfloor": area3Rdfloor,
|
||||||
|
"area_4thfloor": area4Thfloor,
|
||||||
|
"total_floor_area": totalFloorArea,
|
||||||
|
"floor_sketch": floorSketch,
|
||||||
|
"actual_use": actualUse,
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
// To parse this JSON data, do
|
||||||
|
//
|
||||||
|
// final landAppr = landApprFromJson(jsonString);
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
LandAppr landApprFromJson(String str) => LandAppr.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String landApprToJson(LandAppr data) => json.encode(data.toJson());
|
||||||
|
|
||||||
|
class LandAppr {
|
||||||
|
final int? id;
|
||||||
|
final int? landapprDetailsId;
|
||||||
|
final String? classification;
|
||||||
|
final String? subClass;
|
||||||
|
final String? area;
|
||||||
|
final String? unitValue;
|
||||||
|
final String? baseMarketval;
|
||||||
|
|
||||||
|
LandAppr({
|
||||||
|
this.id,
|
||||||
|
this.landapprDetailsId,
|
||||||
|
this.classification,
|
||||||
|
this.subClass,
|
||||||
|
this.area,
|
||||||
|
this.unitValue,
|
||||||
|
this.baseMarketval,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory LandAppr.fromJson(Map<String, dynamic> json) => LandAppr(
|
||||||
|
id: json["id"],
|
||||||
|
landapprDetailsId: json["landappr_details_id"],
|
||||||
|
classification: json["classification"],
|
||||||
|
subClass: json["sub_class"],
|
||||||
|
area: json["area"],
|
||||||
|
unitValue: json["unit_value"],
|
||||||
|
baseMarketval: json["base_marketval"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"id": id,
|
||||||
|
"landappr_details_id": landapprDetailsId,
|
||||||
|
"classification": classification,
|
||||||
|
"sub_class": subClass,
|
||||||
|
"area": area,
|
||||||
|
"unit_value": unitValue,
|
||||||
|
"base_marketval": baseMarketval,
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
// To parse this JSON data, do
|
||||||
|
//
|
||||||
|
// final landClassification = landClassificationFromJson(jsonString);
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
LandClassification landClassificationFromJson(String str) =>
|
||||||
|
LandClassification.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String landClassificationToJson(LandClassification data) =>
|
||||||
|
json.encode(data.toJson());
|
||||||
|
|
||||||
|
class LandClassification {
|
||||||
|
final int? id;
|
||||||
|
final String? classificationCode;
|
||||||
|
final String? description;
|
||||||
|
|
||||||
|
LandClassification({
|
||||||
|
this.id,
|
||||||
|
this.classificationCode,
|
||||||
|
this.description,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory LandClassification.fromJson(Map<String, dynamic> json) =>
|
||||||
|
LandClassification(
|
||||||
|
id: json["id"],
|
||||||
|
classificationCode: json["classification_code"],
|
||||||
|
description: json["description"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"id": id,
|
||||||
|
"classification_code": classificationCode,
|
||||||
|
"description": description,
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,124 @@
|
||||||
|
// To parse this JSON data, do
|
||||||
|
//
|
||||||
|
// final landExt = landExtFromJson(jsonString);
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
LandExt landExtFromJson(String str) => LandExt.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String landExtToJson(LandExt data) => json.encode(data.toJson());
|
||||||
|
|
||||||
|
class LandExt {
|
||||||
|
final int? id;
|
||||||
|
final int? landapprDetailsId;
|
||||||
|
final String? assessedById;
|
||||||
|
final String? assessedByName;
|
||||||
|
final DateTime? dateCreated;
|
||||||
|
final DateTime? dateModified;
|
||||||
|
final bool? taxable;
|
||||||
|
final bool? exempt;
|
||||||
|
final int? qtr;
|
||||||
|
final int? yr;
|
||||||
|
final String? appraisedbyName;
|
||||||
|
final DateTime? appraisedbyDate;
|
||||||
|
final String? recommendapprName;
|
||||||
|
final DateTime? recommendapprDate;
|
||||||
|
final String? approvedbyName;
|
||||||
|
final DateTime? approvedbyDate;
|
||||||
|
final String? memoranda;
|
||||||
|
final String? swornstatementNo;
|
||||||
|
final DateTime? dateReceived;
|
||||||
|
final DateTime? entryDateAssessment;
|
||||||
|
final String? entryDateBy;
|
||||||
|
|
||||||
|
LandExt({
|
||||||
|
this.id,
|
||||||
|
this.landapprDetailsId,
|
||||||
|
this.assessedById,
|
||||||
|
this.assessedByName,
|
||||||
|
this.dateCreated,
|
||||||
|
this.dateModified,
|
||||||
|
this.taxable,
|
||||||
|
this.exempt,
|
||||||
|
this.qtr,
|
||||||
|
this.yr,
|
||||||
|
this.appraisedbyName,
|
||||||
|
this.appraisedbyDate,
|
||||||
|
this.recommendapprName,
|
||||||
|
this.recommendapprDate,
|
||||||
|
this.approvedbyName,
|
||||||
|
this.approvedbyDate,
|
||||||
|
this.memoranda,
|
||||||
|
this.swornstatementNo,
|
||||||
|
this.dateReceived,
|
||||||
|
this.entryDateAssessment,
|
||||||
|
this.entryDateBy,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory LandExt.fromJson(Map<String, dynamic> json) => LandExt(
|
||||||
|
id: json["id"],
|
||||||
|
landapprDetailsId: json["landappr_details_id"],
|
||||||
|
assessedById: json["assessed_by_id"],
|
||||||
|
assessedByName: json["assessed_by_name"],
|
||||||
|
dateCreated: json["date_created"] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json["date_created"]),
|
||||||
|
dateModified: json["date_modified"] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json["date_modified"]),
|
||||||
|
taxable: json["taxable"],
|
||||||
|
exempt: json["exempt"],
|
||||||
|
qtr: json["qtr"],
|
||||||
|
yr: json["yr"],
|
||||||
|
appraisedbyName: json["appraisedby_name"],
|
||||||
|
appraisedbyDate: json["appraisedby_date"] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json["appraisedby_date"]),
|
||||||
|
recommendapprName: json["recommendappr_name"],
|
||||||
|
recommendapprDate: json["recommendappr_date"] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json["recommendappr_date"]),
|
||||||
|
approvedbyName: json["approvedby_name"],
|
||||||
|
approvedbyDate: json["approvedby_date"] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json["approvedby_date"]),
|
||||||
|
memoranda: json["memoranda"],
|
||||||
|
swornstatementNo: json["swornstatement_no"],
|
||||||
|
dateReceived: json["date_received"] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json["date_received"]),
|
||||||
|
entryDateAssessment: json["entry_date_assessment"] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json["entry_date_assessment"]),
|
||||||
|
entryDateBy: json["entry_date_by"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"id": id,
|
||||||
|
"landappr_details_id": landapprDetailsId,
|
||||||
|
"assessed_by_id": assessedById,
|
||||||
|
"assessed_by_name": assessedByName,
|
||||||
|
"date_created": dateCreated?.toIso8601String(),
|
||||||
|
"date_modified": dateModified?.toIso8601String(),
|
||||||
|
"taxable": taxable,
|
||||||
|
"exempt": exempt,
|
||||||
|
"qtr": qtr,
|
||||||
|
"yr": yr,
|
||||||
|
"appraisedby_name": appraisedbyName,
|
||||||
|
"appraisedby_date":
|
||||||
|
"${appraisedbyDate!.year.toString().padLeft(4, '0')}-${appraisedbyDate!.month.toString().padLeft(2, '0')}-${appraisedbyDate!.day.toString().padLeft(2, '0')}",
|
||||||
|
"recommendappr_name": recommendapprName,
|
||||||
|
"recommendappr_date":
|
||||||
|
"${recommendapprDate!.year.toString().padLeft(4, '0')}-${recommendapprDate!.month.toString().padLeft(2, '0')}-${recommendapprDate!.day.toString().padLeft(2, '0')}",
|
||||||
|
"approvedby_name": approvedbyName,
|
||||||
|
"approvedby_date":
|
||||||
|
"${approvedbyDate!.year.toString().padLeft(4, '0')}-${approvedbyDate!.month.toString().padLeft(2, '0')}-${approvedbyDate!.day.toString().padLeft(2, '0')}",
|
||||||
|
"memoranda": memoranda,
|
||||||
|
"swornstatement_no": swornstatementNo,
|
||||||
|
"date_received":
|
||||||
|
"${dateReceived!.year.toString().padLeft(4, '0')}-${dateReceived!.month.toString().padLeft(2, '0')}-${dateReceived!.day.toString().padLeft(2, '0')}",
|
||||||
|
"entry_date_assessment":
|
||||||
|
"${entryDateAssessment!.year.toString().padLeft(4, '0')}-${entryDateAssessment!.month.toString().padLeft(2, '0')}-${entryDateAssessment!.day.toString().padLeft(2, '0')}",
|
||||||
|
"entry_date_by": entryDateBy,
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
// To parse this JSON data, do
|
||||||
|
//
|
||||||
|
// final landPropertyAssessment = landPropertyAssessmentFromJson(jsonString);
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
LandPropertyAssessment landPropertyAssessmentFromJson(String str) =>
|
||||||
|
LandPropertyAssessment.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String landPropertyAssessmentToJson(LandPropertyAssessment data) =>
|
||||||
|
json.encode(data.toJson());
|
||||||
|
|
||||||
|
class LandPropertyAssessment {
|
||||||
|
final int? id;
|
||||||
|
final int? landapprDetailsId;
|
||||||
|
final String? actualUse;
|
||||||
|
final String? marketval;
|
||||||
|
final String? assessmentLevel;
|
||||||
|
final String? assessedValue;
|
||||||
|
final String? totalMarketval;
|
||||||
|
final String? totalAssessedval;
|
||||||
|
|
||||||
|
LandPropertyAssessment({
|
||||||
|
this.id,
|
||||||
|
this.landapprDetailsId,
|
||||||
|
this.actualUse,
|
||||||
|
this.marketval,
|
||||||
|
this.assessmentLevel,
|
||||||
|
this.assessedValue,
|
||||||
|
this.totalMarketval,
|
||||||
|
this.totalAssessedval,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory LandPropertyAssessment.fromJson(Map<String, dynamic> json) =>
|
||||||
|
LandPropertyAssessment(
|
||||||
|
id: json["id"],
|
||||||
|
landapprDetailsId: json["landappr_details_id"],
|
||||||
|
actualUse: json["actual_use"],
|
||||||
|
marketval: json["marketval"],
|
||||||
|
assessmentLevel: json["assessment_level"],
|
||||||
|
assessedValue: json["assessed_value"],
|
||||||
|
totalMarketval: json["total_marketval"],
|
||||||
|
totalAssessedval: json["total_assessedval"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"id": id,
|
||||||
|
"landappr_details_id": landapprDetailsId,
|
||||||
|
"actual_use": actualUse,
|
||||||
|
"marketval": marketval,
|
||||||
|
"assessment_level": assessmentLevel,
|
||||||
|
"assessed_value": assessedValue,
|
||||||
|
"total_marketval": totalMarketval,
|
||||||
|
"total_assessedval": totalAssessedval,
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
// To parse this JSON data, do
|
||||||
|
//
|
||||||
|
// final landPropertyBoundaries = landPropertyBoundariesFromJson(jsonString);
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
LandPropertyBoundaries landPropertyBoundariesFromJson(String str) =>
|
||||||
|
LandPropertyBoundaries.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String landPropertyBoundariesToJson(LandPropertyBoundaries data) =>
|
||||||
|
json.encode(data.toJson());
|
||||||
|
|
||||||
|
class LandPropertyBoundaries {
|
||||||
|
final int? id;
|
||||||
|
final int? landapprDetailsId;
|
||||||
|
final String? assessedById;
|
||||||
|
final String? assessedByName;
|
||||||
|
final DateTime? dateCreated;
|
||||||
|
final DateTime? dateModified;
|
||||||
|
final String? north;
|
||||||
|
final String? east;
|
||||||
|
final String? south;
|
||||||
|
final String? west;
|
||||||
|
final dynamic sketch;
|
||||||
|
|
||||||
|
LandPropertyBoundaries({
|
||||||
|
this.id,
|
||||||
|
this.landapprDetailsId,
|
||||||
|
this.assessedById,
|
||||||
|
this.assessedByName,
|
||||||
|
this.dateCreated,
|
||||||
|
this.dateModified,
|
||||||
|
this.north,
|
||||||
|
this.east,
|
||||||
|
this.south,
|
||||||
|
this.west,
|
||||||
|
this.sketch,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory LandPropertyBoundaries.fromJson(Map<String, dynamic> json) =>
|
||||||
|
LandPropertyBoundaries(
|
||||||
|
id: json["id"],
|
||||||
|
landapprDetailsId: json["landappr_details_id"],
|
||||||
|
assessedById: json["assessed_by_id"],
|
||||||
|
assessedByName: json["assessed_by_name"],
|
||||||
|
dateCreated: json["date_created"] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json["date_created"]),
|
||||||
|
dateModified: json["date_modified"] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json["date_modified"]),
|
||||||
|
north: json["north"],
|
||||||
|
east: json["east"],
|
||||||
|
south: json["south"],
|
||||||
|
west: json["west"],
|
||||||
|
sketch: json["sketch"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"id": id,
|
||||||
|
"landappr_details_id": landapprDetailsId,
|
||||||
|
"assessed_by_id": assessedById,
|
||||||
|
"assessed_by_name": assessedByName,
|
||||||
|
"date_created": dateCreated?.toIso8601String(),
|
||||||
|
"date_modified": dateModified?.toIso8601String(),
|
||||||
|
"north": north,
|
||||||
|
"east": east,
|
||||||
|
"south": south,
|
||||||
|
"west": west,
|
||||||
|
"sketch": sketch,
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
// To parse this JSON data, do
|
||||||
|
//
|
||||||
|
// final lnadPropertyLoc = lnadPropertyLocFromJson(jsonString);
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
LandPropertyLoc lnadPropertyLocFromJson(String str) =>
|
||||||
|
LandPropertyLoc.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String lnadPropertyLocToJson(LandPropertyLoc data) =>
|
||||||
|
json.encode(data.toJson());
|
||||||
|
|
||||||
|
class LandPropertyLoc {
|
||||||
|
final int? id;
|
||||||
|
final int? landapprDetailsId;
|
||||||
|
final String? assessedById;
|
||||||
|
final String? assessedByName;
|
||||||
|
final DateTime? dateCreated;
|
||||||
|
final DateTime? dateModified;
|
||||||
|
final String? street;
|
||||||
|
final String? municipality;
|
||||||
|
final String? barangay;
|
||||||
|
final String? province;
|
||||||
|
|
||||||
|
LandPropertyLoc({
|
||||||
|
this.id,
|
||||||
|
this.landapprDetailsId,
|
||||||
|
this.assessedById,
|
||||||
|
this.assessedByName,
|
||||||
|
this.dateCreated,
|
||||||
|
this.dateModified,
|
||||||
|
this.street,
|
||||||
|
this.municipality,
|
||||||
|
this.barangay,
|
||||||
|
this.province,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory LandPropertyLoc.fromJson(Map<String, dynamic> json) =>
|
||||||
|
LandPropertyLoc(
|
||||||
|
id: json["id"],
|
||||||
|
landapprDetailsId: json["landappr_details_id"],
|
||||||
|
assessedById: json["assessed_by_id"],
|
||||||
|
assessedByName: json["assessed_by_name"],
|
||||||
|
dateCreated: json["date_created"] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json["date_created"]),
|
||||||
|
dateModified: json["date_modified"] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json["date_modified"]),
|
||||||
|
street: json["street"],
|
||||||
|
municipality: json["municipality"],
|
||||||
|
barangay: json["barangay"],
|
||||||
|
province: json["province"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"id": id,
|
||||||
|
"landappr_details_id": landapprDetailsId,
|
||||||
|
"assessed_by_id": assessedById,
|
||||||
|
"assessed_by_name": assessedByName,
|
||||||
|
"date_created": dateCreated?.toIso8601String(),
|
||||||
|
"date_modified": dateModified?.toIso8601String(),
|
||||||
|
"street": street,
|
||||||
|
"municipality": municipality,
|
||||||
|
"barangay": barangay,
|
||||||
|
"province": province,
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,117 @@
|
||||||
|
// To parse this JSON data, do
|
||||||
|
//
|
||||||
|
// final landPropertyOwner = landPropertyOwnerFromJson(jsonString);
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
LandPropertyOwner landPropertyOwnerFromJson(String str) =>
|
||||||
|
LandPropertyOwner.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String landPropertyOwnerToJson(LandPropertyOwner data) =>
|
||||||
|
json.encode(data.toJson());
|
||||||
|
|
||||||
|
class LandPropertyOwner {
|
||||||
|
final int? id;
|
||||||
|
final String? assessedById;
|
||||||
|
final String? assessedByName;
|
||||||
|
final DateTime? dateCreated;
|
||||||
|
final DateTime? dateModified;
|
||||||
|
final String? transCode;
|
||||||
|
final String? tdn;
|
||||||
|
final String? pin;
|
||||||
|
final String? cloaNo;
|
||||||
|
final DateTime? 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;
|
||||||
|
|
||||||
|
LandPropertyOwner({
|
||||||
|
this.id,
|
||||||
|
this.assessedById,
|
||||||
|
this.assessedByName,
|
||||||
|
this.dateCreated,
|
||||||
|
this.dateModified,
|
||||||
|
this.transCode,
|
||||||
|
this.tdn,
|
||||||
|
this.pin,
|
||||||
|
this.cloaNo,
|
||||||
|
this.dated,
|
||||||
|
this.surveyNo,
|
||||||
|
this.lotNo,
|
||||||
|
this.blkNo,
|
||||||
|
this.owner,
|
||||||
|
this.address,
|
||||||
|
this.telno,
|
||||||
|
this.tin,
|
||||||
|
this.adminUser,
|
||||||
|
this.adminAddress,
|
||||||
|
this.adminTelno,
|
||||||
|
this.adminTin,
|
||||||
|
this.faasType,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory LandPropertyOwner.fromJson(Map<String, dynamic> json) =>
|
||||||
|
LandPropertyOwner(
|
||||||
|
id: json["id"],
|
||||||
|
assessedById: json["assessed_by_id"],
|
||||||
|
assessedByName: json["assessed_by_name"],
|
||||||
|
dateCreated: json["date_created"] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json["date_created"]),
|
||||||
|
dateModified: json["date_modified"] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json["date_modified"]),
|
||||||
|
transCode: json["trans_code"],
|
||||||
|
tdn: json["tdn"],
|
||||||
|
pin: json["pin"],
|
||||||
|
cloaNo: json["cloa_no"],
|
||||||
|
dated: json["dated"] == null ? null : DateTime.parse(json["dated"]),
|
||||||
|
surveyNo: json["survey_no"],
|
||||||
|
lotNo: json["lot_no"],
|
||||||
|
blkNo: json["blk_no"],
|
||||||
|
owner: json["owner"],
|
||||||
|
address: json["address"],
|
||||||
|
telno: json["telno"],
|
||||||
|
tin: json["tin"],
|
||||||
|
adminUser: json["admin_user"],
|
||||||
|
adminAddress: json["admin_address"],
|
||||||
|
adminTelno: json["admin_telno"],
|
||||||
|
adminTin: json["admin_tin"],
|
||||||
|
faasType: json["faas_type"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"id": id,
|
||||||
|
"assessed_by_id": assessedById,
|
||||||
|
"assessed_by_name": assessedByName,
|
||||||
|
"date_created": dateCreated?.toIso8601String(),
|
||||||
|
"date_modified": dateModified?.toIso8601String(),
|
||||||
|
"trans_code": transCode,
|
||||||
|
"tdn": tdn,
|
||||||
|
"pin": pin,
|
||||||
|
"cloa_no": cloaNo,
|
||||||
|
"dated":
|
||||||
|
"${dated!.year.toString().padLeft(4, '0')}-${dated!.month.toString().padLeft(2, '0')}-${dated!.day.toString().padLeft(2, '0')}",
|
||||||
|
"survey_no": surveyNo,
|
||||||
|
"lot_no": lotNo,
|
||||||
|
"blk_no": blkNo,
|
||||||
|
"owner": owner,
|
||||||
|
"address": address,
|
||||||
|
"telno": telno,
|
||||||
|
"tin": tin,
|
||||||
|
"admin_user": adminUser,
|
||||||
|
"admin_address": adminAddress,
|
||||||
|
"admin_telno": adminTelno,
|
||||||
|
"admin_tin": adminTin,
|
||||||
|
"faas_type": faasType,
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
// To parse this JSON data, do
|
||||||
|
//
|
||||||
|
// final landRef = landRefFromJson(jsonString);
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
LandRef landRefFromJson(String str) => LandRef.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String landRefToJson(LandRef data) => json.encode(data.toJson());
|
||||||
|
|
||||||
|
class LandRef {
|
||||||
|
final int? id;
|
||||||
|
final int? bldgapprDetailsId;
|
||||||
|
final String? assessedById;
|
||||||
|
final String? assessedByName;
|
||||||
|
final DateTime? dateCreated;
|
||||||
|
final DateTime? dateModified;
|
||||||
|
final dynamic owner;
|
||||||
|
final dynamic cloaNo;
|
||||||
|
final dynamic lotNo;
|
||||||
|
final dynamic tdn;
|
||||||
|
final dynamic area;
|
||||||
|
final dynamic surveyNo;
|
||||||
|
final dynamic blkNo;
|
||||||
|
|
||||||
|
LandRef({
|
||||||
|
this.id,
|
||||||
|
this.bldgapprDetailsId,
|
||||||
|
this.assessedById,
|
||||||
|
this.assessedByName,
|
||||||
|
this.dateCreated,
|
||||||
|
this.dateModified,
|
||||||
|
this.owner,
|
||||||
|
this.cloaNo,
|
||||||
|
this.lotNo,
|
||||||
|
this.tdn,
|
||||||
|
this.area,
|
||||||
|
this.surveyNo,
|
||||||
|
this.blkNo,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory LandRef.fromJson(Map<String, dynamic> json) => LandRef(
|
||||||
|
id: json["id"],
|
||||||
|
bldgapprDetailsId: json["bldgappr_details_id"],
|
||||||
|
assessedById: json["assessed_by_id"],
|
||||||
|
assessedByName: json["assessed_by_name"],
|
||||||
|
dateCreated: json["date_created"] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json["date_created"]),
|
||||||
|
dateModified: json["date_modified"] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json["date_modified"]),
|
||||||
|
owner: json["owner"],
|
||||||
|
cloaNo: json["cloa_no"],
|
||||||
|
lotNo: json["lot_no"],
|
||||||
|
tdn: json["tdn"],
|
||||||
|
area: json["area"],
|
||||||
|
surveyNo: json["survey_no"],
|
||||||
|
blkNo: json["blk_no"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"id": id,
|
||||||
|
"bldgappr_details_id": bldgapprDetailsId,
|
||||||
|
"assessed_by_id": assessedById,
|
||||||
|
"assessed_by_name": assessedByName,
|
||||||
|
"date_created": dateCreated?.toIso8601String(),
|
||||||
|
"date_modified": dateModified?.toIso8601String(),
|
||||||
|
"owner": owner,
|
||||||
|
"cloa_no": cloaNo,
|
||||||
|
"lot_no": lotNo,
|
||||||
|
"tdn": tdn,
|
||||||
|
"area": area,
|
||||||
|
"survey_no": surveyNo,
|
||||||
|
"blk_no": blkNo,
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
// To parse this JSON data, do
|
||||||
|
//
|
||||||
|
// final landSubClassification = landSubClassificationFromJson(jsonString);
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
LandSubClassification landSubClassificationFromJson(String str) =>
|
||||||
|
LandSubClassification.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String landSubClassificationToJson(LandSubClassification data) =>
|
||||||
|
json.encode(data.toJson());
|
||||||
|
|
||||||
|
class LandSubClassification {
|
||||||
|
final int? id;
|
||||||
|
final int? classificationId;
|
||||||
|
final String? cityCode;
|
||||||
|
final String? subclassCode;
|
||||||
|
final String? subclassDescription;
|
||||||
|
final String? baseUnitMarketval;
|
||||||
|
|
||||||
|
LandSubClassification({
|
||||||
|
this.id,
|
||||||
|
this.classificationId,
|
||||||
|
this.cityCode,
|
||||||
|
this.subclassCode,
|
||||||
|
this.subclassDescription,
|
||||||
|
this.baseUnitMarketval,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory LandSubClassification.fromJson(Map<String, dynamic> json) =>
|
||||||
|
LandSubClassification(
|
||||||
|
id: json["id"],
|
||||||
|
classificationId: json["classification_id"],
|
||||||
|
cityCode: json["city_code"],
|
||||||
|
subclassCode: json["subclass_code"],
|
||||||
|
subclassDescription: json["subclass_description"],
|
||||||
|
baseUnitMarketval: json["base_unit_marketval"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"id": id,
|
||||||
|
"classification_id": classificationId,
|
||||||
|
"city_code": cityCode,
|
||||||
|
"subclass_code": subclassCode,
|
||||||
|
"subclass_description": subclassDescription,
|
||||||
|
"base_unit_marketval": baseUnitMarketval,
|
||||||
|
};
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue