created sql database for admin side and faas building; created blocs and services for admin side and faas building; migrated some data using api to sql database; created user interface for admin side and building faas steppers
parent
66bd74118d
commit
8204c1fbdf
|
@ -0,0 +1,35 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
|
||||||
|
import '../../../../../model/passo/barangay.dart';
|
||||||
|
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
|
||||||
|
part 'barangay_admin_event.dart';
|
||||||
|
part 'barangay_admin_state.dart';
|
||||||
|
|
||||||
|
class BarangayAdminBloc extends Bloc<BarangayAdminEvent, BarangayAdminState> {
|
||||||
|
BarangayAdminBloc() : super(BarangayAdminInitial()) {
|
||||||
|
List<Brgy> brgy = [];
|
||||||
|
on<LoadBarangay>((event, emit) async {
|
||||||
|
brgy = await SQLServices.instance.readAllBarangay();
|
||||||
|
|
||||||
|
emit(BarangayLoaded(brgy: brgy));
|
||||||
|
});
|
||||||
|
on<LoadBarangayInMunicipality>((event, emit) async {
|
||||||
|
brgy = await SQLServices.instance
|
||||||
|
.readBrgyInSelectedMunicipality(event.cityCode);
|
||||||
|
|
||||||
|
emit(BarangayLoaded(brgy: brgy));
|
||||||
|
});
|
||||||
|
on<AddBarangay>((event, emit) async {
|
||||||
|
await SQLServices.instance.createBarangay(
|
||||||
|
Brgy(
|
||||||
|
id: event.id,
|
||||||
|
barangayId: event.barangayId,
|
||||||
|
barangayCode: event.barangayCode,
|
||||||
|
cityCode: event.cityCode,
|
||||||
|
barangayDescription: event.barangayDescription),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
part of 'barangay_admin_bloc.dart';
|
||||||
|
|
||||||
|
class BarangayAdminEvent extends Equatable {
|
||||||
|
const BarangayAdminEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddBarangay extends BarangayAdminEvent {
|
||||||
|
final int id;
|
||||||
|
final int barangayId;
|
||||||
|
final String barangayCode;
|
||||||
|
final String cityCode;
|
||||||
|
final String barangayDescription;
|
||||||
|
|
||||||
|
const AddBarangay({
|
||||||
|
required this.id,
|
||||||
|
required this.barangayId,
|
||||||
|
required this.barangayCode,
|
||||||
|
required this.cityCode,
|
||||||
|
required this.barangayDescription,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
id,
|
||||||
|
barangayId,
|
||||||
|
barangayCode,
|
||||||
|
cityCode,
|
||||||
|
barangayDescription,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadBarangay extends BarangayAdminEvent {
|
||||||
|
const LoadBarangay();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadBarangayInMunicipality extends BarangayAdminEvent {
|
||||||
|
final String cityCode;
|
||||||
|
const LoadBarangayInMunicipality({required this.cityCode});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [cityCode];
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
part of 'barangay_admin_bloc.dart';
|
||||||
|
|
||||||
|
class BarangayAdminState extends Equatable {
|
||||||
|
const BarangayAdminState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class BarangayAdminInitial extends BarangayAdminState {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class BarangayLoaded extends BarangayAdminState {
|
||||||
|
final List<Brgy> brgy;
|
||||||
|
|
||||||
|
const BarangayLoaded({required this.brgy});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [brgy];
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
|
||||||
|
import '../../../../../model/passo/class_components _offline.dart';
|
||||||
|
import '../../../../../model/passo/class_components.dart';
|
||||||
|
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
|
||||||
|
part 'class_components_admin_event.dart';
|
||||||
|
part 'class_components_admin_state.dart';
|
||||||
|
|
||||||
|
class ClassComponentsAdminBloc
|
||||||
|
extends Bloc<ClassComponentsAdminEvent, ClassComponentsAdminState> {
|
||||||
|
ClassComponentsAdminBloc() : super(ClassComponentsAdminInitial()) {
|
||||||
|
List<ClassComponentsOffline> classes = [];
|
||||||
|
on<LoadClassComponents>((event, emit) async {
|
||||||
|
classes = await SQLServices.instance.readAllClassComponents();
|
||||||
|
|
||||||
|
emit(ClassComponentsAdminLoaded(classes: classes));
|
||||||
|
});
|
||||||
|
on<AddClassComponents>((event, emit) async {
|
||||||
|
await SQLServices.instance.createClassComponents(
|
||||||
|
ClassComponentsOffline(
|
||||||
|
componentName: event.componentName,
|
||||||
|
minBaseUnitvalPercent: event.minBaseUnitvalPercent,
|
||||||
|
maxBaseUnitvalPercent: event.maxBaseUnitvalPercent,
|
||||||
|
minUnitvalSqrmtr: event.minUnitvalSqrmtr,
|
||||||
|
maxUnitvalSqrmtr: event.maxUnitvalSqrmtr,
|
||||||
|
minAddBaseunitval: event.minAddBaseunitval,
|
||||||
|
maxAddBaseunitval: event.maxAddBaseunitval,
|
||||||
|
minDeductBaserate: event.minDeductBaserate,
|
||||||
|
maxDeductBaserate: event.maxDeductBaserate,
|
||||||
|
minLinearMeter: event.minLinearMeter,
|
||||||
|
maxLinearMeter: event.maxLinearMeter,
|
||||||
|
minSpacing: event.minSpacing,
|
||||||
|
maxSpacing: event.maxSpacing,
|
||||||
|
roughFinish: event.roughFinish,
|
||||||
|
highFinish: event.highFinish,
|
||||||
|
withoutBucc: event.withoutBucc),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
part of 'class_components_admin_bloc.dart';
|
||||||
|
|
||||||
|
class ClassComponentsAdminEvent extends Equatable {
|
||||||
|
const ClassComponentsAdminEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddClassComponents extends ClassComponentsAdminEvent {
|
||||||
|
final String componentName;
|
||||||
|
final String minBaseUnitvalPercent;
|
||||||
|
final String maxBaseUnitvalPercent;
|
||||||
|
final String minUnitvalSqrmtr;
|
||||||
|
final String maxUnitvalSqrmtr;
|
||||||
|
final String minAddBaseunitval;
|
||||||
|
final String maxAddBaseunitval;
|
||||||
|
final String minDeductBaserate;
|
||||||
|
final String maxDeductBaserate;
|
||||||
|
final String minLinearMeter;
|
||||||
|
final String maxLinearMeter;
|
||||||
|
final String minSpacing;
|
||||||
|
final String maxSpacing;
|
||||||
|
final String roughFinish;
|
||||||
|
final String highFinish;
|
||||||
|
final int withoutBucc;
|
||||||
|
|
||||||
|
const AddClassComponents({
|
||||||
|
required this.componentName,
|
||||||
|
required this.minBaseUnitvalPercent,
|
||||||
|
required this.maxBaseUnitvalPercent,
|
||||||
|
required this.minUnitvalSqrmtr,
|
||||||
|
required this.maxUnitvalSqrmtr,
|
||||||
|
required this.minAddBaseunitval,
|
||||||
|
required this.maxAddBaseunitval,
|
||||||
|
required this.minDeductBaserate,
|
||||||
|
required this.maxDeductBaserate,
|
||||||
|
required this.minLinearMeter,
|
||||||
|
required this.maxLinearMeter,
|
||||||
|
required this.minSpacing,
|
||||||
|
required this.maxSpacing,
|
||||||
|
required this.roughFinish,
|
||||||
|
required this.highFinish,
|
||||||
|
required this.withoutBucc,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
componentName,
|
||||||
|
minBaseUnitvalPercent,
|
||||||
|
maxBaseUnitvalPercent,
|
||||||
|
minUnitvalSqrmtr,
|
||||||
|
maxUnitvalSqrmtr,
|
||||||
|
minAddBaseunitval,
|
||||||
|
maxAddBaseunitval,
|
||||||
|
minDeductBaserate,
|
||||||
|
maxDeductBaserate,
|
||||||
|
minLinearMeter,
|
||||||
|
maxLinearMeter,
|
||||||
|
minSpacing,
|
||||||
|
maxSpacing,
|
||||||
|
roughFinish,
|
||||||
|
highFinish,
|
||||||
|
withoutBucc,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadClassComponents extends ClassComponentsAdminEvent {
|
||||||
|
const LoadClassComponents();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
part of 'class_components_admin_bloc.dart';
|
||||||
|
|
||||||
|
class ClassComponentsAdminState extends Equatable {
|
||||||
|
const ClassComponentsAdminState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class ClassComponentsAdminInitial extends ClassComponentsAdminState {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class ClassComponentsAdminLoaded extends ClassComponentsAdminState {
|
||||||
|
final List<ClassComponentsOffline> classes;
|
||||||
|
|
||||||
|
const ClassComponentsAdminLoaded({required this.classes});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [classes];
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/memoranda.dart';
|
||||||
|
|
||||||
|
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
|
||||||
|
part 'memoranda_admin_event.dart';
|
||||||
|
part 'memoranda_admin_state.dart';
|
||||||
|
|
||||||
|
class MemorandaAdminBloc
|
||||||
|
extends Bloc<MemorandaAdminEvent, MemorandaAdminState> {
|
||||||
|
MemorandaAdminBloc() : super(MemorandaAdminInitial()) {
|
||||||
|
List<Memoranda> memo = [];
|
||||||
|
on<LoadMemoranda>((event, emit) async {
|
||||||
|
memo = await SQLServices.instance.readAllMemoranda();
|
||||||
|
|
||||||
|
emit(MemorandaLoaded(memo: memo));
|
||||||
|
});
|
||||||
|
on<AddMemoranda>((event, emit) async {
|
||||||
|
await SQLServices.instance.createMemoranda(Memoranda(
|
||||||
|
id: event.id,
|
||||||
|
code: event.code,
|
||||||
|
memoranda: event.memoranda,
|
||||||
|
));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
part of 'memoranda_admin_bloc.dart';
|
||||||
|
|
||||||
|
class MemorandaAdminEvent extends Equatable {
|
||||||
|
const MemorandaAdminEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddMemoranda extends MemorandaAdminEvent {
|
||||||
|
final int id;
|
||||||
|
final String code;
|
||||||
|
final String memoranda;
|
||||||
|
|
||||||
|
const AddMemoranda({
|
||||||
|
required this.id,
|
||||||
|
required this.code,
|
||||||
|
required this.memoranda,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
id,
|
||||||
|
code,
|
||||||
|
memoranda,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadMemoranda extends MemorandaAdminEvent {
|
||||||
|
const LoadMemoranda();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
part of 'memoranda_admin_bloc.dart';
|
||||||
|
|
||||||
|
class MemorandaAdminState extends Equatable {
|
||||||
|
const MemorandaAdminState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class MemorandaAdminInitial extends MemorandaAdminState {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class MemorandaLoaded extends MemorandaAdminState {
|
||||||
|
final List<Memoranda> memo;
|
||||||
|
|
||||||
|
const MemorandaLoaded({required this.memo});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [memo];
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/city.dart';
|
||||||
|
import 'package:unit2/sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
|
||||||
|
part 'municipalities_admin_event.dart';
|
||||||
|
part 'municipalities_admin_state.dart';
|
||||||
|
|
||||||
|
class MunicipalitiesAdminBloc
|
||||||
|
extends Bloc<MunicipalitiesAdminEvent, MunicipalitiesAdminState> {
|
||||||
|
MunicipalitiesAdminBloc() : super(MunicipalitiesAdminInitial()) {
|
||||||
|
List<City> city = [];
|
||||||
|
on<LoadMunicipalities>((event, emit) async {
|
||||||
|
city = await SQLServices.instance.readAllMunicipalities();
|
||||||
|
|
||||||
|
emit(MunicipalitiesLoaded(city: city));
|
||||||
|
});
|
||||||
|
on<AddMunicipality>((event, emit) async {
|
||||||
|
await SQLServices.instance.createMunicipalities(
|
||||||
|
City(
|
||||||
|
id: event.id,
|
||||||
|
cityCode: event.cityCode,
|
||||||
|
cityDescription: event.cityDescription,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
part of 'municipalities_admin_bloc.dart';
|
||||||
|
|
||||||
|
class MunicipalitiesAdminEvent extends Equatable {
|
||||||
|
const MunicipalitiesAdminEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddMunicipality extends MunicipalitiesAdminEvent {
|
||||||
|
final int id;
|
||||||
|
final String cityCode;
|
||||||
|
final String cityDescription;
|
||||||
|
|
||||||
|
const AddMunicipality({
|
||||||
|
required this.id,
|
||||||
|
required this.cityCode,
|
||||||
|
required this.cityDescription,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
id,
|
||||||
|
cityCode,
|
||||||
|
cityDescription,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadMunicipalities extends MunicipalitiesAdminEvent {
|
||||||
|
const LoadMunicipalities();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
part of 'municipalities_admin_bloc.dart';
|
||||||
|
|
||||||
|
class MunicipalitiesAdminState extends Equatable {
|
||||||
|
const MunicipalitiesAdminState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class MunicipalitiesAdminInitial extends MunicipalitiesAdminState {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class MunicipalitiesLoaded extends MunicipalitiesAdminState {
|
||||||
|
final List<City> city;
|
||||||
|
|
||||||
|
const MunicipalitiesLoaded({required this.city});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [city];
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
|
||||||
|
import '../../../../../model/passo/signatories.dart';
|
||||||
|
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
|
||||||
|
part 'signatories_admin_event.dart';
|
||||||
|
part 'signatories_admin_state.dart';
|
||||||
|
|
||||||
|
class SignatoriesAdminBloc
|
||||||
|
extends Bloc<SignatoriesAdminEvent, SignatoriesAdminState> {
|
||||||
|
SignatoriesAdminBloc() : super(SignatoriesAdminInitial()) {
|
||||||
|
List<Signatories> signatories = [];
|
||||||
|
on<LoadSignatories>((event, emit) async {
|
||||||
|
signatories = await SQLServices.instance.readAllSignatories();
|
||||||
|
|
||||||
|
emit(SignatoriesLoaded(signatories: signatories));
|
||||||
|
});
|
||||||
|
on<AddSignatories>((event, emit) async {
|
||||||
|
await SQLServices.instance.createSignatories(Signatories(
|
||||||
|
id: event.id,
|
||||||
|
signatoryId: event.signatoryId,
|
||||||
|
firstname: event.firstname,
|
||||||
|
middlename: event.middlename,
|
||||||
|
lastname: event.lastname));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
part of 'signatories_admin_bloc.dart';
|
||||||
|
|
||||||
|
class SignatoriesAdminEvent extends Equatable {
|
||||||
|
const SignatoriesAdminEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddSignatories extends SignatoriesAdminEvent {
|
||||||
|
final int id;
|
||||||
|
final int signatoryId;
|
||||||
|
final String firstname;
|
||||||
|
final String middlename;
|
||||||
|
final String lastname;
|
||||||
|
|
||||||
|
const AddSignatories({
|
||||||
|
required this.id,
|
||||||
|
required this.signatoryId,
|
||||||
|
required this.firstname,
|
||||||
|
required this.middlename,
|
||||||
|
required this.lastname,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
id,
|
||||||
|
signatoryId,
|
||||||
|
firstname,
|
||||||
|
middlename,
|
||||||
|
lastname,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadSignatories extends SignatoriesAdminEvent {
|
||||||
|
const LoadSignatories();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
part of 'signatories_admin_bloc.dart';
|
||||||
|
|
||||||
|
class SignatoriesAdminState extends Equatable {
|
||||||
|
const SignatoriesAdminState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class SignatoriesAdminInitial extends SignatoriesAdminState {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class SignatoriesLoaded extends SignatoriesAdminState {
|
||||||
|
final List<Signatories> signatories;
|
||||||
|
|
||||||
|
const SignatoriesLoaded({required this.signatories});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [signatories];
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
|
||||||
|
import '../../../../../model/passo/unit_construct.dart';
|
||||||
|
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
|
||||||
|
part 'unit_construction_admin_event.dart';
|
||||||
|
part 'unit_construction_admin_state.dart';
|
||||||
|
|
||||||
|
class UnitConstructionAdminBloc
|
||||||
|
extends Bloc<UnitConstructionAdminEvent, UnitConstructionAdminState> {
|
||||||
|
UnitConstructionAdminBloc() : super(UnitConstructionAdminInitial()) {
|
||||||
|
List<UnitConstruct> unit = [];
|
||||||
|
on<LoadUnitConstruct>((event, emit) async {
|
||||||
|
unit = await SQLServices.instance.readAllUnitConstruct();
|
||||||
|
|
||||||
|
emit(UnitConstructLoaded(unit: unit));
|
||||||
|
});
|
||||||
|
on<AddUnitConstruct>((event, emit) async {
|
||||||
|
await SQLServices.instance.createUnitConstruction(
|
||||||
|
UnitConstruct(
|
||||||
|
id: event.id,
|
||||||
|
bldgType: event.bldgType,
|
||||||
|
building: event.building,
|
||||||
|
unitValue: event.unitValue),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
part of 'unit_construction_admin_bloc.dart';
|
||||||
|
|
||||||
|
class UnitConstructionAdminEvent extends Equatable {
|
||||||
|
const UnitConstructionAdminEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddUnitConstruct extends UnitConstructionAdminEvent {
|
||||||
|
final int id;
|
||||||
|
final String bldgType;
|
||||||
|
final String building;
|
||||||
|
final String unitValue;
|
||||||
|
|
||||||
|
const AddUnitConstruct({
|
||||||
|
required this.id,
|
||||||
|
required this.bldgType,
|
||||||
|
required this.building,
|
||||||
|
required this.unitValue,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
id,
|
||||||
|
bldgType,
|
||||||
|
building,
|
||||||
|
unitValue,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadUnitConstruct extends UnitConstructionAdminEvent {
|
||||||
|
const LoadUnitConstruct();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
part of 'unit_construction_admin_bloc.dart';
|
||||||
|
|
||||||
|
class UnitConstructionAdminState extends Equatable {
|
||||||
|
const UnitConstructionAdminState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UnitConstructionAdminInitial extends UnitConstructionAdminState {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UnitConstructLoaded extends UnitConstructionAdminState {
|
||||||
|
final List<UnitConstruct> unit;
|
||||||
|
|
||||||
|
const UnitConstructLoaded({required this.unit});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [unit];
|
||||||
|
}
|
|
@ -0,0 +1,78 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/bloc/passo/bulding/additional_item/additional_item_bloc.dart';
|
||||||
|
import 'package:unit2/sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
|
||||||
|
import '../../../../../model/passo/additional_items.dart';
|
||||||
|
import '../../../../../sevices/offline/offline_passo/building/property_owner_info_service.dart';
|
||||||
|
|
||||||
|
part 'additional_items_offline_event.dart';
|
||||||
|
part 'additional_items_offline_state.dart';
|
||||||
|
|
||||||
|
class AdditionalItemsOfflineBloc
|
||||||
|
extends Bloc<AdditionalItemsOfflineEvent, AdditionalItemsOfflineState> {
|
||||||
|
AdditionalItemsOfflineBloc() : super(AdditionalItemsOfflineInitial()) {
|
||||||
|
List<AdditionalItems> addItems = [];
|
||||||
|
on<LoadAdditionalItems>((event, emit) async {
|
||||||
|
emit(AdditionalItemsOfflineInitial());
|
||||||
|
try {
|
||||||
|
emit(AdditionalItemsLoaded(addItem: addItems));
|
||||||
|
} catch (e) {
|
||||||
|
emit(AdditionalItemsErrorState(e.toString()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<LoadAdditionalItemsEdit>((event, emit) async {
|
||||||
|
emit(AdditionalItemsOfflineInitial());
|
||||||
|
List<Map<String, dynamic>> result =
|
||||||
|
await SQLServices.instance.getAdditionalItems(event.id);
|
||||||
|
|
||||||
|
if (result.isNotEmpty) {
|
||||||
|
List<AdditionalItems> locationList =
|
||||||
|
result.map((map) => AdditionalItems.fromJson(map)).toList();
|
||||||
|
|
||||||
|
emit(AdditionalItemsLoaded(addItem: locationList));
|
||||||
|
} else {
|
||||||
|
print('No data found.');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
on<AddAdditionalItems>((event, emit) async {
|
||||||
|
try {
|
||||||
|
AdditionalItems item = await SQLServices.instance.createAdditionalItems(
|
||||||
|
AdditionalItems(
|
||||||
|
id: event.id,
|
||||||
|
bldgapprDetailsId: event.bldgapprDetailsId,
|
||||||
|
classId: event.classId,
|
||||||
|
className: event.className,
|
||||||
|
structType: event.structType,
|
||||||
|
unitValue: event.unitValue,
|
||||||
|
baseUnitValue: event.baseUnitValue,
|
||||||
|
area: event.area,
|
||||||
|
marketValue: event.marketValue,
|
||||||
|
depreciationRate: event.depreciationRate,
|
||||||
|
adjustedMarketVal: event.adjustedMarketVal,
|
||||||
|
amtDepreciation: event.amtDepreciation,
|
||||||
|
painted: event.painted == true ? '1' : '0',
|
||||||
|
secondhand: event.secondhand == true ? '1' : '0',
|
||||||
|
paintedUnitval: event.paintedUnitval,
|
||||||
|
secondhandUnitval: event.secondhandUnitval,
|
||||||
|
actualUse: event.actualUse));
|
||||||
|
|
||||||
|
print(item.toJson());
|
||||||
|
|
||||||
|
addItems.add(item);
|
||||||
|
|
||||||
|
emit(AdditionalItemsLoaded(addItem: addItems));
|
||||||
|
} catch (e) {
|
||||||
|
print(e.toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on<ShowAdditionalItems>((event, emit) async {
|
||||||
|
emit(ShowAddItemsScreen());
|
||||||
|
});
|
||||||
|
on<FetchAdditionalItems>((event, emit) async {
|
||||||
|
addItems = await SQLServices.instance.readAdditionalItems();
|
||||||
|
emit(AdditionalItemsLoaded(addItem: addItems));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,119 @@
|
||||||
|
part of 'additional_items_offline_bloc.dart';
|
||||||
|
|
||||||
|
class AdditionalItemsOfflineEvent extends Equatable {
|
||||||
|
const AdditionalItemsOfflineEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadAdditionalItems extends AdditionalItemsOfflineEvent {
|
||||||
|
final List<AdditionalItems> items;
|
||||||
|
|
||||||
|
const LoadAdditionalItems({this.items = const <AdditionalItems>[]});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [items];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadAdditionalItemsEdit extends AdditionalItemsOfflineEvent {
|
||||||
|
final List<AdditionalItems> items;
|
||||||
|
final int? id;
|
||||||
|
|
||||||
|
const LoadAdditionalItemsEdit({required this.items, this.id});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [items];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddAdditionalItems extends AdditionalItemsOfflineEvent {
|
||||||
|
final int id;
|
||||||
|
final int bldgapprDetailsId;
|
||||||
|
final int classId;
|
||||||
|
final String 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;
|
||||||
|
|
||||||
|
const AddAdditionalItems({
|
||||||
|
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,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
id,
|
||||||
|
bldgapprDetailsId,
|
||||||
|
classId,
|
||||||
|
className,
|
||||||
|
structType,
|
||||||
|
unitValue,
|
||||||
|
baseUnitValue,
|
||||||
|
area,
|
||||||
|
marketValue,
|
||||||
|
depreciationRate,
|
||||||
|
adjustedMarketVal,
|
||||||
|
amtDepreciation,
|
||||||
|
painted,
|
||||||
|
secondhand,
|
||||||
|
paintedUnitval,
|
||||||
|
secondhandUnitval,
|
||||||
|
actualUse
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdateAdditionalItems extends AdditionalItemsOfflineEvent {
|
||||||
|
final AdditionalItems addItems;
|
||||||
|
const UpdateAdditionalItems({required this.addItems});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [addItems];
|
||||||
|
}
|
||||||
|
|
||||||
|
class FetchAdditionalItems extends AdditionalItemsOfflineEvent {
|
||||||
|
const FetchAdditionalItems();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class FetchSpecificAdditionalItems extends AdditionalItemsOfflineEvent {
|
||||||
|
final int id;
|
||||||
|
const FetchSpecificAdditionalItems({required this.id});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [id];
|
||||||
|
}
|
||||||
|
|
||||||
|
class DeleteAdditionalItems extends AdditionalItemsOfflineEvent {
|
||||||
|
final int id;
|
||||||
|
const DeleteAdditionalItems({required this.id});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [id];
|
||||||
|
}
|
||||||
|
|
||||||
|
class ShowAdditionalItems extends AdditionalItemsOfflineEvent {}
|
|
@ -0,0 +1,46 @@
|
||||||
|
part of 'additional_items_offline_bloc.dart';
|
||||||
|
|
||||||
|
class AdditionalItemsOfflineState extends Equatable {
|
||||||
|
const AdditionalItemsOfflineState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AdditionalItemsOfflineInitial extends AdditionalItemsOfflineState {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AdditionalItemsLoaded extends AdditionalItemsOfflineState {
|
||||||
|
final List<AdditionalItems> addItem;
|
||||||
|
|
||||||
|
const AdditionalItemsLoaded({required this.addItem});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [addItem];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadSpecificAdditionalItems extends AdditionalItemsOfflineState {
|
||||||
|
final AdditionalItems addItem;
|
||||||
|
|
||||||
|
const LoadSpecificAdditionalItems({required this.addItem});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [addItem];
|
||||||
|
}
|
||||||
|
|
||||||
|
class ShowAddItemsScreen extends AdditionalItemsOfflineState {}
|
||||||
|
|
||||||
|
class AdditionalItemsErrorState extends AdditionalItemsOfflineState {
|
||||||
|
const AdditionalItemsErrorState(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [error];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AdditionalItemsDeletedState extends AdditionalItemsOfflineState {
|
||||||
|
final bool success;
|
||||||
|
const AdditionalItemsDeletedState({required this.success});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [success];
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/property_appraisal.dart';
|
||||||
|
|
||||||
|
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
|
||||||
|
part 'bldg_appraisal_offline_event.dart';
|
||||||
|
part 'bldg_appraisal_offline_state.dart';
|
||||||
|
|
||||||
|
class BldgAppraisalOfflineBloc
|
||||||
|
extends Bloc<BldgAppraisalOfflineEvent, BldgAppraisalOfflineState> {
|
||||||
|
BldgAppraisalOfflineBloc() : super(BldgAppraisalOfflineInitial()) {
|
||||||
|
List<PropertyAppraisal> appraisal = [];
|
||||||
|
on<AddBldgAppraisal>((event, emit) async {
|
||||||
|
await SQLServices.instance.createBldgAppraisal(PropertyAppraisal(
|
||||||
|
id: event.id,
|
||||||
|
bldgapprDetailsId: event.bldgapprDetailsId,
|
||||||
|
assessedById: event.assessedById,
|
||||||
|
assessedByName: event.assessedByName,
|
||||||
|
dateCreated: event.dateCreated,
|
||||||
|
dateModified: event.dateModified,
|
||||||
|
unitconstructCost: event.unitconstructCost,
|
||||||
|
buildingCore: event.buildingCore,
|
||||||
|
unitconstructSubtotal: event.unitconstructSubtotal,
|
||||||
|
depreciationRate: event.depreciationRate,
|
||||||
|
depreciationCost: event.depreciationCost,
|
||||||
|
costAddItems: event.costAddItems,
|
||||||
|
addItemsSubtotal: event.addItemsSubtotal,
|
||||||
|
totalpercentDepreciation: event.totalpercentDepreciation,
|
||||||
|
marketValue: event.marketValue,
|
||||||
|
totalArea: event.totalArea,
|
||||||
|
actualUse: event.actualUse));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
part of 'bldg_appraisal_offline_bloc.dart';
|
||||||
|
|
||||||
|
class BldgAppraisalOfflineEvent extends Equatable {
|
||||||
|
const BldgAppraisalOfflineEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddBldgAppraisal extends BldgAppraisalOfflineEvent {
|
||||||
|
final int id;
|
||||||
|
final int bldgapprDetailsId;
|
||||||
|
final String assessedById;
|
||||||
|
final String assessedByName;
|
||||||
|
final DateTime dateCreated;
|
||||||
|
final DateTime dateModified;
|
||||||
|
final String unitconstructCost;
|
||||||
|
final String buildingCore;
|
||||||
|
final String unitconstructSubtotal;
|
||||||
|
final String depreciationRate;
|
||||||
|
final String depreciationCost;
|
||||||
|
final String costAddItems;
|
||||||
|
final String addItemsSubtotal;
|
||||||
|
final String totalpercentDepreciation;
|
||||||
|
final String marketValue;
|
||||||
|
final String totalArea;
|
||||||
|
final String actualUse;
|
||||||
|
|
||||||
|
const AddBldgAppraisal(
|
||||||
|
{required this.id,
|
||||||
|
required this.bldgapprDetailsId,
|
||||||
|
required this.assessedById,
|
||||||
|
required this.assessedByName,
|
||||||
|
required this.dateCreated,
|
||||||
|
required this.dateModified,
|
||||||
|
required this.unitconstructCost,
|
||||||
|
required this.buildingCore,
|
||||||
|
required this.unitconstructSubtotal,
|
||||||
|
required this.depreciationRate,
|
||||||
|
required this.depreciationCost,
|
||||||
|
required this.costAddItems,
|
||||||
|
required this.addItemsSubtotal,
|
||||||
|
required this.totalpercentDepreciation,
|
||||||
|
required this.marketValue,
|
||||||
|
required this.totalArea,
|
||||||
|
required this.actualUse});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
id,
|
||||||
|
bldgapprDetailsId,
|
||||||
|
assessedById,
|
||||||
|
assessedByName,
|
||||||
|
dateCreated,
|
||||||
|
dateModified,
|
||||||
|
unitconstructCost,
|
||||||
|
buildingCore,
|
||||||
|
unitconstructSubtotal,
|
||||||
|
depreciationRate,
|
||||||
|
depreciationCost,
|
||||||
|
costAddItems,
|
||||||
|
addItemsSubtotal,
|
||||||
|
totalpercentDepreciation,
|
||||||
|
marketValue,
|
||||||
|
totalArea,
|
||||||
|
actualUse
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
part of 'bldg_appraisal_offline_bloc.dart';
|
||||||
|
|
||||||
|
class BldgAppraisalOfflineState extends Equatable {
|
||||||
|
const BldgAppraisalOfflineState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class BldgAppraisalOfflineInitial extends BldgAppraisalOfflineState {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class BldgAppraisalOfflineLoaded extends BldgAppraisalOfflineState {
|
||||||
|
final List<PropertyAppraisal> appraisal;
|
||||||
|
|
||||||
|
const BldgAppraisalOfflineLoaded({required this.appraisal});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [appraisal];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadSpecificBldgAppraisalOffline extends BldgAppraisalOfflineState {
|
||||||
|
final PropertyAppraisal appraisal;
|
||||||
|
|
||||||
|
const LoadSpecificBldgAppraisalOffline({required this.appraisal});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [appraisal];
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/property_assessment.dart';
|
||||||
|
|
||||||
|
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
|
||||||
|
part 'bldg_assessment_offline_event.dart';
|
||||||
|
part 'bldg_assessment_offline_state.dart';
|
||||||
|
|
||||||
|
class BldgAssessmentOfflineBloc
|
||||||
|
extends Bloc<BldgAssessmentOfflineEvent, BldgAssessmentOfflineState> {
|
||||||
|
BldgAssessmentOfflineBloc() : super(BldgAssessmentOfflineInitial()) {
|
||||||
|
List<PropertyAssessment> assessment = [];
|
||||||
|
on<AddBldgAssessment>((event, emit) async {
|
||||||
|
await SQLServices.instance.createBldgAssessment(PropertyAssessment(
|
||||||
|
id: event.id,
|
||||||
|
bldgapprDetailsId: event.bldgapprDetailsId,
|
||||||
|
actualUse: event.actualUse,
|
||||||
|
marketValue: event.marketValue,
|
||||||
|
assessmentLevel: event.assessmentLevel,
|
||||||
|
assessedValue: event.assessedValue,
|
||||||
|
taxable: event.taxable,
|
||||||
|
exempt: event.exempt,
|
||||||
|
qtr: event.qtr,
|
||||||
|
yr: event.yr,
|
||||||
|
appraisedbyName: event.appraisedbyName,
|
||||||
|
appraisedbyDate: event.appraisedbyDate,
|
||||||
|
recommendapprName: event.recommendapprName,
|
||||||
|
recommendapprDate: event.recommendapprDate,
|
||||||
|
approvedbyName: event.approvedbyName,
|
||||||
|
memoranda: event.memoranda,
|
||||||
|
swornstatementNo: event.swornstatementNo,
|
||||||
|
dateReceived: event.dateReceived,
|
||||||
|
entryDateAssessment: event.entryDateAssessment,
|
||||||
|
entryDateBy: event.entryDateBy));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,78 @@
|
||||||
|
part of 'bldg_assessment_offline_bloc.dart';
|
||||||
|
|
||||||
|
class BldgAssessmentOfflineEvent extends Equatable {
|
||||||
|
const BldgAssessmentOfflineEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddBldgAssessment extends BldgAssessmentOfflineEvent {
|
||||||
|
final int id;
|
||||||
|
final int bldgapprDetailsId;
|
||||||
|
final String actualUse;
|
||||||
|
final String marketValue;
|
||||||
|
final String assessmentLevel;
|
||||||
|
final String assessedValue;
|
||||||
|
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 String memoranda;
|
||||||
|
final String swornstatementNo;
|
||||||
|
final DateTime dateReceived;
|
||||||
|
final DateTime entryDateAssessment;
|
||||||
|
final String entryDateBy;
|
||||||
|
|
||||||
|
const AddBldgAssessment({
|
||||||
|
required this.id,
|
||||||
|
required this.bldgapprDetailsId,
|
||||||
|
required this.actualUse,
|
||||||
|
required this.marketValue,
|
||||||
|
required this.assessmentLevel,
|
||||||
|
required this.assessedValue,
|
||||||
|
required this.taxable,
|
||||||
|
required this.exempt,
|
||||||
|
required this.qtr,
|
||||||
|
required this.yr,
|
||||||
|
required this.appraisedbyName,
|
||||||
|
required this.appraisedbyDate,
|
||||||
|
required this.recommendapprName,
|
||||||
|
required this.recommendapprDate,
|
||||||
|
required this.approvedbyName,
|
||||||
|
required this.memoranda,
|
||||||
|
required this.swornstatementNo,
|
||||||
|
required this.dateReceived,
|
||||||
|
required this.entryDateAssessment,
|
||||||
|
required this.entryDateBy,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
id,
|
||||||
|
bldgapprDetailsId,
|
||||||
|
actualUse,
|
||||||
|
marketValue,
|
||||||
|
assessmentLevel,
|
||||||
|
assessedValue,
|
||||||
|
taxable,
|
||||||
|
exempt,
|
||||||
|
qtr,
|
||||||
|
yr,
|
||||||
|
appraisedbyName,
|
||||||
|
appraisedbyDate,
|
||||||
|
recommendapprName,
|
||||||
|
recommendapprDate,
|
||||||
|
approvedbyName,
|
||||||
|
memoranda,
|
||||||
|
swornstatementNo,
|
||||||
|
dateReceived,
|
||||||
|
entryDateAssessment,
|
||||||
|
entryDateBy,
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
part of 'bldg_assessment_offline_bloc.dart';
|
||||||
|
|
||||||
|
class BldgAssessmentOfflineState extends Equatable {
|
||||||
|
const BldgAssessmentOfflineState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class BldgAssessmentOfflineInitial extends BldgAssessmentOfflineState {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class BldgAssessmentOfflineLoaded extends BldgAssessmentOfflineState {
|
||||||
|
final List<PropertyAssessment> assessment;
|
||||||
|
|
||||||
|
const BldgAssessmentOfflineLoaded({required this.assessment});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [assessment];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadSpecificBldgAssessmentOffline extends BldgAssessmentOfflineState {
|
||||||
|
final PropertyAssessment assessment;
|
||||||
|
|
||||||
|
const LoadSpecificBldgAssessmentOffline({required this.assessment});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [assessment];
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/model/passo/general_description.dart';
|
||||||
|
import 'package:unit2/sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
|
||||||
|
import '../../../../../sevices/offline/offline_passo/building/property_owner_info_service.dart';
|
||||||
|
|
||||||
|
part 'general_description_event.dart';
|
||||||
|
part 'general_description_state.dart';
|
||||||
|
|
||||||
|
class GeneralDescriptionBloc
|
||||||
|
extends Bloc<GeneralDescriptionEvent, GeneralDescriptionState> {
|
||||||
|
GeneralDescriptionBloc() : super(GeneralDescriptionInitial()) {
|
||||||
|
List<GeneralDesc> todos = [];
|
||||||
|
on<AddGendesc>((event, emit) async {
|
||||||
|
await SQLServices.instance.createBldgGeneralDescription(GeneralDesc(
|
||||||
|
bldgapprDetailsId: event.bldgapprDetailsId,
|
||||||
|
assessedById: event.assessedById,
|
||||||
|
assessedByName: event.assessedByName,
|
||||||
|
bldgKind: event.bldgKind,
|
||||||
|
strucType: event.strucType,
|
||||||
|
bldgPermit: event.bldgPermit,
|
||||||
|
dateIssued: event.dateIssued.toString(),
|
||||||
|
cct: event.cct,
|
||||||
|
certCompletionIssued: event.certCompletionIssued.toString(),
|
||||||
|
certOccupancyIssued: event.certOccupancyIssued.toString(),
|
||||||
|
dateCompleted: event.dateCompleted.toString(),
|
||||||
|
dateOccupied: event.dateOccupied.toString(),
|
||||||
|
bldgAge: event.bldgAge,
|
||||||
|
noStoreys: event.noStoreys,
|
||||||
|
area1Stfloor: event.area1Stfloor,
|
||||||
|
area2Ndfloor: event.area2Ndfloor,
|
||||||
|
area3Rdfloor: event.area3Rdfloor,
|
||||||
|
area4Thfloor: event.area4Thfloor,
|
||||||
|
totalFloorArea: event.totalFloorArea,
|
||||||
|
floorSketch: event.floorSketch,
|
||||||
|
actualUse: event.actualUse));
|
||||||
|
});
|
||||||
|
on<FetchSingleGeneralDescription>((event, emit) async {
|
||||||
|
List<Map<String, dynamic>> result =
|
||||||
|
await SQLServices.instance.getGeneralDescription(event.id);
|
||||||
|
|
||||||
|
if (result.isNotEmpty) {
|
||||||
|
List<GeneralDesc> genDescList =
|
||||||
|
result.map((map) => GeneralDesc.fromJson2(map)).toList();
|
||||||
|
|
||||||
|
// Choose a specific element from locationList
|
||||||
|
GeneralDesc firstGenDesc =
|
||||||
|
genDescList.first; // You can change this to select a specific item
|
||||||
|
|
||||||
|
print('location test result');
|
||||||
|
print(firstGenDesc);
|
||||||
|
emit(SpecificGeneralDescriptionLoaded(gendesc: firstGenDesc));
|
||||||
|
} else {
|
||||||
|
print('No data found.');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
part of 'general_description_bloc.dart';
|
||||||
|
|
||||||
|
class GeneralDescriptionEvent extends Equatable {
|
||||||
|
const GeneralDescriptionEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddGendesc extends GeneralDescriptionEvent {
|
||||||
|
final int id;
|
||||||
|
final int bldgapprDetailsId;
|
||||||
|
final String assessedById;
|
||||||
|
final String assessedByName;
|
||||||
|
final String bldgKind;
|
||||||
|
final String strucType;
|
||||||
|
final String bldgPermit;
|
||||||
|
final String dateIssued;
|
||||||
|
final String cct;
|
||||||
|
final String certCompletionIssued;
|
||||||
|
final String certOccupancyIssued;
|
||||||
|
final String dateCompleted;
|
||||||
|
final String dateOccupied;
|
||||||
|
final String bldgAge;
|
||||||
|
final String noStoreys;
|
||||||
|
final String area1Stfloor;
|
||||||
|
final String area2Ndfloor;
|
||||||
|
final String area3Rdfloor;
|
||||||
|
final String area4Thfloor;
|
||||||
|
final String totalFloorArea;
|
||||||
|
final dynamic floorSketch;
|
||||||
|
final String actualUse;
|
||||||
|
|
||||||
|
const AddGendesc({
|
||||||
|
required this.id,
|
||||||
|
required this.bldgapprDetailsId,
|
||||||
|
required this.assessedById,
|
||||||
|
required this.assessedByName,
|
||||||
|
required this.bldgKind,
|
||||||
|
required this.strucType,
|
||||||
|
required this.bldgPermit,
|
||||||
|
required this.dateIssued,
|
||||||
|
required this.cct,
|
||||||
|
required this.certCompletionIssued,
|
||||||
|
required this.certOccupancyIssued,
|
||||||
|
required this.dateCompleted,
|
||||||
|
required this.dateOccupied,
|
||||||
|
required this.bldgAge,
|
||||||
|
required this.noStoreys,
|
||||||
|
required this.area1Stfloor,
|
||||||
|
required this.area2Ndfloor,
|
||||||
|
required this.area3Rdfloor,
|
||||||
|
required this.area4Thfloor,
|
||||||
|
required this.totalFloorArea,
|
||||||
|
required this.floorSketch,
|
||||||
|
required this.actualUse,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
id,
|
||||||
|
bldgapprDetailsId,
|
||||||
|
assessedById,
|
||||||
|
assessedByName,
|
||||||
|
bldgKind,
|
||||||
|
strucType,
|
||||||
|
bldgPermit,
|
||||||
|
dateIssued,
|
||||||
|
cct,
|
||||||
|
certCompletionIssued,
|
||||||
|
certOccupancyIssued,
|
||||||
|
dateCompleted,
|
||||||
|
dateOccupied,
|
||||||
|
bldgAge,
|
||||||
|
noStoreys,
|
||||||
|
area1Stfloor,
|
||||||
|
area2Ndfloor,
|
||||||
|
area3Rdfloor,
|
||||||
|
area4Thfloor,
|
||||||
|
totalFloorArea,
|
||||||
|
floorSketch,
|
||||||
|
actualUse,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class FetchSingleGeneralDescription extends GeneralDescriptionEvent {
|
||||||
|
final int id;
|
||||||
|
const FetchSingleGeneralDescription({required this.id});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [id];
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
part of 'general_description_bloc.dart';
|
||||||
|
|
||||||
|
class GeneralDescriptionState extends Equatable {
|
||||||
|
const GeneralDescriptionState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class GeneralDescriptionInitial extends GeneralDescriptionState {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LocationLoaded extends GeneralDescriptionState {
|
||||||
|
final List<GeneralDesc> gendesc;
|
||||||
|
|
||||||
|
const LocationLoaded({required this.gendesc});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [gendesc];
|
||||||
|
}
|
||||||
|
|
||||||
|
class SpecificGeneralDescriptionLoaded extends GeneralDescriptionState {
|
||||||
|
final GeneralDesc gendesc;
|
||||||
|
|
||||||
|
const SpecificGeneralDescriptionLoaded({required this.gendesc});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [gendesc];
|
||||||
|
}
|
|
@ -0,0 +1,78 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
|
||||||
|
import '../../../../../model/passo/land_ref.dart';
|
||||||
|
import '../../../../../model/passo/todo.dart';
|
||||||
|
import '../../../../../sevices/offline/offline_passo/building/property_owner_info_service.dart';
|
||||||
|
|
||||||
|
part 'landref_location_event.dart';
|
||||||
|
part 'landref_location_state.dart';
|
||||||
|
|
||||||
|
class LandrefLocationBloc
|
||||||
|
extends Bloc<LandrefLocationEvent, LandrefLocationState> {
|
||||||
|
LandrefLocationBloc() : super(LandrefInitial()) {
|
||||||
|
List<LandRef> todos = [];
|
||||||
|
on<AddLandRef>((event, emit) async {
|
||||||
|
await SQLServices.instance.createBldgLandRef(
|
||||||
|
LandRef(
|
||||||
|
id: event.id,
|
||||||
|
bldgapprDetailsId: event.bldgapprDetailsId,
|
||||||
|
assessedById: event.assessedById,
|
||||||
|
assessedByName: event.assessedByName,
|
||||||
|
owner: event.owner,
|
||||||
|
cloaNo: event.cloaNo,
|
||||||
|
lotNo: event.lotNo,
|
||||||
|
tdn: event.tdn,
|
||||||
|
area: event.area,
|
||||||
|
surveyNo: event.surveyNo,
|
||||||
|
blkNo: event.blkNo),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
// on<UpdateTodo>((event, emit) async {
|
||||||
|
// await PropertyOwnerInfoServices.instance.update(
|
||||||
|
// todo: event.todo,
|
||||||
|
// );
|
||||||
|
// });
|
||||||
|
|
||||||
|
// on<FetchLanRef>((event, emit) async {
|
||||||
|
// landref = await PropertyOwnerInfoServices.instance.readAllTodos();
|
||||||
|
// emit(LandrefLoaded(landref: landref));
|
||||||
|
// });
|
||||||
|
|
||||||
|
on<FetchSingleLandref>((event, emit) async {
|
||||||
|
List<Map<String, dynamic>> result =
|
||||||
|
await SQLServices.instance.getLandRef(event.id);
|
||||||
|
|
||||||
|
if (result.isNotEmpty) {
|
||||||
|
LandRef firstRow = LandRef(
|
||||||
|
id: result[0]["id"],
|
||||||
|
bldgapprDetailsId: result[0]["bldgapprDetailsId"],
|
||||||
|
assessedById: result[0]["assessedById"],
|
||||||
|
assessedByName: result[0]["assessedByName"],
|
||||||
|
dateCreated: DateTime.now(),
|
||||||
|
dateModified: DateTime.now(),
|
||||||
|
owner: result[0]["owner"],
|
||||||
|
cloaNo: result[0]["cloaNo"],
|
||||||
|
lotNo: result[0]["lotNo"],
|
||||||
|
tdn: result[0]["tdn"],
|
||||||
|
area: result[0]["area"],
|
||||||
|
surveyNo: result[0]["surveyNo"],
|
||||||
|
blkNo: result[0]["blkNo"],
|
||||||
|
);
|
||||||
|
|
||||||
|
print('landref test result');
|
||||||
|
print(firstRow);
|
||||||
|
emit(SpecificLandrefLoaded(landref: firstRow));
|
||||||
|
} else {
|
||||||
|
print('No data found.');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// on<DeleteTodo>((event, emit) async {
|
||||||
|
// await PropertyOwnerInfoServices.instance.delete(id: event.id);
|
||||||
|
// add(const FetchTodos());
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
part of 'landref_location_bloc.dart';
|
||||||
|
|
||||||
|
class LandrefLocationEvent extends Equatable {
|
||||||
|
const LandrefLocationEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddLandRef extends LandrefLocationEvent {
|
||||||
|
final int id;
|
||||||
|
final int bldgapprDetailsId;
|
||||||
|
final String assessedById;
|
||||||
|
final String assessedByName;
|
||||||
|
final dynamic owner;
|
||||||
|
final dynamic cloaNo;
|
||||||
|
final dynamic lotNo;
|
||||||
|
final dynamic tdn;
|
||||||
|
final dynamic area;
|
||||||
|
final dynamic surveyNo;
|
||||||
|
final dynamic blkNo;
|
||||||
|
|
||||||
|
const AddLandRef({
|
||||||
|
required this.id,
|
||||||
|
required this.bldgapprDetailsId,
|
||||||
|
required this.assessedById,
|
||||||
|
required this.assessedByName,
|
||||||
|
required this.owner,
|
||||||
|
required this.cloaNo,
|
||||||
|
required this.lotNo,
|
||||||
|
required this.tdn,
|
||||||
|
required this.area,
|
||||||
|
required this.surveyNo,
|
||||||
|
required this.blkNo,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
id,
|
||||||
|
bldgapprDetailsId,
|
||||||
|
assessedById,
|
||||||
|
assessedByName,
|
||||||
|
owner,
|
||||||
|
cloaNo,
|
||||||
|
lotNo,
|
||||||
|
tdn,
|
||||||
|
area,
|
||||||
|
surveyNo,
|
||||||
|
blkNo
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdateTodo extends LandrefLocationEvent {
|
||||||
|
final Todo todo;
|
||||||
|
const UpdateTodo({required this.todo});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [todo];
|
||||||
|
}
|
||||||
|
|
||||||
|
class FetchLanRef extends LandrefLocationEvent {
|
||||||
|
const FetchLanRef();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class FetchSingleLandref extends LandrefLocationEvent {
|
||||||
|
final int id;
|
||||||
|
const FetchSingleLandref({required this.id});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [id];
|
||||||
|
}
|
||||||
|
|
||||||
|
// class DeleteTodo extends LandrefLocationEvent {
|
||||||
|
// final int id;
|
||||||
|
// const DeleteTodo({required this.id});
|
||||||
|
// @override
|
||||||
|
// List<Object> get props => [id];
|
||||||
|
// }
|
|
@ -0,0 +1,29 @@
|
||||||
|
part of 'landref_location_bloc.dart';
|
||||||
|
|
||||||
|
class LandrefLocationState extends Equatable {
|
||||||
|
const LandrefLocationState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LandrefInitial extends LandrefLocationState {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LandrefLoaded extends LandrefLocationState {
|
||||||
|
final List<LandRef> landref;
|
||||||
|
|
||||||
|
const LandrefLoaded({required this.landref});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [landref];
|
||||||
|
}
|
||||||
|
|
||||||
|
class SpecificLandrefLoaded extends LandrefLocationState {
|
||||||
|
final LandRef landref;
|
||||||
|
|
||||||
|
const SpecificLandrefLoaded({required this.landref});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [landref];
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
|
||||||
|
import '../../../../../model/passo/bldg_loc.dart';
|
||||||
|
import '../../../../../model/passo/todo.dart';
|
||||||
|
import '../../../../../sevices/offline/offline_passo/building/property_owner_info_service.dart';
|
||||||
|
|
||||||
|
part 'location_event.dart';
|
||||||
|
part 'location_state.dart';
|
||||||
|
|
||||||
|
class LocationBloc extends Bloc<LocationEvent, LocationState> {
|
||||||
|
LocationBloc() : super(LocationInitial()) {
|
||||||
|
List<BldgLoc> todos = [];
|
||||||
|
on<AddLocation>((event, emit) async {
|
||||||
|
await SQLServices.instance.createBldglocation(BldgLoc(
|
||||||
|
id: event.id,
|
||||||
|
bldgapprDetailsId: event.bldgapprDetailsId,
|
||||||
|
assessedById: event.assessedById,
|
||||||
|
assessedByName: event.assessedByName,
|
||||||
|
street: event.street,
|
||||||
|
barangay: event.barangay,
|
||||||
|
municipality: event.municipality,
|
||||||
|
province: event.province,
|
||||||
|
));
|
||||||
|
});
|
||||||
|
on<FetchSingleLocation>((event, emit) async {
|
||||||
|
List<Map<String, dynamic>> result =
|
||||||
|
await SQLServices.instance.getLocation(event.id);
|
||||||
|
|
||||||
|
if (result.isNotEmpty) {
|
||||||
|
List<BldgLoc> locationList =
|
||||||
|
result.map((map) => BldgLoc.fromJson(map)).toList();
|
||||||
|
|
||||||
|
// Choose a specific element from locationList
|
||||||
|
BldgLoc firstLocation =
|
||||||
|
locationList.first; // You can change this to select a specific item
|
||||||
|
|
||||||
|
print('location test result');
|
||||||
|
print(firstLocation);
|
||||||
|
emit(SpecificLocationLoaded(location: firstLocation));
|
||||||
|
} else {
|
||||||
|
print('No data found.');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
part of 'location_bloc.dart';
|
||||||
|
|
||||||
|
class LocationEvent extends Equatable {
|
||||||
|
const LocationEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddLocation extends LocationEvent {
|
||||||
|
final int id;
|
||||||
|
final int bldgapprDetailsId;
|
||||||
|
final String assessedById;
|
||||||
|
final String assessedByName;
|
||||||
|
final String street;
|
||||||
|
final String barangay;
|
||||||
|
final String municipality;
|
||||||
|
final String province;
|
||||||
|
|
||||||
|
const AddLocation({
|
||||||
|
required this.id,
|
||||||
|
required this.bldgapprDetailsId,
|
||||||
|
required this.assessedById,
|
||||||
|
required this.assessedByName,
|
||||||
|
required this.street,
|
||||||
|
required this.barangay,
|
||||||
|
required this.municipality,
|
||||||
|
required this.province,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
bldgapprDetailsId,
|
||||||
|
assessedById,
|
||||||
|
assessedByName,
|
||||||
|
street,
|
||||||
|
barangay,
|
||||||
|
municipality,
|
||||||
|
province,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdateTodo extends LocationEvent {
|
||||||
|
final Todo todo;
|
||||||
|
const UpdateTodo({required this.todo});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [todo];
|
||||||
|
}
|
||||||
|
|
||||||
|
class FetchLanRef extends LocationEvent {
|
||||||
|
const FetchLanRef();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class FetchSingleLocation extends LocationEvent {
|
||||||
|
final int id;
|
||||||
|
const FetchSingleLocation({required this.id});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [id];
|
||||||
|
}
|
||||||
|
|
||||||
|
// class DeleteTodo extends LocationEvent {
|
||||||
|
// final int id;
|
||||||
|
// const DeleteTodo({required this.id});
|
||||||
|
// @override
|
||||||
|
// List<Object> get props => [id];
|
||||||
|
// }
|
|
@ -0,0 +1,29 @@
|
||||||
|
part of 'location_bloc.dart';
|
||||||
|
|
||||||
|
class LocationState extends Equatable {
|
||||||
|
const LocationState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LocationInitial extends LocationState {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class LocationLoaded extends LocationState {
|
||||||
|
final List<BldgLoc> location;
|
||||||
|
|
||||||
|
const LocationLoaded({required this.location});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [location];
|
||||||
|
}
|
||||||
|
|
||||||
|
class SpecificLocationLoaded extends LocationState {
|
||||||
|
final BldgLoc location;
|
||||||
|
|
||||||
|
const SpecificLocationLoaded({required this.location});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [location];
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:unit2/sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
import '../../../../../model/passo/property_info.dart';
|
||||||
|
import '../../../../../model/passo/todo.dart';
|
||||||
|
import '../../../../../sevices/offline/offline_passo/building/property_owner_info_service.dart';
|
||||||
|
|
||||||
|
part 'crud_event.dart';
|
||||||
|
part 'crud_state.dart';
|
||||||
|
|
||||||
|
class CrudBloc extends Bloc<CrudEvent, CrudState> {
|
||||||
|
CrudBloc() : super(CrudInitial()) {
|
||||||
|
List<PropertyInfo> todos = [];
|
||||||
|
on<AddTodo>((event, emit) async {
|
||||||
|
await SQLServices.instance.createBldgOwner(
|
||||||
|
PropertyInfo(
|
||||||
|
transCode: event.transCode,
|
||||||
|
tdn: event.tdn,
|
||||||
|
pin: event.pin,
|
||||||
|
owner: event.owner,
|
||||||
|
address: event.address,
|
||||||
|
telno: event.telno,
|
||||||
|
tin: event.tin,
|
||||||
|
adminUser: event.adminUser,
|
||||||
|
adminAddress: event.adminAddress,
|
||||||
|
adminTelno: event.adminTelno,
|
||||||
|
adminTin: event.adminTin,
|
||||||
|
faasType: event.faasType,
|
||||||
|
assessedById: event.assessedById,
|
||||||
|
assessedByName: event.assessedByName),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
on<UpdateTodo>((event, emit) async {
|
||||||
|
await PropertyOwnerInfoServices.instance.update(
|
||||||
|
todo: event.todo,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
on<FetchTodos>((event, emit) async {
|
||||||
|
todos = await SQLServices.instance.readAllBldgOwner();
|
||||||
|
emit(DisplayTodos(todo: todos));
|
||||||
|
});
|
||||||
|
|
||||||
|
// on<FetchSpecificTodo>((event, emit) async {
|
||||||
|
// Prop todo = await PropertyOwnerInfoServices.instance.readTodo(id: event.id);
|
||||||
|
// emit(DisplaySpecificTodo(todo: todo));
|
||||||
|
// });
|
||||||
|
|
||||||
|
on<DeleteTodo>((event, emit) async {
|
||||||
|
await SQLServices.instance.deleteBldgOwner(id: event.id);
|
||||||
|
add(const FetchTodos());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,88 @@
|
||||||
|
part of 'crud_bloc.dart';
|
||||||
|
|
||||||
|
abstract class CrudEvent extends Equatable {
|
||||||
|
const CrudEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddTodo extends CrudEvent {
|
||||||
|
final String id;
|
||||||
|
final String transCode;
|
||||||
|
final String tdn;
|
||||||
|
final String pin;
|
||||||
|
final String 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;
|
||||||
|
final String assessedById;
|
||||||
|
final String assessedByName;
|
||||||
|
|
||||||
|
const AddTodo(
|
||||||
|
{required this.id,
|
||||||
|
required this.transCode,
|
||||||
|
required this.tdn,
|
||||||
|
required this.pin,
|
||||||
|
required this.owner,
|
||||||
|
required this.address,
|
||||||
|
required this.telno,
|
||||||
|
required this.tin,
|
||||||
|
required this.adminUser,
|
||||||
|
required this.adminAddress,
|
||||||
|
required this.adminTelno,
|
||||||
|
required this.adminTin,
|
||||||
|
required this.faasType,
|
||||||
|
required this.assessedById,
|
||||||
|
required this.assessedByName});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object?> get props => [
|
||||||
|
id,
|
||||||
|
transCode,
|
||||||
|
tdn,
|
||||||
|
pin,
|
||||||
|
owner,
|
||||||
|
address,
|
||||||
|
telno,
|
||||||
|
tin,
|
||||||
|
adminUser,
|
||||||
|
adminAddress,
|
||||||
|
adminTelno,
|
||||||
|
adminTin,
|
||||||
|
faasType,
|
||||||
|
assessedById,
|
||||||
|
assessedByName
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdateTodo extends CrudEvent {
|
||||||
|
final Todo todo;
|
||||||
|
const UpdateTodo({required this.todo});
|
||||||
|
@override
|
||||||
|
List<Object?> get props => [todo];
|
||||||
|
}
|
||||||
|
|
||||||
|
class FetchTodos extends CrudEvent {
|
||||||
|
const FetchTodos();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object?> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class FetchSpecificTodo extends CrudEvent {
|
||||||
|
final int id;
|
||||||
|
const FetchSpecificTodo({required this.id});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object?> get props => [id];
|
||||||
|
}
|
||||||
|
|
||||||
|
class DeleteTodo extends CrudEvent {
|
||||||
|
final int id;
|
||||||
|
const DeleteTodo({required this.id});
|
||||||
|
@override
|
||||||
|
List<Object?> get props => [id];
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
part of 'crud_bloc.dart';
|
||||||
|
|
||||||
|
abstract class CrudState extends Equatable {
|
||||||
|
const CrudState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class CrudInitial extends CrudState {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class DisplayTodos extends CrudState {
|
||||||
|
final List<PropertyInfo> todo;
|
||||||
|
|
||||||
|
const DisplayTodos({required this.todo});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [todo];
|
||||||
|
}
|
||||||
|
|
||||||
|
class DisplaySpecificTodo extends CrudState {
|
||||||
|
final Todo todo;
|
||||||
|
|
||||||
|
const DisplaySpecificTodo({required this.todo});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [todo];
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
|
||||||
|
import '../../../../../model/passo/structural_materials_ii.dart';
|
||||||
|
import '../../../../../model/passo/structureMaterial.dart';
|
||||||
|
import '../../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
|
||||||
|
part 'structural_material_offline_event.dart';
|
||||||
|
part 'structural_material_offline_state.dart';
|
||||||
|
|
||||||
|
class StructuralMaterialOfflineBloc extends Bloc<StructuralMaterialOfflineEvent,
|
||||||
|
StructuralMaterialOfflineState> {
|
||||||
|
StructuralMaterialOfflineBloc() : super(StructuralMaterialOfflineInitial()) {
|
||||||
|
List<StructureMaterials> materials = [];
|
||||||
|
on<AddStructuralMaterial>((event, emit) async {
|
||||||
|
await SQLServices.instance.createStructuralMaterials(StructureMaterialsII(
|
||||||
|
id: event.id,
|
||||||
|
bldgapprDetailsId: event.bldgapprDetailsId,
|
||||||
|
foundation: event.foundation!.join(', ').split(', '),
|
||||||
|
columns: event.columns!.join(', ').split(', '),
|
||||||
|
beams: event.beams!.join(', ').split(', '),
|
||||||
|
trussFraming: event.trussFraming!.join(', ').split(', '),
|
||||||
|
roof: event.roof!.join(', ').split(', '),
|
||||||
|
flooring: event.flooring!.join(', ').split(', '),
|
||||||
|
walls: event.walls!.join(', ').split(', '),
|
||||||
|
others: event.others!.join(', ').split(', '),
|
||||||
|
));
|
||||||
|
});
|
||||||
|
on<FetchSingleStructuralMaterial>((event, emit) async {
|
||||||
|
List<Map<String, dynamic>> result =
|
||||||
|
await SQLServices.instance.getStructuralMaterials(event.id);
|
||||||
|
|
||||||
|
if (result.isNotEmpty) {
|
||||||
|
List<StructureMaterials> materialList =
|
||||||
|
result.map((map) => StructureMaterials.fromJson(map)).toList();
|
||||||
|
|
||||||
|
// Choose a specific element from locationList
|
||||||
|
StructureMaterials firstMaterial =
|
||||||
|
materialList.first; // You can change this to select a specific item
|
||||||
|
|
||||||
|
print('struct mat test result');
|
||||||
|
print(firstMaterial);
|
||||||
|
emit(SpecificStructuralMaterialLoaded(materials: firstMaterial));
|
||||||
|
} else {
|
||||||
|
print('No data found.');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
part of 'structural_material_offline_bloc.dart';
|
||||||
|
|
||||||
|
class StructuralMaterialOfflineEvent extends Equatable {
|
||||||
|
const StructuralMaterialOfflineEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddStructuralMaterial extends StructuralMaterialOfflineEvent {
|
||||||
|
final int id;
|
||||||
|
final int bldgapprDetailsId;
|
||||||
|
final List<String>? foundation;
|
||||||
|
final List<String>? columns;
|
||||||
|
final List<String>? beams;
|
||||||
|
final List<String>? trussFraming;
|
||||||
|
final List<String>? roof;
|
||||||
|
final List<String>? flooring;
|
||||||
|
final List<String>? walls;
|
||||||
|
final List<String>? others;
|
||||||
|
|
||||||
|
const AddStructuralMaterial({
|
||||||
|
required this.id,
|
||||||
|
required this.bldgapprDetailsId,
|
||||||
|
required this.foundation,
|
||||||
|
required this.columns,
|
||||||
|
required this.beams,
|
||||||
|
required this.trussFraming,
|
||||||
|
required this.roof,
|
||||||
|
required this.flooring,
|
||||||
|
required this.walls,
|
||||||
|
required this.others,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
id,
|
||||||
|
bldgapprDetailsId,
|
||||||
|
...?foundation,
|
||||||
|
...?columns,
|
||||||
|
...?beams,
|
||||||
|
...?trussFraming,
|
||||||
|
...?roof,
|
||||||
|
...?flooring,
|
||||||
|
...?walls,
|
||||||
|
...?others
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class FetchSingleStructuralMaterial extends StructuralMaterialOfflineEvent {
|
||||||
|
final int id;
|
||||||
|
const FetchSingleStructuralMaterial({required this.id});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [id];
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
part of 'structural_material_offline_bloc.dart';
|
||||||
|
|
||||||
|
class StructuralMaterialOfflineState extends Equatable {
|
||||||
|
const StructuralMaterialOfflineState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class StructuralMaterialOfflineInitial extends StructuralMaterialOfflineState {
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class StructuralMaterialLoaded extends StructuralMaterialOfflineState {
|
||||||
|
final List<StructureMaterials> materials;
|
||||||
|
|
||||||
|
const StructuralMaterialLoaded({required this.materials});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [materials];
|
||||||
|
}
|
||||||
|
|
||||||
|
class SpecificStructuralMaterialLoaded extends StructuralMaterialOfflineState {
|
||||||
|
final StructureMaterials materials;
|
||||||
|
|
||||||
|
const SpecificStructuralMaterialLoaded({required this.materials});
|
||||||
|
@override
|
||||||
|
List<Object> get props => [materials];
|
||||||
|
}
|
|
@ -24,8 +24,8 @@ class AdditionalItems {
|
||||||
final dynamic depreciationRate;
|
final dynamic depreciationRate;
|
||||||
final dynamic adjustedMarketVal;
|
final dynamic adjustedMarketVal;
|
||||||
final dynamic amtDepreciation;
|
final dynamic amtDepreciation;
|
||||||
final bool painted;
|
final String painted;
|
||||||
final bool secondhand;
|
final String secondhand;
|
||||||
final dynamic paintedUnitval;
|
final dynamic paintedUnitval;
|
||||||
final dynamic secondhandUnitval;
|
final dynamic secondhandUnitval;
|
||||||
final String actualUse;
|
final String actualUse;
|
||||||
|
@ -50,25 +50,64 @@ class AdditionalItems {
|
||||||
required this.actualUse,
|
required this.actualUse,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
AdditionalItems copy({
|
||||||
|
int? id,
|
||||||
|
int? bldgapprDetailsId,
|
||||||
|
int? classId,
|
||||||
|
String? className,
|
||||||
|
String? structType,
|
||||||
|
dynamic unitValue,
|
||||||
|
dynamic baseUnitValue,
|
||||||
|
dynamic area,
|
||||||
|
dynamic marketValue,
|
||||||
|
dynamic depreciationRate,
|
||||||
|
dynamic adjustedMarketVal,
|
||||||
|
dynamic amtDepreciation,
|
||||||
|
String? painted,
|
||||||
|
String? secondhand,
|
||||||
|
dynamic paintedUnitval,
|
||||||
|
dynamic secondhandUnitval,
|
||||||
|
String? actualUse,
|
||||||
|
}) {
|
||||||
|
return AdditionalItems(
|
||||||
|
id: id ?? this.id,
|
||||||
|
bldgapprDetailsId: bldgapprDetailsId ?? this.bldgapprDetailsId,
|
||||||
|
classId: classId ?? this.classId,
|
||||||
|
className: className ?? this.className,
|
||||||
|
structType: structType ?? this.structType,
|
||||||
|
unitValue: unitValue ?? this.unitValue,
|
||||||
|
baseUnitValue: baseUnitValue ?? this.baseUnitValue,
|
||||||
|
area: area ?? this.area,
|
||||||
|
marketValue: marketValue ?? this.marketValue,
|
||||||
|
depreciationRate: depreciationRate ?? this.depreciationRate,
|
||||||
|
adjustedMarketVal: adjustedMarketVal ?? this.adjustedMarketVal,
|
||||||
|
amtDepreciation: amtDepreciation ?? this.amtDepreciation,
|
||||||
|
painted: painted ?? this.painted,
|
||||||
|
secondhand: secondhand ?? this.secondhand,
|
||||||
|
paintedUnitval: paintedUnitval ?? this.paintedUnitval,
|
||||||
|
secondhandUnitval: secondhandUnitval ?? this.secondhandUnitval,
|
||||||
|
actualUse: actualUse ?? this.actualUse);
|
||||||
|
}
|
||||||
|
|
||||||
factory AdditionalItems.fromJson(Map<String, dynamic> json) =>
|
factory AdditionalItems.fromJson(Map<String, dynamic> json) =>
|
||||||
AdditionalItems(
|
AdditionalItems(
|
||||||
id: json["id"],
|
id: json["id"],
|
||||||
bldgapprDetailsId: json["bldgappr_details_id"],
|
bldgapprDetailsId: json["bldgapprDetailsId"],
|
||||||
classId: json["class_id"],
|
classId: json["classId"],
|
||||||
className: json["class_name"],
|
className: json["className"],
|
||||||
structType: json["struct_type"],
|
structType: json["structType"],
|
||||||
unitValue: json["unit_value"],
|
unitValue: json["unitValue"],
|
||||||
baseUnitValue: json["base_unit_value"],
|
baseUnitValue: json["baseUnitValue"],
|
||||||
area: json["area"],
|
area: json["area"],
|
||||||
marketValue: json["market_value"],
|
marketValue: json["marketValue"],
|
||||||
depreciationRate: json["depreciation_rate"],
|
depreciationRate: json["depreciationRate"],
|
||||||
adjustedMarketVal: json["adjusted_market_val"],
|
adjustedMarketVal: json["adjustedMarketVal"],
|
||||||
amtDepreciation: json["amt_depreciation"],
|
amtDepreciation: json["amtDepreciation"],
|
||||||
painted: json["painted"],
|
painted: json["painted"],
|
||||||
secondhand: json["secondhand"],
|
secondhand: json["secondhand"],
|
||||||
paintedUnitval: json["painted_unitval"],
|
paintedUnitval: json["paintedUnitval"],
|
||||||
secondhandUnitval: json["secondhand_unitval"],
|
secondhandUnitval: json["secondhandUnitval"],
|
||||||
actualUse: json["actual_use"],
|
actualUse: json["actualUse"],
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
|
|
|
@ -9,26 +9,52 @@ Brgy barangayFromJson(String str) => Brgy.fromJson(json.decode(str));
|
||||||
String barangayToJson(Brgy data) => json.encode(data.toJson());
|
String barangayToJson(Brgy data) => json.encode(data.toJson());
|
||||||
|
|
||||||
class Brgy {
|
class Brgy {
|
||||||
|
final int? id;
|
||||||
final int? barangayId;
|
final int? barangayId;
|
||||||
final String? barangayCode;
|
final String? barangayCode;
|
||||||
final String? cityCode;
|
final String? cityCode;
|
||||||
final String? barangayDescription;
|
final String? barangayDescription;
|
||||||
|
|
||||||
Brgy({
|
Brgy({
|
||||||
|
this.id,
|
||||||
this.barangayId,
|
this.barangayId,
|
||||||
this.barangayCode,
|
this.barangayCode,
|
||||||
this.cityCode,
|
this.cityCode,
|
||||||
this.barangayDescription,
|
this.barangayDescription,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Brgy copy(
|
||||||
|
{int? id,
|
||||||
|
int? barangayId,
|
||||||
|
String? barangayCode,
|
||||||
|
String? cityCode,
|
||||||
|
String? barangayDescription}) {
|
||||||
|
return Brgy(
|
||||||
|
id: id ?? this.id,
|
||||||
|
barangayId: barangayId ?? this.barangayId,
|
||||||
|
barangayCode: barangayCode ?? this.barangayCode,
|
||||||
|
cityCode: cityCode ?? this.cityCode,
|
||||||
|
barangayDescription: barangayDescription ?? this.barangayDescription);
|
||||||
|
}
|
||||||
|
|
||||||
factory Brgy.fromJson(Map<String, dynamic> json) => Brgy(
|
factory Brgy.fromJson(Map<String, dynamic> json) => Brgy(
|
||||||
|
id: json["id"],
|
||||||
barangayId: json["barangay_id"],
|
barangayId: json["barangay_id"],
|
||||||
barangayCode: json["barangay_code"],
|
barangayCode: json["barangay_code"],
|
||||||
cityCode: json["city_code"],
|
cityCode: json["city_code"],
|
||||||
barangayDescription: json["barangay_description"],
|
barangayDescription: json["barangay_description"],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
factory Brgy.fromJson2(Map<String, dynamic> json) => Brgy(
|
||||||
|
id: json["id"],
|
||||||
|
barangayId: json["barangayId"],
|
||||||
|
barangayCode: json["barangayCode"],
|
||||||
|
cityCode: json["cityCode"],
|
||||||
|
barangayDescription: json["barangayDescription"],
|
||||||
|
);
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
|
"id": id,
|
||||||
"barangay_id": barangayId,
|
"barangay_id": barangayId,
|
||||||
"barangay_code": barangayCode,
|
"barangay_code": barangayCode,
|
||||||
"city_code": cityCode,
|
"city_code": cityCode,
|
||||||
|
|
|
@ -33,6 +33,31 @@ class BldgLoc {
|
||||||
this.province,
|
this.province,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
BldgLoc copy({
|
||||||
|
int? id,
|
||||||
|
int? bldgapprDetailsId,
|
||||||
|
String? assessedById,
|
||||||
|
String? assessedByName,
|
||||||
|
DateTime? dateCreated,
|
||||||
|
DateTime? dateModified,
|
||||||
|
dynamic street,
|
||||||
|
dynamic barangay,
|
||||||
|
dynamic municipality,
|
||||||
|
dynamic province,
|
||||||
|
}) {
|
||||||
|
return BldgLoc(
|
||||||
|
id: id ?? this.id,
|
||||||
|
bldgapprDetailsId: bldgapprDetailsId ?? this.bldgapprDetailsId,
|
||||||
|
assessedById: assessedById ?? this.assessedById,
|
||||||
|
assessedByName: assessedByName ?? this.assessedByName,
|
||||||
|
dateCreated: dateCreated ?? this.dateCreated,
|
||||||
|
dateModified: dateModified ?? this.dateModified,
|
||||||
|
street: street ?? this.street,
|
||||||
|
barangay: barangay ?? this.barangay,
|
||||||
|
municipality: municipality ?? this.municipality,
|
||||||
|
province: province ?? this.province);
|
||||||
|
}
|
||||||
|
|
||||||
factory BldgLoc.fromJson(Map<String, dynamic> json) => BldgLoc(
|
factory BldgLoc.fromJson(Map<String, dynamic> json) => BldgLoc(
|
||||||
id: json["id"],
|
id: json["id"],
|
||||||
bldgapprDetailsId: json["bldgappr_details_id"],
|
bldgapprDetailsId: json["bldgappr_details_id"],
|
||||||
|
|
|
@ -9,20 +9,37 @@ City cityFromJson(String str) => City.fromJson(json.decode(str));
|
||||||
String cityToJson(City data) => json.encode(data.toJson());
|
String cityToJson(City data) => json.encode(data.toJson());
|
||||||
|
|
||||||
class City {
|
class City {
|
||||||
|
final int? id;
|
||||||
final String? cityCode;
|
final String? cityCode;
|
||||||
final String? cityDescription;
|
final String? cityDescription;
|
||||||
|
|
||||||
City({
|
City({
|
||||||
|
this.id,
|
||||||
this.cityCode,
|
this.cityCode,
|
||||||
this.cityDescription,
|
this.cityDescription,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
City copy({int? id, String? cityCode, String? cityDescription}) {
|
||||||
|
return City(
|
||||||
|
id: id ?? this.id,
|
||||||
|
cityCode: cityCode ?? this.cityCode,
|
||||||
|
cityDescription: cityDescription ?? this.cityDescription);
|
||||||
|
}
|
||||||
|
|
||||||
factory City.fromJson(Map<String, dynamic> json) => City(
|
factory City.fromJson(Map<String, dynamic> json) => City(
|
||||||
|
id: json["id"],
|
||||||
cityCode: json["city_code"],
|
cityCode: json["city_code"],
|
||||||
cityDescription: json["city_description"],
|
cityDescription: json["city_description"],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
factory City.fromJson2(Map<String, dynamic> json) => City(
|
||||||
|
id: json["id"],
|
||||||
|
cityCode: json["cityCode"],
|
||||||
|
cityDescription: json["cityDescription"],
|
||||||
|
);
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
|
"id": id,
|
||||||
"city_code": cityCode,
|
"city_code": cityCode,
|
||||||
"city_description": cityDescription,
|
"city_description": cityDescription,
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,156 @@
|
||||||
|
// To parse this JSON data, do
|
||||||
|
//
|
||||||
|
// final classComponents = classComponentsFromJson(jsonString);
|
||||||
|
|
||||||
|
import 'package:meta/meta.dart';
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
ClassComponentsOffline classComponentsFromJson(String str) =>
|
||||||
|
ClassComponentsOffline.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String classComponentsToJson(ClassComponentsOffline data) =>
|
||||||
|
json.encode(data.toJson());
|
||||||
|
|
||||||
|
class ClassComponentsOffline {
|
||||||
|
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 int? withoutBucc;
|
||||||
|
|
||||||
|
ClassComponentsOffline({
|
||||||
|
this.id,
|
||||||
|
this.componentName,
|
||||||
|
this.minBaseUnitvalPercent,
|
||||||
|
this.maxBaseUnitvalPercent,
|
||||||
|
this.minUnitvalSqrmtr,
|
||||||
|
this.maxUnitvalSqrmtr,
|
||||||
|
this.minAddBaseunitval,
|
||||||
|
this.maxAddBaseunitval,
|
||||||
|
this.minDeductBaserate,
|
||||||
|
this.maxDeductBaserate,
|
||||||
|
this.minLinearMeter,
|
||||||
|
this.maxLinearMeter,
|
||||||
|
this.minSpacing,
|
||||||
|
this.maxSpacing,
|
||||||
|
this.roughFinish,
|
||||||
|
this.highFinish,
|
||||||
|
this.withoutBucc,
|
||||||
|
});
|
||||||
|
|
||||||
|
ClassComponentsOffline copy({
|
||||||
|
int? id,
|
||||||
|
String? componentName,
|
||||||
|
String? minBaseUnitvalPercent,
|
||||||
|
String? maxBaseUnitvalPercent,
|
||||||
|
String? minUnitvalSqrmtr,
|
||||||
|
String? maxUnitvalSqrmtr,
|
||||||
|
String? minAddBaseunitval,
|
||||||
|
String? maxAddBaseunitval,
|
||||||
|
String? minDeductBaserate,
|
||||||
|
String? maxDeductBaserate,
|
||||||
|
String? minLinearMeter,
|
||||||
|
String? maxLinearMeter,
|
||||||
|
String? minSpacing,
|
||||||
|
String? maxSpacing,
|
||||||
|
String? roughFinish,
|
||||||
|
String? highFinish,
|
||||||
|
int? withoutBucc,
|
||||||
|
}) {
|
||||||
|
return ClassComponentsOffline(
|
||||||
|
id: id ?? this.id,
|
||||||
|
componentName: componentName ?? this.componentName,
|
||||||
|
minBaseUnitvalPercent:
|
||||||
|
minBaseUnitvalPercent ?? this.minBaseUnitvalPercent,
|
||||||
|
maxBaseUnitvalPercent:
|
||||||
|
maxBaseUnitvalPercent ?? this.maxBaseUnitvalPercent,
|
||||||
|
minUnitvalSqrmtr: minUnitvalSqrmtr ?? this.minUnitvalSqrmtr,
|
||||||
|
maxUnitvalSqrmtr: maxUnitvalSqrmtr ?? this.maxUnitvalSqrmtr,
|
||||||
|
minAddBaseunitval: minAddBaseunitval ?? this.minAddBaseunitval,
|
||||||
|
maxAddBaseunitval: maxAddBaseunitval ?? this.maxAddBaseunitval,
|
||||||
|
minDeductBaserate: minDeductBaserate ?? this.minDeductBaserate,
|
||||||
|
maxDeductBaserate: maxDeductBaserate ?? this.maxDeductBaserate,
|
||||||
|
minLinearMeter: minLinearMeter ?? this.minLinearMeter,
|
||||||
|
maxLinearMeter: maxLinearMeter ?? this.maxLinearMeter,
|
||||||
|
minSpacing: minSpacing ?? this.minSpacing,
|
||||||
|
maxSpacing: maxSpacing ?? this.maxSpacing,
|
||||||
|
roughFinish: roughFinish ?? this.roughFinish,
|
||||||
|
highFinish: highFinish ?? this.highFinish,
|
||||||
|
withoutBucc: withoutBucc ?? this.withoutBucc,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
factory ClassComponentsOffline.fromJson(Map<String, dynamic> json) =>
|
||||||
|
ClassComponentsOffline(
|
||||||
|
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"],
|
||||||
|
);
|
||||||
|
|
||||||
|
factory ClassComponentsOffline.fromJson2(Map<String, dynamic> json) =>
|
||||||
|
ClassComponentsOffline(
|
||||||
|
id: json["id"],
|
||||||
|
componentName: json["componentName"],
|
||||||
|
minBaseUnitvalPercent: json["minBaseUnitvalPercent"],
|
||||||
|
maxBaseUnitvalPercent: json["maxBaseUnitvalPercent"],
|
||||||
|
minUnitvalSqrmtr: json["minUnitvalSqrmtr"],
|
||||||
|
maxUnitvalSqrmtr: json["maxUnitvalSqrmtr"],
|
||||||
|
minAddBaseunitval: json["minAddBaseunitval"],
|
||||||
|
maxAddBaseunitval: json["maxAddBaseunitval"],
|
||||||
|
minDeductBaserate: json["minDeductBaserate"],
|
||||||
|
maxDeductBaserate: json["maxDeductBaserate"],
|
||||||
|
minLinearMeter: json["minLinearMeter"],
|
||||||
|
maxLinearMeter: json["maxLinearMeter"],
|
||||||
|
minSpacing: json["minSpacing"],
|
||||||
|
maxSpacing: json["maxSpacing"],
|
||||||
|
roughFinish: json["roughFinish"],
|
||||||
|
highFinish: json["highFinish"],
|
||||||
|
withoutBucc: json["withoutBucc"],
|
||||||
|
);
|
||||||
|
|
||||||
|
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,
|
||||||
|
};
|
||||||
|
}
|
|
@ -14,19 +14,19 @@ class GeneralDesc {
|
||||||
final int? bldgapprDetailsId;
|
final int? bldgapprDetailsId;
|
||||||
final String? assessedById;
|
final String? assessedById;
|
||||||
final String? assessedByName;
|
final String? assessedByName;
|
||||||
final DateTime? dateCreated;
|
final String? dateCreated;
|
||||||
final DateTime? dateModified;
|
final String? dateModified;
|
||||||
final String? bldgKind;
|
final String? bldgKind;
|
||||||
final String? strucType;
|
final String? strucType;
|
||||||
final String? bldgPermit;
|
final String? bldgPermit;
|
||||||
final DateTime? dateIssued;
|
final String? dateIssued;
|
||||||
final String? cct;
|
final String? cct;
|
||||||
final DateTime? certCompletionIssued;
|
final String? certCompletionIssued;
|
||||||
final DateTime? certOccupancyIssued;
|
final String? certOccupancyIssued;
|
||||||
final DateTime? dateCompleted;
|
final String? dateCompleted;
|
||||||
final DateTime? dateOccupied;
|
final String? dateOccupied;
|
||||||
final int? bldgAge;
|
final String? bldgAge;
|
||||||
final int? noStoreys;
|
final String? noStoreys;
|
||||||
final String? area1Stfloor;
|
final String? area1Stfloor;
|
||||||
final String? area2Ndfloor;
|
final String? area2Ndfloor;
|
||||||
final String? area3Rdfloor;
|
final String? area3Rdfloor;
|
||||||
|
@ -62,36 +62,75 @@ class GeneralDesc {
|
||||||
this.actualUse,
|
this.actualUse,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
GeneralDesc copy({
|
||||||
|
int? id,
|
||||||
|
int? bldgapprDetailsId,
|
||||||
|
String? assessedById,
|
||||||
|
String? assessedByName,
|
||||||
|
String? dateCreated,
|
||||||
|
String? dateModified,
|
||||||
|
String? bldgKind,
|
||||||
|
String? strucType,
|
||||||
|
String? bldgPermit,
|
||||||
|
String? dateIssued,
|
||||||
|
String? cct,
|
||||||
|
String? certCompletionIssued,
|
||||||
|
String? certOccupancyIssued,
|
||||||
|
String? dateCompleted,
|
||||||
|
String? dateOccupied,
|
||||||
|
String? bldgAge,
|
||||||
|
String? noStoreys,
|
||||||
|
String? area1Stfloor,
|
||||||
|
String? area2Ndfloor,
|
||||||
|
String? area3Rdfloor,
|
||||||
|
String? area4Thfloor,
|
||||||
|
String? totalFloorArea,
|
||||||
|
dynamic floorSketch,
|
||||||
|
String? actualUse,
|
||||||
|
}) {
|
||||||
|
return GeneralDesc(
|
||||||
|
id: id ?? this.id,
|
||||||
|
bldgapprDetailsId: bldgapprDetailsId ?? this.bldgapprDetailsId,
|
||||||
|
assessedById: assessedById ?? this.assessedById,
|
||||||
|
assessedByName: assessedByName ?? this.assessedByName,
|
||||||
|
dateCreated: dateCreated ?? this.dateCreated,
|
||||||
|
dateModified: dateModified ?? this.dateModified,
|
||||||
|
bldgKind: bldgKind ?? this.bldgKind,
|
||||||
|
strucType: strucType ?? this.strucType,
|
||||||
|
bldgPermit: bldgPermit ?? this.bldgPermit,
|
||||||
|
dateIssued: dateIssued ?? this.dateIssued,
|
||||||
|
cct: cct ?? this.cct,
|
||||||
|
certCompletionIssued: certCompletionIssued ?? this.certCompletionIssued,
|
||||||
|
certOccupancyIssued: certOccupancyIssued ?? this.certOccupancyIssued,
|
||||||
|
dateCompleted: dateCompleted ?? this.dateCompleted,
|
||||||
|
dateOccupied: dateOccupied ?? this.dateOccupied,
|
||||||
|
bldgAge: bldgAge ?? this.bldgAge,
|
||||||
|
noStoreys: noStoreys ?? this.noStoreys,
|
||||||
|
area1Stfloor: area1Stfloor ?? this.area1Stfloor,
|
||||||
|
area2Ndfloor: area2Ndfloor ?? this.area2Ndfloor,
|
||||||
|
area3Rdfloor: area3Rdfloor ?? this.area3Rdfloor,
|
||||||
|
area4Thfloor: area4Thfloor ?? this.area4Thfloor,
|
||||||
|
totalFloorArea: totalFloorArea ?? this.totalFloorArea,
|
||||||
|
floorSketch: floorSketch ?? this.floorSketch,
|
||||||
|
actualUse: actualUse ?? this.actualUse);
|
||||||
|
}
|
||||||
|
|
||||||
factory GeneralDesc.fromJson(Map<String, dynamic> json) => GeneralDesc(
|
factory GeneralDesc.fromJson(Map<String, dynamic> json) => GeneralDesc(
|
||||||
id: json["id"],
|
id: json["id"],
|
||||||
bldgapprDetailsId: json["bldgappr_details_id"],
|
bldgapprDetailsId: json["bldgappr_details_id"],
|
||||||
assessedById: json["assessed_by_id"],
|
assessedById: json["assessed_by_id"],
|
||||||
assessedByName: json["assessed_by_name"],
|
assessedByName: json["assessed_by_name"],
|
||||||
dateCreated: json["date_created"] == null
|
dateCreated: json["date_created"],
|
||||||
? null
|
dateModified: json["date_modified"],
|
||||||
: DateTime.parse(json["date_created"]),
|
|
||||||
dateModified: json["date_modified"] == null
|
|
||||||
? null
|
|
||||||
: DateTime.parse(json["date_modified"]),
|
|
||||||
bldgKind: json["bldg_kind"],
|
bldgKind: json["bldg_kind"],
|
||||||
strucType: json["struc_type"],
|
strucType: json["struc_type"],
|
||||||
bldgPermit: json["bldg_permit"],
|
bldgPermit: json["bldg_permit"],
|
||||||
dateIssued: json["date_issued"] == null
|
dateIssued: json["date_issued"],
|
||||||
? null
|
|
||||||
: DateTime.parse(json["date_issued"]),
|
|
||||||
cct: json["cct"],
|
cct: json["cct"],
|
||||||
certCompletionIssued: json["cert_completion_issued"] == null
|
certCompletionIssued: json["cert_completion_issued"],
|
||||||
? null
|
certOccupancyIssued: json["cert_occupancy_issued"],
|
||||||
: DateTime.parse(json["cert_completion_issued"]),
|
dateCompleted: json["date_completed"],
|
||||||
certOccupancyIssued: json["cert_occupancy_issued"] == null
|
dateOccupied: json["date_occupied"],
|
||||||
? 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"],
|
bldgAge: json["bldg_age"],
|
||||||
noStoreys: json["no_storeys"],
|
noStoreys: json["no_storeys"],
|
||||||
area1Stfloor: json["area_1stfloor"],
|
area1Stfloor: json["area_1stfloor"],
|
||||||
|
@ -103,27 +142,49 @@ class GeneralDesc {
|
||||||
actualUse: json["actual_use"],
|
actualUse: json["actual_use"],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
factory GeneralDesc.fromJson2(Map<String, dynamic> json) => GeneralDesc(
|
||||||
|
id: json["id"],
|
||||||
|
bldgapprDetailsId: json["bldgapprDetailsId"],
|
||||||
|
assessedById: json["assessedById"],
|
||||||
|
assessedByName: json["assessedByName"],
|
||||||
|
dateCreated: json["dateCreated"],
|
||||||
|
dateModified: json["dateModified"],
|
||||||
|
bldgKind: json["bldgKind"],
|
||||||
|
strucType: json["strucType"],
|
||||||
|
bldgPermit: json["bldgPermit"],
|
||||||
|
dateIssued: json["dateIssued"],
|
||||||
|
cct: json["cct"],
|
||||||
|
certCompletionIssued: json["certCompletionIssued"],
|
||||||
|
certOccupancyIssued: json["certOccupancyIssued"],
|
||||||
|
dateCompleted: json["dateCompleted"],
|
||||||
|
dateOccupied: json["dateOccupied"],
|
||||||
|
bldgAge: json["bldgAge"],
|
||||||
|
noStoreys: json["noStoreys"],
|
||||||
|
area1Stfloor: json["area1Stfloor"],
|
||||||
|
area2Ndfloor: json["area2Ndfloor"],
|
||||||
|
area3Rdfloor: json["area3Rdfloor"],
|
||||||
|
area4Thfloor: json["area4Thfloor"],
|
||||||
|
totalFloorArea: json["totalFloorArea"],
|
||||||
|
floorSketch: json["floorSketch"],
|
||||||
|
actualUse: json["actualUse"],
|
||||||
|
);
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
"id": id,
|
"id": id,
|
||||||
"bldgappr_details_id": bldgapprDetailsId,
|
"bldgappr_details_id": bldgapprDetailsId,
|
||||||
"assessed_by_id": assessedById,
|
"assessed_by_id": assessedById,
|
||||||
"assessed_by_name": assessedByName,
|
"assessed_by_name": assessedByName,
|
||||||
"date_created": dateCreated?.toIso8601String(),
|
"date_created": dateCreated,
|
||||||
"date_modified": dateModified?.toIso8601String(),
|
"date_modified": dateModified,
|
||||||
"bldg_kind": bldgKind,
|
"bldg_kind": bldgKind,
|
||||||
"struc_type": strucType,
|
"struc_type": strucType,
|
||||||
"bldg_permit": bldgPermit,
|
"bldg_permit": bldgPermit,
|
||||||
"date_issued":
|
"date_issued": dateIssued,
|
||||||
"${dateIssued!.year.toString().padLeft(4, '0')}-${dateIssued!.month.toString().padLeft(2, '0')}-${dateIssued!.day.toString().padLeft(2, '0')}",
|
|
||||||
"cct": cct,
|
"cct": cct,
|
||||||
"cert_completion_issued":
|
"cert_completion_issued": certCompletionIssued,
|
||||||
"${certCompletionIssued!.year.toString().padLeft(4, '0')}-${certCompletionIssued!.month.toString().padLeft(2, '0')}-${certCompletionIssued!.day.toString().padLeft(2, '0')}",
|
"cert_occupancy_issued": certOccupancyIssued,
|
||||||
"cert_occupancy_issued":
|
"date_completed": dateCompleted,
|
||||||
"${certOccupancyIssued!.year.toString().padLeft(4, '0')}-${certOccupancyIssued!.month.toString().padLeft(2, '0')}-${certOccupancyIssued!.day.toString().padLeft(2, '0')}",
|
"date_occupied": dateOccupied,
|
||||||
"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,
|
"bldg_age": bldgAge,
|
||||||
"no_storeys": noStoreys,
|
"no_storeys": noStoreys,
|
||||||
"area_1stfloor": area1Stfloor,
|
"area_1stfloor": area1Stfloor,
|
||||||
|
|
|
@ -39,6 +39,38 @@ class LandRef {
|
||||||
this.blkNo,
|
this.blkNo,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
LandRef copy({
|
||||||
|
int? id,
|
||||||
|
int? bldgapprDetailsId,
|
||||||
|
String? assessedById,
|
||||||
|
String? assessedByName,
|
||||||
|
DateTime? dateCreated,
|
||||||
|
DateTime? dateModified,
|
||||||
|
String? owner,
|
||||||
|
String? cloaNo,
|
||||||
|
String? lotNo,
|
||||||
|
String? tdn,
|
||||||
|
String? area,
|
||||||
|
String? surveyNo,
|
||||||
|
String? blkNo,
|
||||||
|
}) {
|
||||||
|
return LandRef(
|
||||||
|
id: id ?? this.id,
|
||||||
|
bldgapprDetailsId: bldgapprDetailsId ?? this.bldgapprDetailsId,
|
||||||
|
assessedById: assessedById ?? this.assessedById,
|
||||||
|
assessedByName: assessedByName ?? this.assessedByName,
|
||||||
|
dateCreated: dateCreated ?? this.dateCreated,
|
||||||
|
dateModified: dateModified ?? this.dateModified,
|
||||||
|
owner: owner ?? this.owner,
|
||||||
|
cloaNo: cloaNo ?? this.cloaNo,
|
||||||
|
lotNo: lotNo ?? this.lotNo,
|
||||||
|
tdn: tdn ?? this.tdn,
|
||||||
|
area: area ?? this.area,
|
||||||
|
surveyNo: surveyNo ?? this.surveyNo,
|
||||||
|
blkNo: blkNo ?? this.blkNo,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
factory LandRef.fromJson(Map<String, dynamic> json) => LandRef(
|
factory LandRef.fromJson(Map<String, dynamic> json) => LandRef(
|
||||||
id: json["id"],
|
id: json["id"],
|
||||||
bldgapprDetailsId: json["bldgappr_details_id"],
|
bldgapprDetailsId: json["bldgappr_details_id"],
|
||||||
|
@ -59,6 +91,26 @@ class LandRef {
|
||||||
blkNo: json["blk_no"],
|
blkNo: json["blk_no"],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
factory LandRef.fromJson2(Map<String, dynamic> json) => LandRef(
|
||||||
|
id: json["id"],
|
||||||
|
bldgapprDetailsId: json["bldgapprDetailsId"],
|
||||||
|
assessedById: json["assessedById"],
|
||||||
|
assessedByName: json["assessedByName"],
|
||||||
|
dateCreated: json["dateCreated"] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json["dateCreated"]),
|
||||||
|
dateModified: json["dateModified"] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json["dateModified"]),
|
||||||
|
owner: json["owner"],
|
||||||
|
cloaNo: json["cloaNo"],
|
||||||
|
lotNo: json["lotNo"],
|
||||||
|
tdn: json["tdn"],
|
||||||
|
area: json["area"],
|
||||||
|
surveyNo: json["surveyNo"],
|
||||||
|
blkNo: json["blkNo"],
|
||||||
|
);
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
"id": id,
|
"id": id,
|
||||||
"bldgappr_details_id": bldgapprDetailsId,
|
"bldgappr_details_id": bldgapprDetailsId,
|
||||||
|
|
|
@ -19,12 +19,29 @@ class Memoranda {
|
||||||
this.memoranda,
|
this.memoranda,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Memoranda copy({
|
||||||
|
int? id,
|
||||||
|
String? code,
|
||||||
|
String? memoranda,
|
||||||
|
}) {
|
||||||
|
return Memoranda(
|
||||||
|
id: id ?? this.id,
|
||||||
|
code: code ?? this.code,
|
||||||
|
memoranda: memoranda ?? this.memoranda);
|
||||||
|
}
|
||||||
|
|
||||||
factory Memoranda.fromJson(Map<String, dynamic> json) => Memoranda(
|
factory Memoranda.fromJson(Map<String, dynamic> json) => Memoranda(
|
||||||
id: json["id"],
|
id: json["id"],
|
||||||
code: json["code"],
|
code: json["code"],
|
||||||
memoranda: json["memoranda"],
|
memoranda: json["memoranda"],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
factory Memoranda.fromJson2(Map<String, dynamic> json) => Memoranda(
|
||||||
|
id: json["id"],
|
||||||
|
code: json["code"],
|
||||||
|
memoranda: json["memoranda"],
|
||||||
|
);
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
"id": id,
|
"id": id,
|
||||||
"code": code,
|
"code": code,
|
||||||
|
|
|
@ -48,6 +48,45 @@ class PropertyAppraisal {
|
||||||
this.totalArea,
|
this.totalArea,
|
||||||
this.actualUse});
|
this.actualUse});
|
||||||
|
|
||||||
|
PropertyAppraisal copy({
|
||||||
|
int? id,
|
||||||
|
int? bldgapprDetailsId,
|
||||||
|
String? assessedById,
|
||||||
|
String? assessedByName,
|
||||||
|
DateTime? dateCreated,
|
||||||
|
DateTime? dateModified,
|
||||||
|
String? unitconstructCost,
|
||||||
|
String? buildingCore,
|
||||||
|
String? unitconstructSubtotal,
|
||||||
|
String? depreciationRate,
|
||||||
|
String? depreciationCost,
|
||||||
|
String? costAddItems,
|
||||||
|
String? addItemsSubtotal,
|
||||||
|
String? totalpercentDepreciation,
|
||||||
|
String? marketValue,
|
||||||
|
String? totalArea,
|
||||||
|
String? actualUse,
|
||||||
|
}) =>
|
||||||
|
PropertyAppraisal(
|
||||||
|
id: this.id,
|
||||||
|
bldgapprDetailsId: bldgapprDetailsId,
|
||||||
|
assessedById: assessedById,
|
||||||
|
assessedByName: assessedByName,
|
||||||
|
dateCreated: dateCreated,
|
||||||
|
dateModified: dateModified,
|
||||||
|
unitconstructCost: unitconstructCost,
|
||||||
|
buildingCore: buildingCore,
|
||||||
|
unitconstructSubtotal: unitconstructSubtotal,
|
||||||
|
depreciationRate: depreciationRate,
|
||||||
|
depreciationCost: depreciationCost,
|
||||||
|
costAddItems: costAddItems,
|
||||||
|
addItemsSubtotal: addItemsSubtotal,
|
||||||
|
totalpercentDepreciation: totalpercentDepreciation,
|
||||||
|
marketValue: marketValue,
|
||||||
|
totalArea: totalArea,
|
||||||
|
actualUse: actualUse,
|
||||||
|
);
|
||||||
|
|
||||||
factory PropertyAppraisal.fromJson(Map<String, dynamic> json) =>
|
factory PropertyAppraisal.fromJson(Map<String, dynamic> json) =>
|
||||||
PropertyAppraisal(
|
PropertyAppraisal(
|
||||||
id: json["id"],
|
id: json["id"],
|
||||||
|
|
|
@ -56,6 +56,51 @@ class PropertyAssessment {
|
||||||
required this.entryDateBy,
|
required this.entryDateBy,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
PropertyAssessment copy({
|
||||||
|
int? id,
|
||||||
|
int? bldgapprDetailsId,
|
||||||
|
String? actualUse,
|
||||||
|
String? marketValue,
|
||||||
|
String? assessmentLevel,
|
||||||
|
String? assessedValue,
|
||||||
|
bool? taxable,
|
||||||
|
bool? exempt,
|
||||||
|
int? qtr,
|
||||||
|
int? yr,
|
||||||
|
String? appraisedbyName,
|
||||||
|
DateTime? appraisedbyDate,
|
||||||
|
String? recommendapprName,
|
||||||
|
DateTime? recommendapprDate,
|
||||||
|
String? approvedbyName,
|
||||||
|
String? memoranda,
|
||||||
|
String? swornstatementNo,
|
||||||
|
DateTime? dateReceived,
|
||||||
|
DateTime? entryDateAssessment,
|
||||||
|
String? entryDateBy,
|
||||||
|
}) =>
|
||||||
|
PropertyAssessment(
|
||||||
|
id: id ?? this.id,
|
||||||
|
bldgapprDetailsId: bldgapprDetailsId ?? this.bldgapprDetailsId,
|
||||||
|
actualUse: actualUse ?? this.actualUse,
|
||||||
|
marketValue: marketValue ?? this.marketValue,
|
||||||
|
assessmentLevel: assessmentLevel ?? this.assessmentLevel,
|
||||||
|
assessedValue: assessedValue ?? this.assessedValue,
|
||||||
|
taxable: taxable ?? this.taxable,
|
||||||
|
exempt: exempt ?? this.exempt,
|
||||||
|
qtr: qtr ?? this.qtr,
|
||||||
|
yr: yr ?? this.yr,
|
||||||
|
appraisedbyName: appraisedbyName ?? this.appraisedbyName,
|
||||||
|
appraisedbyDate: appraisedbyDate ?? this.appraisedbyDate,
|
||||||
|
recommendapprName: recommendapprName ?? this.recommendapprName,
|
||||||
|
recommendapprDate: recommendapprDate ?? this.recommendapprDate,
|
||||||
|
approvedbyName: approvedbyName ?? this.approvedbyName,
|
||||||
|
memoranda: memoranda ?? this.memoranda,
|
||||||
|
swornstatementNo: swornstatementNo ?? this.swornstatementNo,
|
||||||
|
dateReceived: dateReceived ?? this.dateReceived,
|
||||||
|
entryDateAssessment: entryDateAssessment ?? this.entryDateAssessment,
|
||||||
|
entryDateBy: entryDateBy ?? this.entryDateBy,
|
||||||
|
);
|
||||||
|
|
||||||
factory PropertyAssessment.fromJson(Map<String, dynamic> json) =>
|
factory PropertyAssessment.fromJson(Map<String, dynamic> json) =>
|
||||||
PropertyAssessment(
|
PropertyAssessment(
|
||||||
id: json["id"],
|
id: json["id"],
|
||||||
|
|
|
@ -48,16 +48,55 @@ class PropertyInfo {
|
||||||
this.faasType,
|
this.faasType,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
PropertyInfo copy({
|
||||||
|
int? id,
|
||||||
|
String? assessedById,
|
||||||
|
String? assessedByName,
|
||||||
|
DateTime? dateCreated,
|
||||||
|
DateTime? dateModified,
|
||||||
|
String? transCode,
|
||||||
|
String? tdn,
|
||||||
|
String? pin,
|
||||||
|
String? owner,
|
||||||
|
String? address,
|
||||||
|
String? telno,
|
||||||
|
String? tin,
|
||||||
|
String? adminUser,
|
||||||
|
String? adminAddress,
|
||||||
|
String? adminTelno,
|
||||||
|
String? adminTin,
|
||||||
|
String? faasType,
|
||||||
|
}) =>
|
||||||
|
PropertyInfo(
|
||||||
|
id: id ?? this.id,
|
||||||
|
assessedById: assessedById ?? this.assessedById,
|
||||||
|
assessedByName: assessedByName ?? this.assessedByName,
|
||||||
|
dateCreated: dateCreated ?? this.dateCreated,
|
||||||
|
dateModified: dateModified ?? this.dateModified,
|
||||||
|
transCode: transCode ?? this.transCode,
|
||||||
|
tdn: tdn ?? this.tdn,
|
||||||
|
pin: pin ?? this.pin,
|
||||||
|
owner: owner ?? this.owner,
|
||||||
|
address: address ?? this.address,
|
||||||
|
telno: telno ?? this.telno,
|
||||||
|
tin: tin ?? this.tin,
|
||||||
|
adminUser: adminUser ?? this.adminUser,
|
||||||
|
adminAddress: adminAddress ?? this.adminAddress,
|
||||||
|
adminTelno: adminTelno ?? this.adminTelno,
|
||||||
|
adminTin: adminTin ?? this.adminTin,
|
||||||
|
faasType: faasType ?? this.faasType,
|
||||||
|
);
|
||||||
|
|
||||||
factory PropertyInfo.fromJson(Map<String, dynamic> json) => PropertyInfo(
|
factory PropertyInfo.fromJson(Map<String, dynamic> json) => PropertyInfo(
|
||||||
id: json["id"],
|
id: json["id"],
|
||||||
assessedById: json["assessed_by_id"],
|
assessedById: json["assessed_by_id"],
|
||||||
assessedByName: json["assessed_by_name"],
|
assessedByName: json["assessed_by_name"],
|
||||||
dateCreated: json["date_created"] == null
|
// dateCreated: json["date_created"] == null
|
||||||
? null
|
// ? null
|
||||||
: DateTime.parse(json["date_created"]),
|
// : DateTime.parse(json["date_created"]),
|
||||||
dateModified: json["date_modified"] == null
|
// dateModified: json["date_modified"] == null
|
||||||
? null
|
// ? null
|
||||||
: DateTime.parse(json["date_modified"]),
|
// : DateTime.parse(json["date_modified"]),
|
||||||
transCode: json["trans_code"],
|
transCode: json["trans_code"],
|
||||||
tdn: json["tdn"],
|
tdn: json["tdn"],
|
||||||
pin: json["pin"],
|
pin: json["pin"],
|
||||||
|
@ -72,6 +111,26 @@ class PropertyInfo {
|
||||||
faasType: json["faas_type"],
|
faasType: json["faas_type"],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
factory PropertyInfo.fromMap(Map<String, dynamic> map) => PropertyInfo(
|
||||||
|
id: map["id"],
|
||||||
|
assessedById: map["assessedById"],
|
||||||
|
assessedByName: map["assessedByName"],
|
||||||
|
dateCreated: map["dateCreated"],
|
||||||
|
dateModified: map["dateModified"],
|
||||||
|
transCode: map["transCode"],
|
||||||
|
tdn: map["tdn"],
|
||||||
|
pin: map["pin"],
|
||||||
|
owner: map["owner"],
|
||||||
|
address: map["address"],
|
||||||
|
telno: map["telno"],
|
||||||
|
tin: map["tin"],
|
||||||
|
adminUser: map["adminUser"],
|
||||||
|
adminAddress: map["adminUser"],
|
||||||
|
adminTelno: map["adminTelno"],
|
||||||
|
adminTin: map["adminTin"],
|
||||||
|
faasType: map["faasType"],
|
||||||
|
);
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
"id": id,
|
"id": id,
|
||||||
"assessed_by_id": assessedById,
|
"assessed_by_id": assessedById,
|
||||||
|
|
|
@ -24,6 +24,20 @@ class Signatories {
|
||||||
required this.lastname,
|
required this.lastname,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Signatories copy(
|
||||||
|
{int? id,
|
||||||
|
int? signatoryId,
|
||||||
|
String? firstname,
|
||||||
|
String? middlename,
|
||||||
|
String? lastname}) {
|
||||||
|
return Signatories(
|
||||||
|
id: id ?? this.id,
|
||||||
|
signatoryId: signatoryId ?? this.signatoryId,
|
||||||
|
firstname: firstname ?? this.firstname,
|
||||||
|
middlename: middlename ?? this.middlename,
|
||||||
|
lastname: lastname ?? this.lastname);
|
||||||
|
}
|
||||||
|
|
||||||
factory Signatories.fromJson(Map<String, dynamic> json) => Signatories(
|
factory Signatories.fromJson(Map<String, dynamic> json) => Signatories(
|
||||||
id: json["id"],
|
id: json["id"],
|
||||||
signatoryId: json["signatory_id"],
|
signatoryId: json["signatory_id"],
|
||||||
|
@ -32,6 +46,14 @@ class Signatories {
|
||||||
lastname: json["lastname"],
|
lastname: json["lastname"],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
factory Signatories.fromJson2(Map<String, dynamic> json) => Signatories(
|
||||||
|
id: json["id"],
|
||||||
|
signatoryId: json["signatoryId"],
|
||||||
|
firstname: json["firstname"],
|
||||||
|
middlename: json["middlename"],
|
||||||
|
lastname: json["lastname"],
|
||||||
|
);
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
"id": id,
|
"id": id,
|
||||||
"signatory_id": signatoryId,
|
"signatory_id": signatoryId,
|
||||||
|
|
|
@ -13,6 +13,7 @@ String structureMaterialsIiToJson(StructureMaterialsII data) =>
|
||||||
|
|
||||||
class StructureMaterialsII {
|
class StructureMaterialsII {
|
||||||
final int? id;
|
final int? id;
|
||||||
|
final int? bldgapprDetailsId;
|
||||||
final List<String>? foundation;
|
final List<String>? foundation;
|
||||||
final List<String>? columns;
|
final List<String>? columns;
|
||||||
final List<String>? beams;
|
final List<String>? beams;
|
||||||
|
@ -24,6 +25,7 @@ class StructureMaterialsII {
|
||||||
|
|
||||||
StructureMaterialsII(
|
StructureMaterialsII(
|
||||||
{this.id,
|
{this.id,
|
||||||
|
this.bldgapprDetailsId,
|
||||||
this.foundation,
|
this.foundation,
|
||||||
this.columns,
|
this.columns,
|
||||||
this.beams,
|
this.beams,
|
||||||
|
@ -36,6 +38,7 @@ class StructureMaterialsII {
|
||||||
factory StructureMaterialsII.fromJson(Map<String, dynamic> json) =>
|
factory StructureMaterialsII.fromJson(Map<String, dynamic> json) =>
|
||||||
StructureMaterialsII(
|
StructureMaterialsII(
|
||||||
id: json["id"],
|
id: json["id"],
|
||||||
|
bldgapprDetailsId: json["bldgapprDetailsId"],
|
||||||
foundation: List<String>.from(json["foundation"].map((x) => x)),
|
foundation: List<String>.from(json["foundation"].map((x) => x)),
|
||||||
columns: List<String>.from(json["columns"].map((x) => x)),
|
columns: List<String>.from(json["columns"].map((x) => x)),
|
||||||
beams: List<String>.from(json["beams"].map((x) => x)),
|
beams: List<String>.from(json["beams"].map((x) => x)),
|
||||||
|
@ -46,8 +49,46 @@ class StructureMaterialsII {
|
||||||
others: List<String>.from(json["others"].map((x) => x)),
|
others: List<String>.from(json["others"].map((x) => x)),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
factory StructureMaterialsII.fromJson2(Map<String, dynamic> json) =>
|
||||||
|
StructureMaterialsII(
|
||||||
|
id: json["id"],
|
||||||
|
bldgapprDetailsId: json["bldgapprDetailsId"],
|
||||||
|
foundation: List<String>.from(json["foundation"].map((x) => x)),
|
||||||
|
columns: List<String>.from(json["columns"].map((x) => x)),
|
||||||
|
beams: List<String>.from(json["beams"].map((x) => x)),
|
||||||
|
trussFraming: List<String>.from(json["trussFraming"].map((x) => x)),
|
||||||
|
roof: List<String>.from(json["roof"].map((x) => x)),
|
||||||
|
flooring: List<String>.from(json["flooring"].map((x) => x)),
|
||||||
|
walls: List<String>.from(json["walls"].map((x) => x)),
|
||||||
|
others: List<String>.from(json["others"].map((x) => x)),
|
||||||
|
);
|
||||||
|
|
||||||
|
StructureMaterialsII copy(
|
||||||
|
{int? id,
|
||||||
|
int? bldgapprDetailsId,
|
||||||
|
List<String>? foundation,
|
||||||
|
List<String>? columns,
|
||||||
|
List<String>? beams,
|
||||||
|
List<String>? trussFraming,
|
||||||
|
List<String>? roof,
|
||||||
|
List<String>? flooring,
|
||||||
|
List<String>? walls,
|
||||||
|
List<String>? others}) =>
|
||||||
|
StructureMaterialsII(
|
||||||
|
id: id ?? this.id,
|
||||||
|
bldgapprDetailsId: bldgapprDetailsId ?? this.bldgapprDetailsId,
|
||||||
|
foundation: foundation ?? this.foundation,
|
||||||
|
columns: columns ?? this.columns,
|
||||||
|
beams: beams ?? this.beams,
|
||||||
|
trussFraming: trussFraming ?? this.trussFraming,
|
||||||
|
roof: roof ?? this.roof,
|
||||||
|
flooring: flooring ?? this.flooring,
|
||||||
|
walls: walls ?? this.walls,
|
||||||
|
others: others ?? this.others);
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
"id": id,
|
"id": id,
|
||||||
|
"bldgapprDetailsId": bldgapprDetailsId,
|
||||||
"foundation": List<dynamic>.from(foundation!.map((x) => x)),
|
"foundation": List<dynamic>.from(foundation!.map((x) => x)),
|
||||||
"columns": List<dynamic>.from(columns!.map((x) => x)),
|
"columns": List<dynamic>.from(columns!.map((x) => x)),
|
||||||
"beams": List<dynamic>.from(beams!.map((x) => x)),
|
"beams": List<dynamic>.from(beams!.map((x) => x)),
|
||||||
|
|
|
@ -13,6 +13,7 @@ String structureMaterialsToJson(StructureMaterials data) =>
|
||||||
|
|
||||||
class StructureMaterials {
|
class StructureMaterials {
|
||||||
final int? id;
|
final int? id;
|
||||||
|
final int? bldgapprDetailsId;
|
||||||
final String? foundation;
|
final String? foundation;
|
||||||
final String? columns;
|
final String? columns;
|
||||||
final String? beams;
|
final String? beams;
|
||||||
|
@ -20,32 +21,59 @@ class StructureMaterials {
|
||||||
final String? roof;
|
final String? roof;
|
||||||
final String? flooring;
|
final String? flooring;
|
||||||
final String? walls;
|
final String? walls;
|
||||||
|
final String? others;
|
||||||
|
|
||||||
StructureMaterials({
|
StructureMaterials(
|
||||||
this.id,
|
{this.id,
|
||||||
this.foundation,
|
this.bldgapprDetailsId,
|
||||||
this.columns,
|
this.foundation,
|
||||||
this.beams,
|
this.columns,
|
||||||
this.trussFraming,
|
this.beams,
|
||||||
this.roof,
|
this.trussFraming,
|
||||||
this.flooring,
|
this.roof,
|
||||||
this.walls,
|
this.flooring,
|
||||||
});
|
this.walls,
|
||||||
|
this.others});
|
||||||
|
|
||||||
|
StructureMaterials copy(
|
||||||
|
{int? id,
|
||||||
|
int? bldgapprDetailsId,
|
||||||
|
String? foundation,
|
||||||
|
String? columns,
|
||||||
|
String? beams,
|
||||||
|
String? trussFraming,
|
||||||
|
String? roof,
|
||||||
|
String? flooring,
|
||||||
|
String? walls,
|
||||||
|
String? others}) =>
|
||||||
|
StructureMaterials(
|
||||||
|
id: id ?? this.id,
|
||||||
|
bldgapprDetailsId: bldgapprDetailsId ?? this.bldgapprDetailsId,
|
||||||
|
foundation: foundation ?? this.foundation,
|
||||||
|
columns: columns ?? this.columns,
|
||||||
|
beams: beams ?? this.beams,
|
||||||
|
trussFraming: trussFraming ?? this.trussFraming,
|
||||||
|
roof: roof ?? this.roof,
|
||||||
|
flooring: flooring ?? this.flooring,
|
||||||
|
walls: walls ?? this.walls,
|
||||||
|
others: others ?? this.others);
|
||||||
|
|
||||||
factory StructureMaterials.fromJson(Map<String, dynamic> json) =>
|
factory StructureMaterials.fromJson(Map<String, dynamic> json) =>
|
||||||
StructureMaterials(
|
StructureMaterials(
|
||||||
id: json["id"],
|
id: json["id"],
|
||||||
foundation: json["foundation"],
|
bldgapprDetailsId: json["bldgappr_details_id"],
|
||||||
columns: json["columns"],
|
foundation: json["foundation"],
|
||||||
beams: json["beams"],
|
columns: json["columns"],
|
||||||
trussFraming: json["truss_framing"],
|
beams: json["beams"],
|
||||||
roof: json["roof"],
|
trussFraming: json["truss_framing"],
|
||||||
flooring: json["flooring"],
|
roof: json["roof"],
|
||||||
walls: json["walls"],
|
flooring: json["flooring"],
|
||||||
);
|
walls: json["walls"],
|
||||||
|
others: json["others"]);
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
"id": id,
|
"id": id,
|
||||||
|
"bldgappr_details_id": bldgapprDetailsId,
|
||||||
"foundation": foundation,
|
"foundation": foundation,
|
||||||
"columns": columns,
|
"columns": columns,
|
||||||
"beams": beams,
|
"beams": beams,
|
||||||
|
@ -53,5 +81,6 @@ class StructureMaterials {
|
||||||
"roof": roof,
|
"roof": roof,
|
||||||
"flooring": flooring,
|
"flooring": flooring,
|
||||||
"walls": walls,
|
"walls": walls,
|
||||||
|
"others": others
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
const String todoTable = 'todos';
|
||||||
|
|
||||||
|
class TodoFields {
|
||||||
|
static final List<String> values = [
|
||||||
|
/// Add all fields
|
||||||
|
id, isImportant, number, title, description, time
|
||||||
|
];
|
||||||
|
|
||||||
|
static const String id = '_id';
|
||||||
|
static const String isImportant = 'isImportant';
|
||||||
|
static const String number = 'number';
|
||||||
|
static const String title = 'title';
|
||||||
|
static const String description = 'description';
|
||||||
|
static const String time = 'time';
|
||||||
|
}
|
||||||
|
|
||||||
|
class Todo {
|
||||||
|
final int? id;
|
||||||
|
final bool isImportant;
|
||||||
|
final int number;
|
||||||
|
final String title;
|
||||||
|
final String description;
|
||||||
|
final DateTime createdTime;
|
||||||
|
|
||||||
|
const Todo({
|
||||||
|
this.id,
|
||||||
|
required this.isImportant,
|
||||||
|
required this.number,
|
||||||
|
required this.title,
|
||||||
|
required this.description,
|
||||||
|
required this.createdTime,
|
||||||
|
});
|
||||||
|
|
||||||
|
Todo copy({
|
||||||
|
int? id,
|
||||||
|
bool? isImportant,
|
||||||
|
int? number,
|
||||||
|
String? title,
|
||||||
|
String? description,
|
||||||
|
DateTime? createdTime,
|
||||||
|
}) =>
|
||||||
|
Todo(
|
||||||
|
id: id ?? this.id,
|
||||||
|
isImportant: isImportant ?? this.isImportant,
|
||||||
|
number: number ?? this.number,
|
||||||
|
title: title ?? this.title,
|
||||||
|
description: description ?? this.description,
|
||||||
|
createdTime: createdTime ?? this.createdTime,
|
||||||
|
);
|
||||||
|
|
||||||
|
static Todo fromJson(Map<String, Object?> json) => Todo(
|
||||||
|
id: json[TodoFields.id] as int?,
|
||||||
|
isImportant: json[TodoFields.isImportant] == 1,
|
||||||
|
number: json[TodoFields.number] as int,
|
||||||
|
title: json[TodoFields.title] as String,
|
||||||
|
description: json[TodoFields.description] as String,
|
||||||
|
createdTime: DateTime.parse(json[TodoFields.time] as String),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, Object?> toJson() => {
|
||||||
|
TodoFields.id: id,
|
||||||
|
TodoFields.title: title,
|
||||||
|
TodoFields.isImportant: isImportant ? 1 : 0,
|
||||||
|
TodoFields.number: number,
|
||||||
|
TodoFields.description: description,
|
||||||
|
TodoFields.time: createdTime.toIso8601String(),
|
||||||
|
};
|
||||||
|
}
|
|
@ -22,6 +22,26 @@ class UnitConstruct {
|
||||||
required this.unitValue,
|
required this.unitValue,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
UnitConstruct copy({
|
||||||
|
int? id,
|
||||||
|
String? bldgType,
|
||||||
|
String? building,
|
||||||
|
String? unitValue,
|
||||||
|
}) {
|
||||||
|
return UnitConstruct(
|
||||||
|
id: id ?? this.id,
|
||||||
|
bldgType: bldgType ?? this.bldgType,
|
||||||
|
building: building ?? this.building,
|
||||||
|
unitValue: unitValue ?? this.unitValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
factory UnitConstruct.fromJson2(Map<String, dynamic> json) => UnitConstruct(
|
||||||
|
id: json["id"],
|
||||||
|
bldgType: json["bldgType"],
|
||||||
|
building: json["building"],
|
||||||
|
unitValue: json["unitValue"],
|
||||||
|
);
|
||||||
|
|
||||||
factory UnitConstruct.fromJson(Map<String, dynamic> json) => UnitConstruct(
|
factory UnitConstruct.fromJson(Map<String, dynamic> json) => UnitConstruct(
|
||||||
id: json["id"],
|
id: json["id"],
|
||||||
bldgType: json["bldg_type"],
|
bldgType: json["bldg_type"],
|
||||||
|
|
|
@ -6,10 +6,13 @@ import 'package:flutter_zoom_drawer/flutter_zoom_drawer.dart';
|
||||||
import 'package:fluttericon/font_awesome5_icons.dart';
|
import 'package:fluttericon/font_awesome5_icons.dart';
|
||||||
import 'package:unit2/bloc/offline/offline_bloc/offline_bloc.dart';
|
import 'package:unit2/bloc/offline/offline_bloc/offline_bloc.dart';
|
||||||
import 'package:unit2/model/offline/offlane_modules.dart';
|
import 'package:unit2/model/offline/offlane_modules.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/passo_offline_dashboard.dart';
|
||||||
import 'package:unit2/screens/passo/passo_dashboard.dart';
|
import 'package:unit2/screens/passo/passo_dashboard.dart';
|
||||||
import 'package:unit2/screens/unit2/homepage.dart/components/dashboard/shared_card_label.dart';
|
import 'package:unit2/screens/unit2/homepage.dart/components/dashboard/shared_card_label.dart';
|
||||||
import 'package:unit2/theme-data.dart/colors.dart';
|
import 'package:unit2/theme-data.dart/colors.dart';
|
||||||
|
|
||||||
|
import '../passo/passo_main_dashboard.dart';
|
||||||
|
|
||||||
class OfflineModuleScreen extends StatelessWidget {
|
class OfflineModuleScreen extends StatelessWidget {
|
||||||
const OfflineModuleScreen({super.key});
|
const OfflineModuleScreen({super.key});
|
||||||
|
|
||||||
|
@ -56,7 +59,7 @@ class OfflineModuleScreen extends StatelessWidget {
|
||||||
ontap: () {
|
ontap: () {
|
||||||
Navigator.push(context,
|
Navigator.push(context,
|
||||||
MaterialPageRoute(builder: ((context) {
|
MaterialPageRoute(builder: ((context) {
|
||||||
return PassoDashBoard();
|
return const PassoOfflineMainScreen();
|
||||||
})));
|
})));
|
||||||
}))
|
}))
|
||||||
.toList()),
|
.toList()),
|
||||||
|
|
|
@ -0,0 +1,129 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:fluttericon/elusive_icons.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/barangay_admin/barangay_admin_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/class_components_admin.dart/class_components_admin_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/memoranda/memoranda_admin_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/municipalities_admin/municipalities_admin_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/signatories/signatories_admin_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/unit_construction/unit_construction_admin_bloc.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/admin/barangay.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/admin/class_components.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/admin/memoranda.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/admin/municipalities.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/admin/signatories.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/admin/unit_construction.dart';
|
||||||
|
import 'package:unit2/screens/profile/components/main_menu.dart';
|
||||||
|
import 'package:unit2/theme-data.dart/colors.dart';
|
||||||
|
|
||||||
|
class AdminMainScreen extends StatefulWidget {
|
||||||
|
const AdminMainScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_AdminMainScreen createState() => _AdminMainScreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AdminMainScreen extends State<AdminMainScreen> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
backgroundColor: primary,
|
||||||
|
title: const Text("PASSO Admin"),
|
||||||
|
centerTitle: true,
|
||||||
|
),
|
||||||
|
body: ListView(
|
||||||
|
children: [
|
||||||
|
MainMenu(
|
||||||
|
icon: Elusive.group,
|
||||||
|
title: "Municipalities",
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(context,
|
||||||
|
MaterialPageRoute(builder: (BuildContext context) {
|
||||||
|
return BlocProvider(
|
||||||
|
create: (context) =>
|
||||||
|
MunicipalitiesAdminBloc()..add(LoadMunicipalities()),
|
||||||
|
child: const MunicipalitiesAdminPage(),
|
||||||
|
);
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const Divider(),
|
||||||
|
MainMenu(
|
||||||
|
icon: Elusive.group,
|
||||||
|
title: "Barangays",
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(context,
|
||||||
|
MaterialPageRoute(builder: (BuildContext context) {
|
||||||
|
return BlocProvider(
|
||||||
|
create: (context) => BarangayAdminBloc()..add(LoadBarangay()),
|
||||||
|
child: const BarangayAdminPage(),
|
||||||
|
);
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const Divider(),
|
||||||
|
MainMenu(
|
||||||
|
icon: Elusive.group,
|
||||||
|
title: "Class Components",
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(context,
|
||||||
|
MaterialPageRoute(builder: (BuildContext context) {
|
||||||
|
return BlocProvider(
|
||||||
|
create: (context) =>
|
||||||
|
ClassComponentsAdminBloc()..add(LoadClassComponents()),
|
||||||
|
child: const ClassComponentsAdminPage(),
|
||||||
|
);
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const Divider(),
|
||||||
|
MainMenu(
|
||||||
|
icon: Elusive.group,
|
||||||
|
title: "Structural Types",
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(context,
|
||||||
|
MaterialPageRoute(builder: (BuildContext context) {
|
||||||
|
return BlocProvider(
|
||||||
|
create: (context) =>
|
||||||
|
UnitConstructionAdminBloc()..add(LoadUnitConstruct()),
|
||||||
|
child: const UnitConstructionAdminPage(),
|
||||||
|
);
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const Divider(),
|
||||||
|
MainMenu(
|
||||||
|
icon: Elusive.group,
|
||||||
|
title: "Signatories",
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(context,
|
||||||
|
MaterialPageRoute(builder: (BuildContext context) {
|
||||||
|
return BlocProvider(
|
||||||
|
create: (context) =>
|
||||||
|
SignatoriesAdminBloc()..add(LoadSignatories()),
|
||||||
|
child: const SignatoriesAdminPage(),
|
||||||
|
);
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const Divider(),
|
||||||
|
MainMenu(
|
||||||
|
icon: Elusive.group,
|
||||||
|
title: "Memoranda",
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(context,
|
||||||
|
MaterialPageRoute(builder: (BuildContext context) {
|
||||||
|
return BlocProvider(
|
||||||
|
create: (context) =>
|
||||||
|
MemorandaAdminBloc()..add(LoadMemoranda()),
|
||||||
|
child: const MemorandaAdminPage(),
|
||||||
|
);
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,110 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/barangay_admin/barangay_admin_bloc.dart';
|
||||||
|
import 'package:unit2/model/passo/barangay.dart';
|
||||||
|
import 'package:unit2/sevices/offline/offline_passo/admin/api_services/barangay_api_services.dart';
|
||||||
|
|
||||||
|
import '../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
import '../../../../theme-data.dart/colors.dart';
|
||||||
|
|
||||||
|
class BarangayAdminPage extends StatefulWidget {
|
||||||
|
const BarangayAdminPage();
|
||||||
|
|
||||||
|
@override
|
||||||
|
_BarangayAdminPage createState() => _BarangayAdminPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _BarangayAdminPage extends State<BarangayAdminPage> {
|
||||||
|
final items = [];
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
backgroundColor: primary,
|
||||||
|
title: const Text("Municipaities"),
|
||||||
|
centerTitle: true,
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
style: TextButton.styleFrom(
|
||||||
|
textStyle: const TextStyle(fontSize: 15),
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
try {
|
||||||
|
final result = await BrgyAdminApiServices.instance.fetch();
|
||||||
|
|
||||||
|
// Assuming result is a List of JSON objects, convert them to City objects.
|
||||||
|
final brgys =
|
||||||
|
result.map((json) => Brgy.fromJson(json)).toList();
|
||||||
|
|
||||||
|
// Loop through the list of City objects and insert them into the local database.
|
||||||
|
for (Brgy brgy in brgys) {
|
||||||
|
await SQLServices.instance.createBarangay(brgy);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// Handle any errors that might occur during the API call or database insertion.
|
||||||
|
print("Error: $e");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: const Text('SYNC'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
body: BlocConsumer<BarangayAdminBloc, BarangayAdminState>(
|
||||||
|
listener: (context, state) {
|
||||||
|
// TODO: implement listener
|
||||||
|
},
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state is BarangayLoaded) {
|
||||||
|
return Column(children: [
|
||||||
|
Expanded(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(15.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
child: DataTable(
|
||||||
|
// ignore: prefer_const_literals_to_create_immutables
|
||||||
|
columns: [
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('ID'),
|
||||||
|
),
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('Code'),
|
||||||
|
),
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('City Code'),
|
||||||
|
),
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('Description'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
rows: state.brgy.map((dataRow) {
|
||||||
|
return DataRow(
|
||||||
|
cells: [
|
||||||
|
DataCell(Text(dataRow.barangayId.toString() ??
|
||||||
|
'N/A')), // Use a default value if cityCode is null
|
||||||
|
DataCell(Text(dataRow.barangayCode ??
|
||||||
|
'N/A')), // Use a default value if cityDescription is null
|
||||||
|
DataCell(Text(dataRow.cityCode ?? 'N/A')),
|
||||||
|
DataCell(Text(
|
||||||
|
dataRow.barangayDescription ?? 'N/A')),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,126 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/class_components_admin.dart/class_components_admin_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/municipalities_admin/municipalities_admin_bloc.dart';
|
||||||
|
import 'package:unit2/model/passo/class_components%20_offline.dart';
|
||||||
|
import 'package:unit2/model/passo/class_components.dart';
|
||||||
|
import 'package:unit2/sevices/offline/offline_passo/admin/api_services/class_components_api_services.dart';
|
||||||
|
import 'package:unit2/sevices/offline/offline_passo/admin/api_services/municipalities_api_services.dart';
|
||||||
|
import 'package:unit2/theme-data.dart/colors.dart';
|
||||||
|
|
||||||
|
import '../../../../model/passo/city.dart';
|
||||||
|
import '../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
|
||||||
|
class ClassComponentsAdminPage extends StatefulWidget {
|
||||||
|
const ClassComponentsAdminPage();
|
||||||
|
|
||||||
|
@override
|
||||||
|
_ClassComponentsAdminPage createState() => _ClassComponentsAdminPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ClassComponentsAdminPage extends State<ClassComponentsAdminPage> {
|
||||||
|
final items = [];
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
backgroundColor: primary,
|
||||||
|
title: const Text("Class Components"),
|
||||||
|
centerTitle: true,
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
style: TextButton.styleFrom(
|
||||||
|
textStyle: const TextStyle(fontSize: 15),
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
try {
|
||||||
|
final result =
|
||||||
|
await ClassComponentAdminApiServices.instance.fetch();
|
||||||
|
|
||||||
|
// Assuming result is a List of JSON objects, convert them to City objects.
|
||||||
|
final classes = result
|
||||||
|
.map((json) => ClassComponents.fromJson(json))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
// Loop through the list of City objects and insert them into the local database.
|
||||||
|
for (ClassComponents classs in classes) {
|
||||||
|
await SQLServices.instance.createClassComponents(
|
||||||
|
ClassComponentsOffline(
|
||||||
|
componentName: classs.componentName,
|
||||||
|
minBaseUnitvalPercent: classs.minBaseUnitvalPercent,
|
||||||
|
maxBaseUnitvalPercent: classs.maxBaseUnitvalPercent,
|
||||||
|
minUnitvalSqrmtr: classs.minUnitvalSqrmtr,
|
||||||
|
maxUnitvalSqrmtr: classs.maxUnitvalSqrmtr,
|
||||||
|
minAddBaseunitval: classs.minAddBaseunitval,
|
||||||
|
maxAddBaseunitval: classs.maxAddBaseunitval,
|
||||||
|
minDeductBaserate: classs.minAddBaseunitval,
|
||||||
|
maxDeductBaserate: classs.maxDeductBaserate,
|
||||||
|
minLinearMeter: classs.minLinearMeter,
|
||||||
|
maxLinearMeter: classs.maxLinearMeter,
|
||||||
|
minSpacing: classs.minSpacing,
|
||||||
|
maxSpacing: classs.maxSpacing,
|
||||||
|
roughFinish: classs.roughFinish,
|
||||||
|
highFinish: classs.highFinish,
|
||||||
|
withoutBucc: classs.withoutBucc == true ? 1 : 0));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// Handle any errors that might occur during the API call or database insertion.
|
||||||
|
print("Error: $e");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: const Text('SYNC'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
body: BlocConsumer<ClassComponentsAdminBloc, ClassComponentsAdminState>(
|
||||||
|
listener: (context, state) {
|
||||||
|
// TODO: implement listener
|
||||||
|
},
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state is ClassComponentsAdminLoaded) {
|
||||||
|
return Column(children: [
|
||||||
|
Expanded(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(15.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
child: DataTable(
|
||||||
|
// ignore: prefer_const_literals_to_create_immutables
|
||||||
|
columns: [
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('Components Name'),
|
||||||
|
),
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('with BUCC?'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
rows: state.classes.map((dataRow) {
|
||||||
|
return DataRow(
|
||||||
|
cells: [
|
||||||
|
DataCell(Text(dataRow.componentName ??
|
||||||
|
'N/A')), // Use a default value if cityCode is null
|
||||||
|
DataCell(Text(dataRow.withoutBucc
|
||||||
|
.toString() ??
|
||||||
|
'N/A')), // Use a default value if cityDescription is null
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,108 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/barangay_admin/barangay_admin_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/memoranda/memoranda_admin_bloc.dart';
|
||||||
|
import 'package:unit2/model/passo/barangay.dart';
|
||||||
|
import 'package:unit2/model/passo/memoranda.dart';
|
||||||
|
import 'package:unit2/sevices/offline/offline_passo/admin/api_services/barangay_api_services.dart';
|
||||||
|
import 'package:unit2/sevices/offline/offline_passo/admin/api_services/memoranda_api_services.dart';
|
||||||
|
|
||||||
|
import '../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
import '../../../../theme-data.dart/colors.dart';
|
||||||
|
|
||||||
|
class MemorandaAdminPage extends StatefulWidget {
|
||||||
|
const MemorandaAdminPage();
|
||||||
|
|
||||||
|
@override
|
||||||
|
_MemorandaAdminPage createState() => _MemorandaAdminPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MemorandaAdminPage extends State<MemorandaAdminPage> {
|
||||||
|
final items = [];
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
backgroundColor: primary,
|
||||||
|
title: const Text("Memoranda"),
|
||||||
|
centerTitle: true,
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
style: TextButton.styleFrom(
|
||||||
|
textStyle: const TextStyle(fontSize: 15),
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
try {
|
||||||
|
final result = await MemorandaAdminApiServices.instance.fetch();
|
||||||
|
|
||||||
|
// Assuming result is a List of JSON objects, convert them to City objects.
|
||||||
|
final memos =
|
||||||
|
result.map((json) => Memoranda.fromJson(json)).toList();
|
||||||
|
|
||||||
|
// Loop through the list of City objects and insert them into the local database.
|
||||||
|
for (Memoranda memo in memos) {
|
||||||
|
await SQLServices.instance.createMemoranda(memo);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// Handle any errors that might occur during the API call or database insertion.
|
||||||
|
print("Error: $e");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: const Text('SYNC'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
body: BlocConsumer<MemorandaAdminBloc, MemorandaAdminState>(
|
||||||
|
listener: (context, state) {
|
||||||
|
// TODO: implement listener
|
||||||
|
},
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state is MemorandaLoaded) {
|
||||||
|
return Column(children: [
|
||||||
|
Expanded(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(15.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
child: DataTable(
|
||||||
|
// ignore: prefer_const_literals_to_create_immutables
|
||||||
|
columns: [
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('ID'),
|
||||||
|
),
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('Code'),
|
||||||
|
),
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('Memoranda'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
rows: state.memo.map((dataRow) {
|
||||||
|
return DataRow(
|
||||||
|
cells: [
|
||||||
|
DataCell(Text(dataRow.id.toString() ??
|
||||||
|
'N/A')), // Use a default value if cityCode is null
|
||||||
|
DataCell(Text(dataRow.code ??
|
||||||
|
'N/A')), // Use a default value if cityDescription is null
|
||||||
|
DataCell(Text(dataRow.memoranda ?? 'N/A')),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,105 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/municipalities_admin/municipalities_admin_bloc.dart';
|
||||||
|
import 'package:unit2/sevices/offline/offline_passo/admin/api_services/municipalities_api_services.dart';
|
||||||
|
import 'package:unit2/theme-data.dart/colors.dart';
|
||||||
|
|
||||||
|
import '../../../../model/passo/city.dart';
|
||||||
|
import '../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
|
||||||
|
class MunicipalitiesAdminPage extends StatefulWidget {
|
||||||
|
const MunicipalitiesAdminPage();
|
||||||
|
|
||||||
|
@override
|
||||||
|
_MunicipalitiesAdminPage createState() => _MunicipalitiesAdminPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MunicipalitiesAdminPage extends State<MunicipalitiesAdminPage> {
|
||||||
|
final items = [];
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
backgroundColor: primary,
|
||||||
|
title: const Text("Municipaities"),
|
||||||
|
centerTitle: true,
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
style: TextButton.styleFrom(
|
||||||
|
textStyle: const TextStyle(fontSize: 15),
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
try {
|
||||||
|
final result =
|
||||||
|
await MunicipalityAdminApiServices.instance.fetch();
|
||||||
|
|
||||||
|
// Assuming result is a List of JSON objects, convert them to City objects.
|
||||||
|
final cities =
|
||||||
|
result.map((json) => City.fromJson(json)).toList();
|
||||||
|
|
||||||
|
// Loop through the list of City objects and insert them into the local database.
|
||||||
|
for (City city in cities) {
|
||||||
|
print(city.cityDescription);
|
||||||
|
print(city.cityCode);
|
||||||
|
await SQLServices.instance.createMunicipalities(city);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// Handle any errors that might occur during the API call or database insertion.
|
||||||
|
print("Error: $e");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: const Text('SYNC'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
body: BlocConsumer<MunicipalitiesAdminBloc, MunicipalitiesAdminState>(
|
||||||
|
listener: (context, state) {
|
||||||
|
// TODO: implement listener
|
||||||
|
},
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state is MunicipalitiesLoaded) {
|
||||||
|
return Column(children: [
|
||||||
|
Expanded(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(15.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
child: DataTable(
|
||||||
|
// ignore: prefer_const_literals_to_create_immutables
|
||||||
|
columns: [
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('City Code'),
|
||||||
|
),
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('Description'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
rows: state.city.map((dataRow) {
|
||||||
|
return DataRow(
|
||||||
|
cells: [
|
||||||
|
DataCell(Text(dataRow.cityCode ??
|
||||||
|
'N/A')), // Use a default value if cityCode is null
|
||||||
|
DataCell(Text(dataRow.cityDescription ??
|
||||||
|
'N/A')), // Use a default value if cityDescription is null
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,113 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/barangay_admin/barangay_admin_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/signatories/signatories_admin_bloc.dart';
|
||||||
|
import 'package:unit2/model/passo/barangay.dart';
|
||||||
|
import 'package:unit2/model/passo/signatories.dart';
|
||||||
|
import 'package:unit2/sevices/offline/offline_passo/admin/api_services/barangay_api_services.dart';
|
||||||
|
import 'package:unit2/sevices/offline/offline_passo/admin/api_services/signatories.dart';
|
||||||
|
|
||||||
|
import '../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
import '../../../../theme-data.dart/colors.dart';
|
||||||
|
|
||||||
|
class SignatoriesAdminPage extends StatefulWidget {
|
||||||
|
const SignatoriesAdminPage();
|
||||||
|
|
||||||
|
@override
|
||||||
|
_SignatoriesAdminPage createState() => _SignatoriesAdminPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SignatoriesAdminPage extends State<SignatoriesAdminPage> {
|
||||||
|
final items = [];
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
backgroundColor: primary,
|
||||||
|
title: const Text("Signatories"),
|
||||||
|
centerTitle: true,
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
style: TextButton.styleFrom(
|
||||||
|
textStyle: const TextStyle(fontSize: 15),
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
try {
|
||||||
|
final result =
|
||||||
|
await SignatoriesAdminApiServices.instance.fetch();
|
||||||
|
|
||||||
|
// Assuming result is a List of JSON objects, convert them to City objects.
|
||||||
|
final signatories =
|
||||||
|
result.map((json) => Signatories.fromJson(json)).toList();
|
||||||
|
|
||||||
|
// Loop through the list of City objects and insert them into the local database.
|
||||||
|
for (Signatories signatory in signatories) {
|
||||||
|
await SQLServices.instance.createSignatories(signatory);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// Handle any errors that might occur during the API call or database insertion.
|
||||||
|
print("Error: $e");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: const Text('SYNC'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
body: BlocConsumer<SignatoriesAdminBloc, SignatoriesAdminState>(
|
||||||
|
listener: (context, state) {
|
||||||
|
// TODO: implement listener
|
||||||
|
},
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state is SignatoriesLoaded) {
|
||||||
|
return Column(children: [
|
||||||
|
Expanded(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(15.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
child: DataTable(
|
||||||
|
// ignore: prefer_const_literals_to_create_immutables
|
||||||
|
columns: [
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('ID'),
|
||||||
|
),
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('First Name'),
|
||||||
|
),
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('Middle Name'),
|
||||||
|
),
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('Last Name'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
rows: state.signatories.map((dataRow) {
|
||||||
|
return DataRow(
|
||||||
|
cells: [
|
||||||
|
DataCell(Text(dataRow.signatoryId
|
||||||
|
.toString())), // Use a default value if cityCode is null
|
||||||
|
DataCell(Text(dataRow.firstname ??
|
||||||
|
'N/A')), // Use a default value if cityDescription is null
|
||||||
|
DataCell(Text(dataRow.middlename ?? 'N/A')),
|
||||||
|
DataCell(Text(dataRow.lastname ?? 'N/A')),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,109 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/barangay_admin/barangay_admin_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/unit_construction/unit_construction_admin_bloc.dart';
|
||||||
|
import 'package:unit2/model/passo/barangay.dart';
|
||||||
|
import 'package:unit2/model/passo/unit_construct.dart';
|
||||||
|
import 'package:unit2/sevices/offline/offline_passo/admin/api_services/barangay_api_services.dart';
|
||||||
|
import 'package:unit2/sevices/offline/offline_passo/admin/api_services/unit_construction_api_services.dart';
|
||||||
|
|
||||||
|
import '../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
import '../../../../theme-data.dart/colors.dart';
|
||||||
|
|
||||||
|
class UnitConstructionAdminPage extends StatefulWidget {
|
||||||
|
const UnitConstructionAdminPage();
|
||||||
|
|
||||||
|
@override
|
||||||
|
_UnitConstructionAdminPage createState() => _UnitConstructionAdminPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _UnitConstructionAdminPage extends State<UnitConstructionAdminPage> {
|
||||||
|
final items = [];
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
backgroundColor: primary,
|
||||||
|
title: const Text("Unit Construction"),
|
||||||
|
centerTitle: true,
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
style: TextButton.styleFrom(
|
||||||
|
textStyle: const TextStyle(fontSize: 15),
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
try {
|
||||||
|
final result =
|
||||||
|
await UnitConstructionAdminApiServices.instance.fetch();
|
||||||
|
|
||||||
|
// Assuming result is a List of JSON objects, convert them to City objects.
|
||||||
|
final units =
|
||||||
|
result.map((json) => UnitConstruct.fromJson(json)).toList();
|
||||||
|
|
||||||
|
// Loop through the list of City objects and insert them into the local database.
|
||||||
|
for (UnitConstruct unit in units) {
|
||||||
|
await SQLServices.instance.createUnitConstruction(unit);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// Handle any errors that might occur during the API call or database insertion.
|
||||||
|
print("Error: $e");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: const Text('SYNC'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
body: BlocConsumer<UnitConstructionAdminBloc, UnitConstructionAdminState>(
|
||||||
|
listener: (context, state) {
|
||||||
|
// TODO: implement listener
|
||||||
|
},
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state is UnitConstructLoaded) {
|
||||||
|
return Column(children: [
|
||||||
|
Expanded(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(15.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
child: DataTable(
|
||||||
|
// ignore: prefer_const_literals_to_create_immutables
|
||||||
|
columns: [
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('Bldg Type'),
|
||||||
|
),
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('Building'),
|
||||||
|
),
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('Unit Value'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
rows: state.unit.map((dataRow) {
|
||||||
|
return DataRow(
|
||||||
|
cells: [
|
||||||
|
DataCell(Text(dataRow.bldgType ??
|
||||||
|
'N/A')), // Use a default value if cityCode is null
|
||||||
|
DataCell(Text(dataRow.building ??
|
||||||
|
'N/A')), // Use a default value if cityDescription is null
|
||||||
|
DataCell(Text(dataRow.unitValue ?? 'N/A')),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,715 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||||
|
import 'package:fluttertoast/fluttertoast.dart';
|
||||||
|
import 'package:form_builder_validators/form_builder_validators.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:searchfield/searchfield.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/class_components_admin.dart/class_components_admin_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/unit_construction/unit_construction_admin_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/building/additional_items_offline/additional_items_offline_bloc.dart';
|
||||||
|
import 'package:unit2/model/passo/additional_items.dart';
|
||||||
|
import 'package:unit2/model/passo/class_components.dart';
|
||||||
|
import 'package:unit2/model/passo/unit_construct.dart';
|
||||||
|
import 'package:unit2/theme-data.dart/form-style.dart';
|
||||||
|
import 'package:unit2/utils/text_container.dart';
|
||||||
|
import 'package:unit2/widgets/error_state.dart';
|
||||||
|
|
||||||
|
class AddExtraItemsOffline extends StatefulWidget {
|
||||||
|
AddExtraItemsOffline();
|
||||||
|
|
||||||
|
@override
|
||||||
|
_AddExtraItemsOffline createState() => _AddExtraItemsOffline();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AddExtraItemsOffline extends State<AddExtraItemsOffline> {
|
||||||
|
GlobalKey<FormBuilderState> formKey = GlobalKey<FormBuilderState>();
|
||||||
|
final focus = FocusNode();
|
||||||
|
bool isPainted = false;
|
||||||
|
bool isSecondHand = false;
|
||||||
|
TextEditingController textEditingController = TextEditingController();
|
||||||
|
double _unitBase = 0;
|
||||||
|
int _areaValue = 0;
|
||||||
|
final double _depValue = 0;
|
||||||
|
double _unitValue = 0;
|
||||||
|
String _className = "";
|
||||||
|
int _classId = 0;
|
||||||
|
String _structureType = "";
|
||||||
|
bool _withoutBUCC = false;
|
||||||
|
int _notPaintedUnitVal = 0;
|
||||||
|
int _secondHandUnitVal = 0;
|
||||||
|
|
||||||
|
BoxDecoration box1() {
|
||||||
|
return const BoxDecoration(boxShadow: [
|
||||||
|
BoxShadow(color: Colors.black12, spreadRadius: 5, blurRadius: 5)
|
||||||
|
], color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(3)));
|
||||||
|
}
|
||||||
|
|
||||||
|
double _amountofDepreciation(unitVal, unitBase, area, depreciation) {
|
||||||
|
return ((unitVal * unitBase) * area) * depreciation;
|
||||||
|
}
|
||||||
|
|
||||||
|
double _totalMarketValue(unitVal, unitBase, area, depreciation, withBUCC,
|
||||||
|
className, painted, secondHand, paintedUnitVal, secondhandUntVal) {
|
||||||
|
if (withBUCC == false) {
|
||||||
|
if (painted == true || secondHand == true) {
|
||||||
|
final deductions = (paintedUnitVal + secondhandUntVal) / 100;
|
||||||
|
|
||||||
|
print(deductions);
|
||||||
|
return (((unitVal - deductions) * unitBase) * area);
|
||||||
|
} else {
|
||||||
|
return ((unitVal * unitBase) * area);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return (unitVal * area);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BlocBuilder<AdditionalItemsOfflineBloc, AdditionalItemsOfflineState>(
|
||||||
|
buildWhen: (previous, current) {
|
||||||
|
return false;
|
||||||
|
}, builder: (context, state) {
|
||||||
|
if (state is ShowAddItemsScreen) {
|
||||||
|
return BlocConsumer<ClassComponentsAdminBloc,
|
||||||
|
ClassComponentsAdminState>(
|
||||||
|
listener: (context, state) {
|
||||||
|
// TODO: implement listener
|
||||||
|
},
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state is ClassComponentsAdminLoaded) {
|
||||||
|
final classes = state.classes;
|
||||||
|
return BlocConsumer<UnitConstructionAdminBloc,
|
||||||
|
UnitConstructionAdminState>(
|
||||||
|
listener: (context, state) {
|
||||||
|
// TODO: implement listener
|
||||||
|
},
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state is UnitConstructLoaded) {
|
||||||
|
return FormBuilder(
|
||||||
|
key: formKey,
|
||||||
|
onChanged: () {
|
||||||
|
formKey.currentState?.save();
|
||||||
|
},
|
||||||
|
autovalidateMode: AutovalidateMode.disabled,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Container(
|
||||||
|
height: 800,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(
|
||||||
|
left: 0,
|
||||||
|
top: 10,
|
||||||
|
right: 0,
|
||||||
|
bottom: 0),
|
||||||
|
child: FormBuilderDropdown(
|
||||||
|
name: 'extra_item',
|
||||||
|
autofocus: false,
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Additional Item", ""),
|
||||||
|
items: classes
|
||||||
|
.map((e) => DropdownMenuItem(
|
||||||
|
value: e,
|
||||||
|
child: Text(e.componentName!),
|
||||||
|
))
|
||||||
|
.toList(),
|
||||||
|
onChanged: (value) {
|
||||||
|
if (value!.minBaseUnitvalPercent !=
|
||||||
|
'0.00') {
|
||||||
|
setState(() {
|
||||||
|
_unitValue = double.parse(
|
||||||
|
value.minBaseUnitvalPercent!);
|
||||||
|
_className = value.componentName!;
|
||||||
|
_classId = value.id!;
|
||||||
|
_withoutBUCC =
|
||||||
|
value.withoutBucc == 1
|
||||||
|
? true
|
||||||
|
: false;
|
||||||
|
});
|
||||||
|
formKey.currentState!.patchValue({
|
||||||
|
'unitValue':
|
||||||
|
value.minBaseUnitvalPercent
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (value.maxBaseUnitvalPercent !=
|
||||||
|
'0.00') {
|
||||||
|
setState(() {
|
||||||
|
_unitValue = double.parse(
|
||||||
|
value.maxBaseUnitvalPercent!);
|
||||||
|
_className = value.componentName!;
|
||||||
|
_classId = value.id!;
|
||||||
|
_withoutBUCC =
|
||||||
|
value.withoutBucc == 1
|
||||||
|
? true
|
||||||
|
: false;
|
||||||
|
});
|
||||||
|
formKey.currentState!.patchValue({
|
||||||
|
'unitValue':
|
||||||
|
value.maxBaseUnitvalPercent
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (value.minUnitvalSqrmtr !=
|
||||||
|
'0.00') {
|
||||||
|
setState(() {
|
||||||
|
_unitValue = double.parse(
|
||||||
|
value.minUnitvalSqrmtr!);
|
||||||
|
_className = value.componentName!;
|
||||||
|
_classId = value.id!;
|
||||||
|
_withoutBUCC =
|
||||||
|
value.withoutBucc == 1
|
||||||
|
? true
|
||||||
|
: false;
|
||||||
|
});
|
||||||
|
formKey.currentState!.patchValue({
|
||||||
|
'unitValue':
|
||||||
|
value.minUnitvalSqrmtr
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (value.maxUnitvalSqrmtr !=
|
||||||
|
'0.00') {
|
||||||
|
setState(() {
|
||||||
|
_unitValue = double.parse(
|
||||||
|
value.maxUnitvalSqrmtr!);
|
||||||
|
_className = value.componentName!;
|
||||||
|
_classId = value.id!;
|
||||||
|
_withoutBUCC =
|
||||||
|
value.withoutBucc == 1
|
||||||
|
? true
|
||||||
|
: false;
|
||||||
|
});
|
||||||
|
formKey.currentState!.patchValue({
|
||||||
|
'unitValue':
|
||||||
|
value.maxUnitvalSqrmtr
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (value.minAddBaseunitval !=
|
||||||
|
'0.00') {
|
||||||
|
setState(() {
|
||||||
|
_unitValue = double.parse(
|
||||||
|
value.minAddBaseunitval!);
|
||||||
|
_className = value.componentName!;
|
||||||
|
_classId = value.id!;
|
||||||
|
_withoutBUCC =
|
||||||
|
value.withoutBucc == 1
|
||||||
|
? true
|
||||||
|
: false;
|
||||||
|
});
|
||||||
|
formKey.currentState!.patchValue({
|
||||||
|
'unitValue':
|
||||||
|
value.minAddBaseunitval
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (value.maxAddBaseunitval !=
|
||||||
|
'0.00') {
|
||||||
|
setState(() {
|
||||||
|
_unitValue = double.parse(
|
||||||
|
value.maxAddBaseunitval!);
|
||||||
|
_className = value.componentName!;
|
||||||
|
_classId = value.id!;
|
||||||
|
_withoutBUCC =
|
||||||
|
value.withoutBucc == 1
|
||||||
|
? true
|
||||||
|
: false;
|
||||||
|
});
|
||||||
|
formKey.currentState!.patchValue({
|
||||||
|
'unitValue':
|
||||||
|
value.maxAddBaseunitval
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (value.minDeductBaserate !=
|
||||||
|
'0.00') {
|
||||||
|
setState(() {
|
||||||
|
_unitValue = double.parse(
|
||||||
|
value.minDeductBaserate!);
|
||||||
|
_className = value.componentName!;
|
||||||
|
_classId = value.id!;
|
||||||
|
_withoutBUCC =
|
||||||
|
value.withoutBucc == 1
|
||||||
|
? true
|
||||||
|
: false;
|
||||||
|
});
|
||||||
|
formKey.currentState!.patchValue({
|
||||||
|
'unitValue':
|
||||||
|
value.minDeductBaserate
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (value.maxDeductBaserate !=
|
||||||
|
'0.00') {
|
||||||
|
setState(() {
|
||||||
|
_unitValue = double.parse(
|
||||||
|
value.maxDeductBaserate!);
|
||||||
|
_className = value.componentName!;
|
||||||
|
_classId = value.id!;
|
||||||
|
_withoutBUCC =
|
||||||
|
value.withoutBucc == 1
|
||||||
|
? true
|
||||||
|
: false;
|
||||||
|
});
|
||||||
|
formKey.currentState!.patchValue({
|
||||||
|
'unitValue':
|
||||||
|
value.maxDeductBaserate
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(
|
||||||
|
left: 0,
|
||||||
|
top: 10,
|
||||||
|
right: 0,
|
||||||
|
bottom: 0),
|
||||||
|
child: SizedBox(
|
||||||
|
height: 45,
|
||||||
|
child: SearchField(
|
||||||
|
itemHeight: 70,
|
||||||
|
suggestions: state.unit
|
||||||
|
.map((UnitConstruct unit) =>
|
||||||
|
SearchFieldListItem(
|
||||||
|
'${unit.bldgType} - ${unit.building}',
|
||||||
|
item: unit,
|
||||||
|
child: ListTile(
|
||||||
|
title: Text(
|
||||||
|
'${unit.bldgType} - ${unit.building!.toUpperCase()}',
|
||||||
|
overflow: TextOverflow
|
||||||
|
.ellipsis,
|
||||||
|
),
|
||||||
|
)))
|
||||||
|
.toList(),
|
||||||
|
|
||||||
|
validator:
|
||||||
|
FormBuilderValidators.required(
|
||||||
|
errorText:
|
||||||
|
"This field is required"),
|
||||||
|
|
||||||
|
searchInputDecoration:
|
||||||
|
normalTextFieldStyle(
|
||||||
|
"Structure Type", "")
|
||||||
|
.copyWith(
|
||||||
|
suffixIcon: const Icon(
|
||||||
|
Icons
|
||||||
|
.arrow_drop_down)),
|
||||||
|
////agency suggestion tap
|
||||||
|
focusNode: focus,
|
||||||
|
suggestionState: Suggestion.expand,
|
||||||
|
onSuggestionTap: (unit) {
|
||||||
|
setState(() {
|
||||||
|
_unitBase = double.parse(
|
||||||
|
unit.item!.unitValue);
|
||||||
|
_structureType =
|
||||||
|
'${unit.item!.bldgType} - ${unit.item!.building}';
|
||||||
|
});
|
||||||
|
focus.unfocus();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// const SizedBox(height: 10),
|
||||||
|
// Container(
|
||||||
|
// margin: const EdgeInsets.only(
|
||||||
|
// left: 0, top: 10, right: 0, bottom: 0),
|
||||||
|
// child: FormBuilderDropdown(
|
||||||
|
// name: 'struc_type',
|
||||||
|
// autofocus: false,
|
||||||
|
// decoration:
|
||||||
|
// normalTextFieldStyle("Structure Type", ""),
|
||||||
|
// items: widget.unit
|
||||||
|
// .map((e) => DropdownMenuItem(
|
||||||
|
// value: e,
|
||||||
|
// child:
|
||||||
|
// Text(e.bldgType + " - " + e.building),
|
||||||
|
// ))
|
||||||
|
// .toList(),
|
||||||
|
// onChanged: (val) {
|
||||||
|
// setState(() {
|
||||||
|
// _unitBase = double.parse(val!.unitValue);
|
||||||
|
// _structureType = val.bldgType;
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
name: 'unitValue',
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Unit Value", ""),
|
||||||
|
validator:
|
||||||
|
FormBuilderValidators.compose(
|
||||||
|
[]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
name: 'areaValue',
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Area", ""),
|
||||||
|
validator:
|
||||||
|
FormBuilderValidators.compose(
|
||||||
|
[]),
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
_areaValue = int.parse(value!);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
// const SizedBox(height: 10),
|
||||||
|
// FormBuilderTextField(
|
||||||
|
// name: 'depRate',
|
||||||
|
// decoration:
|
||||||
|
// normalTextFieldStyle("Depreciation Rate", ""),
|
||||||
|
// validator: FormBuilderValidators.compose([]),
|
||||||
|
// onChanged: (value) {
|
||||||
|
// setState(() {
|
||||||
|
// _depValue = double.parse(value!);
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// const SizedBox(height: 10),
|
||||||
|
// FormBuilderTextField(
|
||||||
|
// name: 'marketValue',
|
||||||
|
// decoration: normalTextFieldStyle(
|
||||||
|
// NumberFormat.currency(
|
||||||
|
// locale: 'en-PH', symbol: "₱")
|
||||||
|
// .format(_totalMarketValue(_unitValue,
|
||||||
|
// _unitBase, _areaValue, _depValue)),
|
||||||
|
// ""),
|
||||||
|
// validator: FormBuilderValidators.compose([]),
|
||||||
|
// onChanged: (value) {
|
||||||
|
// setState(() {
|
||||||
|
// _marketValue = double.parse(value!);
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// const SizedBox(height: 10),
|
||||||
|
// Text('Amount of Depreciation'),
|
||||||
|
// const SizedBox(height: 5),
|
||||||
|
// Container(
|
||||||
|
// height: 45.0,
|
||||||
|
// width: double.infinity,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// color: Colors.white,
|
||||||
|
// border: Border.all(
|
||||||
|
// color: Colors.grey,
|
||||||
|
// width: 1.0,
|
||||||
|
// ),
|
||||||
|
// borderRadius: BorderRadius.circular(5.0),
|
||||||
|
// ),
|
||||||
|
// child: Align(
|
||||||
|
// alignment: Alignment.center,
|
||||||
|
// child: Text(NumberFormat.currency(
|
||||||
|
// locale: 'en-PH', symbol: "₱")
|
||||||
|
// .format(_amountofDepreciation(_unitValue,
|
||||||
|
// _unitBase, _areaValue, _depValue)))),
|
||||||
|
// ),
|
||||||
|
|
||||||
|
Visibility(
|
||||||
|
visible: !_withoutBUCC,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
const Text(
|
||||||
|
'Building is not painted?'),
|
||||||
|
const SizedBox(height: 5),
|
||||||
|
Container(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Checkbox(
|
||||||
|
value: isPainted,
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
setState(() {
|
||||||
|
isPainted = value!;
|
||||||
|
if (value == false) {
|
||||||
|
_notPaintedUnitVal = 0;
|
||||||
|
} else {
|
||||||
|
_notPaintedUnitVal = 10;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
Container(
|
||||||
|
height: 40.0,
|
||||||
|
width: 100,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
border: Border.all(
|
||||||
|
color: Colors.grey,
|
||||||
|
width: 1.0,
|
||||||
|
),
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(
|
||||||
|
5.0),
|
||||||
|
),
|
||||||
|
child: Align(
|
||||||
|
alignment:
|
||||||
|
Alignment.center,
|
||||||
|
child: Text(' - ' +
|
||||||
|
_notPaintedUnitVal
|
||||||
|
.toString() +
|
||||||
|
'%')),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
const Text(
|
||||||
|
'Uses second hand materials?'),
|
||||||
|
const SizedBox(height: 5),
|
||||||
|
Container(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Checkbox(
|
||||||
|
value: isSecondHand,
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
setState(() {
|
||||||
|
isSecondHand = value!;
|
||||||
|
if (isSecondHand ==
|
||||||
|
false) {
|
||||||
|
_secondHandUnitVal = 0;
|
||||||
|
formKey.currentState!
|
||||||
|
.patchValue({
|
||||||
|
'secondHandMat': '0'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
_secondHandUnitVal = 5;
|
||||||
|
formKey.currentState!
|
||||||
|
.patchValue({
|
||||||
|
'secondHandMat': '5'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 40,
|
||||||
|
width: 100,
|
||||||
|
child:
|
||||||
|
FormBuilderTextField(
|
||||||
|
enabled: isSecondHand,
|
||||||
|
name: 'secondHandMat',
|
||||||
|
textAlign:
|
||||||
|
TextAlign.center,
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle(
|
||||||
|
"Unit Value",
|
||||||
|
""),
|
||||||
|
validator:
|
||||||
|
FormBuilderValidators
|
||||||
|
.compose([]),
|
||||||
|
onChanged: (value) {
|
||||||
|
// Check if the value is not null before parsing to double
|
||||||
|
if (value != null &&
|
||||||
|
value
|
||||||
|
.isNotEmpty) {
|
||||||
|
setState(() {
|
||||||
|
_secondHandUnitVal =
|
||||||
|
int.parse(
|
||||||
|
value);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Handle the case when the value is empty or null
|
||||||
|
// For example, set _secondHandUnitVal to a default value or show an error message.
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 40,
|
||||||
|
width: 40,
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
'%',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight:
|
||||||
|
FontWeight
|
||||||
|
.bold),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
const Text('Market Value'),
|
||||||
|
const SizedBox(height: 5),
|
||||||
|
Container(
|
||||||
|
height: 45.0,
|
||||||
|
width: double.infinity,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
border: Border.all(
|
||||||
|
color: Colors.grey,
|
||||||
|
width: 1.0,
|
||||||
|
),
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(5.0),
|
||||||
|
),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(NumberFormat.currency(
|
||||||
|
locale: 'en-PH', symbol: "₱")
|
||||||
|
.format(_totalMarketValue(
|
||||||
|
_unitValue,
|
||||||
|
_unitBase,
|
||||||
|
_areaValue,
|
||||||
|
_depValue,
|
||||||
|
_withoutBUCC,
|
||||||
|
_className,
|
||||||
|
isPainted,
|
||||||
|
isSecondHand,
|
||||||
|
_notPaintedUnitVal,
|
||||||
|
_secondHandUnitVal)))),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 120,
|
||||||
|
height: 60,
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: () async {
|
||||||
|
try {
|
||||||
|
final tempID =
|
||||||
|
await SharedPreferences
|
||||||
|
.getInstance();
|
||||||
|
|
||||||
|
context
|
||||||
|
.read<
|
||||||
|
AdditionalItemsOfflineBloc>()
|
||||||
|
.add(AddAdditionalItems(
|
||||||
|
id: 1,
|
||||||
|
bldgapprDetailsId:
|
||||||
|
tempID
|
||||||
|
.getInt(
|
||||||
|
'tempid')!,
|
||||||
|
classId: _classId,
|
||||||
|
className: _className,
|
||||||
|
structType:
|
||||||
|
_structureType,
|
||||||
|
unitValue:
|
||||||
|
_withoutBUCC ==
|
||||||
|
true
|
||||||
|
? 0
|
||||||
|
: _unitValue,
|
||||||
|
baseUnitValue:
|
||||||
|
_unitBase,
|
||||||
|
area: _areaValue,
|
||||||
|
marketValue:
|
||||||
|
(_unitValue * _unitBase) *
|
||||||
|
_areaValue,
|
||||||
|
depreciationRate:
|
||||||
|
_depValue,
|
||||||
|
adjustedMarketVal:
|
||||||
|
_totalMarketValue(
|
||||||
|
_unitValue,
|
||||||
|
_unitBase,
|
||||||
|
_areaValue,
|
||||||
|
_depValue,
|
||||||
|
_withoutBUCC,
|
||||||
|
_className,
|
||||||
|
isPainted,
|
||||||
|
isSecondHand,
|
||||||
|
_notPaintedUnitVal,
|
||||||
|
_secondHandUnitVal),
|
||||||
|
actualUse: 'Test',
|
||||||
|
amtDepreciation:
|
||||||
|
_amountofDepreciation(
|
||||||
|
_unitValue,
|
||||||
|
_unitBase,
|
||||||
|
_areaValue,
|
||||||
|
_depValue,
|
||||||
|
),
|
||||||
|
painted: true,
|
||||||
|
secondhand: true,
|
||||||
|
paintedUnitval: '1',
|
||||||
|
secondhandUnitval:
|
||||||
|
'1'));
|
||||||
|
} catch (e) {
|
||||||
|
Fluttertoast.showToast(
|
||||||
|
msg:
|
||||||
|
"Slow internet connection, please try again!",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
primary: Colors.black,
|
||||||
|
),
|
||||||
|
child: const Text("Submit"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width:
|
||||||
|
5), // Use SizedBox for horizontal spacing in a Row
|
||||||
|
Container(
|
||||||
|
width: 120,
|
||||||
|
height: 60,
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
// context
|
||||||
|
// .read<AdditionalItemsOfflineBloc>()
|
||||||
|
// .add(const LoadAdditionalItems());
|
||||||
|
},
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
primary: Colors.black,
|
||||||
|
),
|
||||||
|
child: const Text("Cancel"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// if (state is Add) {
|
||||||
|
// return SomethingWentWrong(
|
||||||
|
// message: onError,
|
||||||
|
// onpressed: () {
|
||||||
|
// context.read<AdditionalItemBloc>().add(LoadAdditionalItems());
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
return Container();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,120 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||||
|
import 'package:im_stepper/stepper.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/building/add/property_appraisal.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/building/add/property_assessment.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/building/add/property_owner_info.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/building/add/additional_items.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/building/add/general_description.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/building/add/landref_location.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/building/add/structural_material.dart';
|
||||||
|
import 'package:unit2/theme-data.dart/colors.dart';
|
||||||
|
|
||||||
|
import '../../../../../bloc/offline/offline_passo/building/owner_info_bloc/crud_bloc.dart';
|
||||||
|
import '../../../../../model/passo/property_info.dart';
|
||||||
|
|
||||||
|
GlobalKey<FormBuilderState> offlineBldgKey = GlobalKey<FormBuilderState>();
|
||||||
|
|
||||||
|
class AddBuilding extends StatefulWidget {
|
||||||
|
Function triggerBlocEvent;
|
||||||
|
AddBuilding(this.triggerBlocEvent);
|
||||||
|
@override
|
||||||
|
_AddBuilding createState() => _AddBuilding();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AddBuilding extends State<AddBuilding> {
|
||||||
|
int activeStep = 0; // Initial step set to 5.
|
||||||
|
int upperBound = 6;
|
||||||
|
|
||||||
|
void PrevBtn() {
|
||||||
|
setState(() {
|
||||||
|
activeStep--;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void NextBtn() {
|
||||||
|
setState(() {
|
||||||
|
activeStep++;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
backgroundColor: primary,
|
||||||
|
centerTitle: true,
|
||||||
|
title: const Text("Offline Building FAAS"),
|
||||||
|
),
|
||||||
|
body: Column(children: [
|
||||||
|
NumberStepper(
|
||||||
|
numbers: [1, 2, 3, 4, 5, 6, 7],
|
||||||
|
stepPadding: 5,
|
||||||
|
activeStepColor: primary,
|
||||||
|
numberStyle: TextStyle(color: Colors.white),
|
||||||
|
lineColor: primary,
|
||||||
|
// activeStep property set to activeStep variable defined above.
|
||||||
|
activeStep: activeStep,
|
||||||
|
activeStepBorderColor: Colors.white,
|
||||||
|
activeStepBorderWidth: 1,
|
||||||
|
// This ensures step-tapping updates the activeStep.
|
||||||
|
onStepReached: (index) {
|
||||||
|
setState(() {
|
||||||
|
activeStep = index;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
enableStepTapping: false,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: StatefulBuilder(
|
||||||
|
builder: (BuildContext context, StateSetter setState) {
|
||||||
|
return FormBuilder(
|
||||||
|
key: offlineBldgKey,
|
||||||
|
onChanged: () {
|
||||||
|
offlineBldgKey.currentState?.save();
|
||||||
|
},
|
||||||
|
autovalidateMode: AutovalidateMode.disabled,
|
||||||
|
child: Container(
|
||||||
|
child: content(PrevBtn, NextBtn),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget content(PrevBtn, NextBtn) {
|
||||||
|
switch (activeStep) {
|
||||||
|
case 0:
|
||||||
|
return PropertyInfoOfflinePage(NextBtn);
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
return LandRefLocationOfflinePage(PrevBtn, NextBtn);
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
return GeneralDescriptionOfflinePage(NextBtn, PrevBtn);
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
return StructuralMaterialsOfflinePage(PrevBtn, NextBtn);
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
return AdditionalItemOfflinePage(PrevBtn, NextBtn);
|
||||||
|
|
||||||
|
case 5:
|
||||||
|
return PropertyAppraisalOfflinePage(NextBtn, PrevBtn);
|
||||||
|
|
||||||
|
case 6:
|
||||||
|
return PropertyAssessmentOfflinePage(onSAveAll);
|
||||||
|
|
||||||
|
default:
|
||||||
|
return Text("Property Info");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void onSAveAll() {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
widget.triggerBlocEvent();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,288 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/building/additional_items_offline/additional_items_offline_bloc.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/building/add/AddExtraItemsOffline.dart';
|
||||||
|
|
||||||
|
import '../../../../../widgets/passo/custom_button.dart';
|
||||||
|
|
||||||
|
class AdditionalItemOfflinePage extends StatefulWidget {
|
||||||
|
final VoidCallback additionalItemsPrevBtn;
|
||||||
|
final VoidCallback additionalItemsNextBtn;
|
||||||
|
|
||||||
|
const AdditionalItemOfflinePage(
|
||||||
|
this.additionalItemsPrevBtn, this.additionalItemsNextBtn);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_AdditionalItemOfflinePage createState() => _AdditionalItemOfflinePage();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AdditionalItemOfflinePage extends State<AdditionalItemOfflinePage> {
|
||||||
|
// void deleteItem(int itemId) {
|
||||||
|
// context.read<AdditionalItemBloc>().add(DeleteAdditionalItems(id: itemId));
|
||||||
|
// }
|
||||||
|
|
||||||
|
final items = [];
|
||||||
|
|
||||||
|
double _totalMarketValue(items) {
|
||||||
|
double total = 0;
|
||||||
|
items.forEach((row) {
|
||||||
|
total += double.parse(row.adjustedMarketVal);
|
||||||
|
});
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
body: BlocConsumer<AdditionalItemsOfflineBloc,
|
||||||
|
AdditionalItemsOfflineState>(
|
||||||
|
listener: (context, state) {
|
||||||
|
// TODO: implement listener
|
||||||
|
},
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state is AdditionalItemsOfflineInitial) {
|
||||||
|
return Column(children: [
|
||||||
|
Expanded(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(15.0),
|
||||||
|
child: Column(children: [
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(
|
||||||
|
left: 0, top: 20, right: 0, bottom: 10),
|
||||||
|
child: const Text('ADDITIONAL ITEMS',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold, fontSize: 18),
|
||||||
|
textAlign: TextAlign.left),
|
||||||
|
),
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.topRight,
|
||||||
|
child: ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: Colors.red,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
context
|
||||||
|
.read<AdditionalItemsOfflineBloc>()
|
||||||
|
.add(ShowAdditionalItems());
|
||||||
|
},
|
||||||
|
child: const Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Text('ADD ITEM'), // <-- Text
|
||||||
|
SizedBox(
|
||||||
|
width: 5,
|
||||||
|
),
|
||||||
|
Icon(
|
||||||
|
// <-- Icon
|
||||||
|
Icons.add,
|
||||||
|
size: 24.0,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
]))))
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
if (state is AdditionalItemsLoaded) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(15.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(
|
||||||
|
left: 0, top: 20, right: 0, bottom: 10),
|
||||||
|
child: const Text('ADDITIONAL ITEMS',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold, fontSize: 18),
|
||||||
|
textAlign: TextAlign.left),
|
||||||
|
),
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.topRight,
|
||||||
|
child: ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: Colors.red,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
context
|
||||||
|
.read<AdditionalItemsOfflineBloc>()
|
||||||
|
.add(ShowAdditionalItems());
|
||||||
|
},
|
||||||
|
child: const Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Text('ADD ITEM'), // <-- Text
|
||||||
|
SizedBox(
|
||||||
|
width: 5,
|
||||||
|
),
|
||||||
|
Icon(
|
||||||
|
// <-- Icon
|
||||||
|
Icons.add,
|
||||||
|
size: 24.0,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
child: DataTable(
|
||||||
|
// ignore: prefer_const_literals_to_create_immutables
|
||||||
|
columns: [
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('Items'),
|
||||||
|
),
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('Unit Value'),
|
||||||
|
),
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('% of BUCC'),
|
||||||
|
),
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('Market Value'),
|
||||||
|
),
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('Action'),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
rows: state.addItem.map((dataRow) {
|
||||||
|
return DataRow(
|
||||||
|
cells: [
|
||||||
|
DataCell(Text(dataRow.className)),
|
||||||
|
DataCell(
|
||||||
|
Text(dataRow.baseUnitValue.toString())),
|
||||||
|
DataCell(Text(dataRow.unitValue.toString())),
|
||||||
|
DataCell(Text(((double.parse(
|
||||||
|
dataRow.adjustedMarketVal.toString())))
|
||||||
|
.toString())),
|
||||||
|
DataCell(Row(
|
||||||
|
children: [
|
||||||
|
InkWell(
|
||||||
|
child: Container(
|
||||||
|
height: 30,
|
||||||
|
width: 30,
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
child: const Icon(
|
||||||
|
Icons.delete,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 20.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
// deleteItem(dataRow.id);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
child: Container(
|
||||||
|
height: 30,
|
||||||
|
width: 30,
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
child: const Icon(
|
||||||
|
Icons.edit,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 20.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () {},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
))
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 20.0, right: 20.0),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
const Text(
|
||||||
|
'Total',
|
||||||
|
style:
|
||||||
|
TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
NumberFormat.currency(locale: 'en-PH', symbol: "₱")
|
||||||
|
.format(_totalMarketValue(items)),
|
||||||
|
style:
|
||||||
|
TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(15.0),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: [
|
||||||
|
CustomButton(
|
||||||
|
icon: const Icon(Icons.chevron_left_rounded,
|
||||||
|
color: Colors.white),
|
||||||
|
onPressed: () {
|
||||||
|
{
|
||||||
|
widget.additionalItemsPrevBtn();
|
||||||
|
}
|
||||||
|
;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
CustomButton(
|
||||||
|
icon: const Icon(Icons.chevron_right_rounded,
|
||||||
|
color: Colors.white),
|
||||||
|
onPressed: () {
|
||||||
|
{
|
||||||
|
widget.additionalItemsNextBtn();
|
||||||
|
}
|
||||||
|
;
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (state is ShowAddItemsScreen) {
|
||||||
|
return ConstrainedBox(
|
||||||
|
constraints: BoxConstraints(maxHeight: 1000.0),
|
||||||
|
child: AlertDialog(
|
||||||
|
insetPadding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 20.0,
|
||||||
|
vertical: 10.0,
|
||||||
|
),
|
||||||
|
title: const Text(
|
||||||
|
'ADD EXTRA ITEMS',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
content: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [Expanded(child: AddExtraItemsOffline())],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,252 @@
|
||||||
|
import 'dart:ui';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||||
|
import 'package:fluttertoast/fluttertoast.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/unit_construction/unit_construction_admin_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/building/general_description/general_description_bloc.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/building/add/add_building.dart';
|
||||||
|
import 'package:unit2/screens/passo/Building/add_building_components/general_description.dart';
|
||||||
|
|
||||||
|
import '../../../../../model/passo/general_description.dart';
|
||||||
|
import '../../../../../theme-data.dart/form-style.dart';
|
||||||
|
import '../../../../../widgets/passo/custom_button.dart';
|
||||||
|
import '../../../../../widgets/passo/custom_formBuilder_fields.dart';
|
||||||
|
|
||||||
|
class GeneralDescriptionOfflinePage extends StatefulWidget {
|
||||||
|
final VoidCallback onPutGeneralDescription;
|
||||||
|
final VoidCallback gendescPrevBtn;
|
||||||
|
|
||||||
|
GeneralDescriptionOfflinePage(
|
||||||
|
this.onPutGeneralDescription, this.gendescPrevBtn);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_GeneralDescriptionOfflinePage createState() =>
|
||||||
|
_GeneralDescriptionOfflinePage();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _GeneralDescriptionOfflinePage
|
||||||
|
extends State<GeneralDescriptionOfflinePage> {
|
||||||
|
final actual_use = [
|
||||||
|
"Residential",
|
||||||
|
"Agricultural",
|
||||||
|
"Commercial",
|
||||||
|
"Industrial",
|
||||||
|
"Mineral",
|
||||||
|
"Timberland",
|
||||||
|
];
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BlocConsumer<UnitConstructionAdminBloc, UnitConstructionAdminState>(
|
||||||
|
listener: (context, state) {
|
||||||
|
// TODO: implement listener
|
||||||
|
},
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state is UnitConstructLoaded) {
|
||||||
|
return SingleChildScrollView(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(20.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(
|
||||||
|
left: 0, top: 20, right: 0, bottom: 10),
|
||||||
|
child: const Text('GENERAL DESCRIPTION',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold, fontSize: 18),
|
||||||
|
textAlign: TextAlign.left),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(
|
||||||
|
left: 0, top: 10, right: 0, bottom: 0),
|
||||||
|
child: FormBuilderDropdown(
|
||||||
|
name: 'bldg_type',
|
||||||
|
autofocus: false,
|
||||||
|
decoration: normalTextFieldStyle("Kind of Building", ""),
|
||||||
|
items: state.unit
|
||||||
|
.map((e) => DropdownMenuItem(
|
||||||
|
value: e,
|
||||||
|
child: Text('${e.bldgType}-${e.building}'),
|
||||||
|
))
|
||||||
|
.toList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
customDropDownField(
|
||||||
|
"Actual Use", "", 'actual_use', actual_use),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"Bldg. Permit No.", "", 'bldg_permit'),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child: customDatTimePicker(
|
||||||
|
"Certificate of Occupancy Issued ON",
|
||||||
|
"",
|
||||||
|
'date_issued'))
|
||||||
|
]),
|
||||||
|
customTextField(
|
||||||
|
"Condominium Certificate of Title (CCT)", "", 'cct'),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: customDatTimePicker(
|
||||||
|
"Certificate of Completion Issued ON",
|
||||||
|
"",
|
||||||
|
'coc_issued'),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child: customDatTimePicker(
|
||||||
|
"Certificate of Occupancy Issued ON",
|
||||||
|
"",
|
||||||
|
'coo_issued'))
|
||||||
|
]),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: customDatTimePicker(
|
||||||
|
"Date Constructed /Completed",
|
||||||
|
"",
|
||||||
|
'date_cnstructed'),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child: customDatTimePicker(
|
||||||
|
"Date Occupied", "", 'date_occupied'))
|
||||||
|
]),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField("Bldg. Age", "", 'bldg_age'),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"No. of storeys", "", 'no_of_storeys'))
|
||||||
|
]),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"Area of 1st Floor", "", 'area_of_1stFl'),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"Area of 2nd Floor", "", 'area_of_2ndFl'))
|
||||||
|
]),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"Area of 3rd Floor", "", 'area_of_3rdFl')),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"Area of 4th Floor", "", 'area_of_4thFl'))
|
||||||
|
]),
|
||||||
|
customTextField("Total Area", "", 'total_area'),
|
||||||
|
SizedBox(
|
||||||
|
height: 50,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: [
|
||||||
|
CustomButton(
|
||||||
|
icon: const Icon(Icons.chevron_left_rounded,
|
||||||
|
color: Colors.white),
|
||||||
|
onPressed: () {
|
||||||
|
{
|
||||||
|
widget.gendescPrevBtn();
|
||||||
|
}
|
||||||
|
;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
CustomButton(
|
||||||
|
icon: const Icon(Icons.chevron_right_rounded,
|
||||||
|
color: Colors.white),
|
||||||
|
onPressed: () async {
|
||||||
|
{
|
||||||
|
final tempID =
|
||||||
|
await SharedPreferences.getInstance();
|
||||||
|
|
||||||
|
context.read<GeneralDescriptionBloc>().add(AddGendesc(
|
||||||
|
id: 1,
|
||||||
|
bldgapprDetailsId: tempID.getInt('tempid')!,
|
||||||
|
assessedById: '1',
|
||||||
|
assessedByName: 'cyril',
|
||||||
|
bldgKind: offlineBldgKey
|
||||||
|
.currentState?.value['bldg_type'].building,
|
||||||
|
strucType: offlineBldgKey
|
||||||
|
.currentState?.value['bldg_type'].bldgType,
|
||||||
|
bldgPermit: offlineBldgKey
|
||||||
|
.currentState?.value['bldg_permit'],
|
||||||
|
dateIssued: offlineBldgKey
|
||||||
|
.currentState!.value['coc_issued']
|
||||||
|
.toString(),
|
||||||
|
cct: offlineBldgKey.currentState?.value['cct'],
|
||||||
|
certCompletionIssued: offlineBldgKey
|
||||||
|
.currentState!.value['coc_issued']
|
||||||
|
.toString(),
|
||||||
|
certOccupancyIssued: offlineBldgKey
|
||||||
|
.currentState!.value['coo_issued']
|
||||||
|
.toString(),
|
||||||
|
dateCompleted: offlineBldgKey
|
||||||
|
.currentState!.value['date_cnstructed']
|
||||||
|
.toString(),
|
||||||
|
dateOccupied: offlineBldgKey
|
||||||
|
.currentState!.value['date_occupied']
|
||||||
|
.toString(),
|
||||||
|
bldgAge: offlineBldgKey.currentState!.value['bldg_age'],
|
||||||
|
noStoreys: offlineBldgKey.currentState!.value['no_of_storeys'],
|
||||||
|
area1Stfloor: '0',
|
||||||
|
area2Ndfloor: '0',
|
||||||
|
area3Rdfloor: '0',
|
||||||
|
area4Thfloor: '0',
|
||||||
|
totalFloorArea: offlineBldgKey.currentState?.value['total_area'],
|
||||||
|
floorSketch: null,
|
||||||
|
actualUse: offlineBldgKey.currentState?.value['actual_use']));
|
||||||
|
}
|
||||||
|
;
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,327 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||||
|
import 'package:fluttertoast/fluttertoast.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/barangay_admin/barangay_admin_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/municipalities_admin/municipalities_admin_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/building/landref/landref_location_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/building/location/location_bloc.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/building/add/add_building.dart';
|
||||||
|
|
||||||
|
import '../../../../../model/passo/barangay.dart';
|
||||||
|
import '../../../../../model/passo/city.dart';
|
||||||
|
import '../../../../../theme-data.dart/form-style.dart';
|
||||||
|
import '../../../../../widgets/passo/custom_button.dart';
|
||||||
|
import '../../../../../widgets/passo/custom_formBuilder_fields.dart';
|
||||||
|
|
||||||
|
class LandRefLocationOfflinePage extends StatefulWidget {
|
||||||
|
final VoidCallback PrevBtn;
|
||||||
|
final VoidCallback NextBtn;
|
||||||
|
|
||||||
|
LandRefLocationOfflinePage(this.PrevBtn, this.NextBtn);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_LandRefLocationOfflinePage createState() => _LandRefLocationOfflinePage();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LandRefLocationOfflinePage extends State<LandRefLocationOfflinePage> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BlocConsumer<MunicipalitiesAdminBloc, MunicipalitiesAdminState>(
|
||||||
|
listener: (context, state) {
|
||||||
|
// TODO: implement listener
|
||||||
|
},
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state is MunicipalitiesLoaded) {
|
||||||
|
final city = state.city;
|
||||||
|
return BlocConsumer<BarangayAdminBloc, BarangayAdminState>(
|
||||||
|
listener: (context, state) {
|
||||||
|
// TODO: implement listener
|
||||||
|
},
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state is BarangayLoaded) {
|
||||||
|
List<Brgy> brgyList = state.brgy;
|
||||||
|
List<String> brgyNAmes = brgyList
|
||||||
|
.map((brgy) => brgy.barangayDescription)
|
||||||
|
.toList()
|
||||||
|
.cast<String>();
|
||||||
|
return SingleChildScrollView(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(20.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(
|
||||||
|
left: 0, top: 20, right: 0, bottom: 10),
|
||||||
|
child: const Text('BUILDING LOCATION',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold, fontSize: 18),
|
||||||
|
textAlign: TextAlign.left),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
height: 45.0,
|
||||||
|
width: double.infinity,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
border: Border.all(
|
||||||
|
color: Colors.grey,
|
||||||
|
width: 1.0,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(5.0),
|
||||||
|
),
|
||||||
|
child: const Align(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
"AGUSAN DEL NORTE",
|
||||||
|
style: TextStyle(fontSize: 15),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderDropdown<City>(
|
||||||
|
name: 'municipality',
|
||||||
|
autofocus: false,
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Municipality", ""),
|
||||||
|
items: city
|
||||||
|
.map((city) => DropdownMenuItem<City>(
|
||||||
|
value: city,
|
||||||
|
child: Text(city
|
||||||
|
.cityDescription!), // Use cityDescription instead of cityName
|
||||||
|
))
|
||||||
|
.toList(),
|
||||||
|
onChanged: (selectedCity) {
|
||||||
|
if (selectedCity != null) {
|
||||||
|
final selectedCityCode =
|
||||||
|
selectedCity.cityCode;
|
||||||
|
final barangayBloc =
|
||||||
|
context.read<BarangayAdminBloc>();
|
||||||
|
barangayBloc.add(LoadBarangayInMunicipality(
|
||||||
|
cityCode:
|
||||||
|
selectedCityCode!)); // Use selectedCityCode directly
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)),
|
||||||
|
]),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"No. / Street", "", 'street'),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child: customDropDownField("Brgy. / District",
|
||||||
|
"", 'brgy', brgyNAmes))
|
||||||
|
]),
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(
|
||||||
|
left: 0, top: 20, right: 0, bottom: 10),
|
||||||
|
child: const Text('LAND REFERENCE',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold, fontSize: 18),
|
||||||
|
textAlign: TextAlign.left),
|
||||||
|
),
|
||||||
|
customTextField("Land Owner", "", 'l_owner'),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"OCT/TCT/CLOA No.", "", 'oct_tct_cloa'),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"Survey No.", "", 'survey_no'))
|
||||||
|
]),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField("Lot No.", "", 'lot_no'),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child:
|
||||||
|
customTextField("Blk No.", "", 'blk_no'))
|
||||||
|
]),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"TD / ARP No.", "", 'l_td_arp'),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField("Area", "", 'area'))
|
||||||
|
]),
|
||||||
|
const SizedBox(
|
||||||
|
height: 50,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: [
|
||||||
|
CustomButton(
|
||||||
|
icon: const Icon(Icons.chevron_left_rounded,
|
||||||
|
color: Colors.white),
|
||||||
|
onPressed: () {
|
||||||
|
{
|
||||||
|
widget.PrevBtn();
|
||||||
|
}
|
||||||
|
;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
// Builder(builder: (context) {
|
||||||
|
// return CustomButton(
|
||||||
|
// icon: const Icon(
|
||||||
|
// Icons.chevron_right_rounded,
|
||||||
|
// color: Colors.white),
|
||||||
|
// onPressed: () async {
|
||||||
|
// {
|
||||||
|
// try {
|
||||||
|
// final progress =
|
||||||
|
// ProgressHUD.of(context);
|
||||||
|
// Future.delayed(Duration(seconds: 3),
|
||||||
|
// () {
|
||||||
|
// progress?.dismiss();
|
||||||
|
// });
|
||||||
|
// final tempID = await SharedPreferences
|
||||||
|
// .getInstance();
|
||||||
|
// var bldgLocData = BldgLoc(
|
||||||
|
// id: tempID.getInt('tempid')! - 1,
|
||||||
|
// street: formKey.currentState
|
||||||
|
// ?.value['street'],
|
||||||
|
// barangay: formKey
|
||||||
|
// .currentState?.value['brgy'],
|
||||||
|
// municipality: formKey
|
||||||
|
// .currentState
|
||||||
|
// ?.value['municipality']
|
||||||
|
// .cityDescription,
|
||||||
|
// province: "Agusan Del Norte");
|
||||||
|
// var landRefData = LandRef(
|
||||||
|
// id: tempID.getInt('tempid')! - 1,
|
||||||
|
// owner: formKey
|
||||||
|
// .currentState?.value['l_owner'],
|
||||||
|
// cloaNo: formKey.currentState
|
||||||
|
// ?.value['oct_tct_cloa'],
|
||||||
|
// lotNo: formKey
|
||||||
|
// .currentState?.value['lot_no'],
|
||||||
|
// tdn: formKey.currentState
|
||||||
|
// ?.value['l_td_arp'],
|
||||||
|
// area: formKey
|
||||||
|
// .currentState?.value['area'],
|
||||||
|
// surveyNo: formKey.currentState
|
||||||
|
// ?.value['survey_no'],
|
||||||
|
// blkNo: formKey
|
||||||
|
// .currentState?.value['blk_no'],
|
||||||
|
// );
|
||||||
|
// context.read<PropertyInfoBloc>()
|
||||||
|
// ..add(UpdateBldgLoc(
|
||||||
|
// bldg_loc: bldgLocData))
|
||||||
|
// ..add(UpdateLandRef(
|
||||||
|
// land_ref: landRefData));
|
||||||
|
// } catch (e) {
|
||||||
|
// Fluttertoast.showToast(
|
||||||
|
// msg:
|
||||||
|
// "Slow internet connection, please try again!");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// ;
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
// })
|
||||||
|
Builder(builder: (context) {
|
||||||
|
return CustomButton(
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.chevron_right_rounded,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
// Rest of your code...
|
||||||
|
final tempID =
|
||||||
|
await SharedPreferences.getInstance();
|
||||||
|
|
||||||
|
print('id check');
|
||||||
|
print(tempID.getInt('tempid')!);
|
||||||
|
|
||||||
|
context.read<LocationBloc>().add(AddLocation(
|
||||||
|
id: 1,
|
||||||
|
bldgapprDetailsId:
|
||||||
|
tempID.getInt('tempid')!,
|
||||||
|
assessedById: 'cyril',
|
||||||
|
assessedByName: 'cyril',
|
||||||
|
street: offlineBldgKey
|
||||||
|
.currentState?.value['street'],
|
||||||
|
barangay: offlineBldgKey
|
||||||
|
.currentState?.value['brgy'],
|
||||||
|
municipality: offlineBldgKey
|
||||||
|
.currentState
|
||||||
|
?.value['municipality']
|
||||||
|
.cityDescription,
|
||||||
|
province: "Agusan Del Norte"));
|
||||||
|
|
||||||
|
context
|
||||||
|
.read<LandrefLocationBloc>()
|
||||||
|
.add(AddLandRef(
|
||||||
|
id: 1,
|
||||||
|
bldgapprDetailsId:
|
||||||
|
tempID.getInt('tempid')!,
|
||||||
|
assessedById: '1',
|
||||||
|
assessedByName: 'cyril',
|
||||||
|
owner: offlineBldgKey
|
||||||
|
.currentState?.value['l_owner'],
|
||||||
|
cloaNo: offlineBldgKey.currentState
|
||||||
|
?.value['oct_tct_cloa'],
|
||||||
|
lotNo: offlineBldgKey
|
||||||
|
.currentState?.value['lot_no'],
|
||||||
|
tdn: offlineBldgKey
|
||||||
|
.currentState?.value['l_td_arp'],
|
||||||
|
area: offlineBldgKey
|
||||||
|
.currentState?.value['area'],
|
||||||
|
surveyNo: offlineBldgKey
|
||||||
|
.currentState?.value['survey_no'],
|
||||||
|
blkNo: offlineBldgKey
|
||||||
|
.currentState?.value['blk_no'],
|
||||||
|
));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
})
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,584 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||||
|
import 'package:form_builder_validators/form_builder_validators.dart';
|
||||||
|
import 'package:searchfield/searchfield.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/memoranda/memoranda_admin_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/signatories/signatories_admin_bloc.dart';
|
||||||
|
|
||||||
|
import '../../../../../model/passo/memoranda.dart';
|
||||||
|
import '../../../../../model/passo/signatories.dart';
|
||||||
|
import '../../../../../theme-data.dart/colors.dart';
|
||||||
|
|
||||||
|
class PropertyAssessmentOfflinePage extends StatefulWidget {
|
||||||
|
Function function;
|
||||||
|
|
||||||
|
PropertyAssessmentOfflinePage(this.function);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_PropertyAssessmentOfflinePage createState() =>
|
||||||
|
_PropertyAssessmentOfflinePage();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PropertyAssessmentOfflinePage
|
||||||
|
extends State<PropertyAssessmentOfflinePage> {
|
||||||
|
double assessment_level = 0;
|
||||||
|
bool isTaxable = false;
|
||||||
|
bool isExempt = false;
|
||||||
|
String _memoranda = '';
|
||||||
|
final focus = FocusNode();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BlocConsumer<MemorandaAdminBloc, MemorandaAdminState>(
|
||||||
|
listener: (context, state) {
|
||||||
|
// TODO: implement listener
|
||||||
|
},
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state is MemorandaLoaded) {
|
||||||
|
final memoranda = state.memo;
|
||||||
|
return BlocConsumer<SignatoriesAdminBloc, SignatoriesAdminState>(
|
||||||
|
listener: (context, state) {
|
||||||
|
// TODO: implement listener
|
||||||
|
},
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state is SignatoriesLoaded) {
|
||||||
|
return Scaffold(
|
||||||
|
body: ListView(children: [
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Container(
|
||||||
|
margin: const EdgeInsets.fromLTRB(0, 20, 0, 20),
|
||||||
|
child: const Text(
|
||||||
|
'PROPERTY ASSESSMENT cont..',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 18,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 3,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
padding: const EdgeInsets.only(left: 20.0, right: 20.0),
|
||||||
|
scrollDirection: Axis.vertical,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const Text('Taxable'),
|
||||||
|
Checkbox(
|
||||||
|
checkColor: Colors.white,
|
||||||
|
value: isTaxable,
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
setState(() {
|
||||||
|
isTaxable = value!;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const Text('Exempt'),
|
||||||
|
Checkbox(
|
||||||
|
checkColor: Colors.white,
|
||||||
|
value: isExempt,
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
setState(() {
|
||||||
|
isExempt = value!;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
const SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
const Text(
|
||||||
|
'EFFECTIVITY OF ASSESSMENT / REASSESSMENT :',
|
||||||
|
style: TextStyle(fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceAround,
|
||||||
|
children: [
|
||||||
|
const Text('Qtr.'),
|
||||||
|
SizedBox(
|
||||||
|
width: 70,
|
||||||
|
height: 25,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
name: 'qtr',
|
||||||
|
validator:
|
||||||
|
FormBuilderValidators.compose([]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 20,
|
||||||
|
),
|
||||||
|
const Text('Yr.'),
|
||||||
|
SizedBox(
|
||||||
|
width: 70,
|
||||||
|
height: 25,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
name: 'yr',
|
||||||
|
validator:
|
||||||
|
FormBuilderValidators.compose([]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
const Align(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: Text(
|
||||||
|
'APPRAISED/ASSESSED BY:',
|
||||||
|
style: TextStyle(fontWeight: FontWeight.bold),
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 200,
|
||||||
|
child: FormBuilderDropdown<Signatories>(
|
||||||
|
name: 'appraised_by',
|
||||||
|
autofocus: false,
|
||||||
|
items: state.signatories
|
||||||
|
.map((signatories) =>
|
||||||
|
DropdownMenuItem(
|
||||||
|
value: signatories,
|
||||||
|
child: Text(
|
||||||
|
'${signatories.firstname} ${signatories.middlename} ${signatories.lastname}'),
|
||||||
|
))
|
||||||
|
.toList()),
|
||||||
|
),
|
||||||
|
const Text('Name'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 15,
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 100,
|
||||||
|
child: FormBuilderDateTimePicker(
|
||||||
|
name: 'app_date',
|
||||||
|
initialEntryMode:
|
||||||
|
DatePickerEntryMode.calendarOnly,
|
||||||
|
initialValue: DateTime.now(),
|
||||||
|
inputType: InputType.date,
|
||||||
|
|
||||||
|
initialTime:
|
||||||
|
const TimeOfDay(hour: 8, minute: 0),
|
||||||
|
// locale: const Locale.fromSubtags(languageCode: 'fr'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Text('Date'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
const Align(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: Text(
|
||||||
|
'RECOMMENDING APPROVAL:',
|
||||||
|
style: TextStyle(fontWeight: FontWeight.bold),
|
||||||
|
)),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 200,
|
||||||
|
child: FormBuilderDropdown<Signatories>(
|
||||||
|
name: 'rec_approval',
|
||||||
|
autofocus: false,
|
||||||
|
items: state.signatories
|
||||||
|
.map((signatories) =>
|
||||||
|
DropdownMenuItem(
|
||||||
|
value: signatories,
|
||||||
|
child: Text(
|
||||||
|
'${signatories.firstname} ${signatories.middlename} ${signatories.lastname}'),
|
||||||
|
))
|
||||||
|
.toList()),
|
||||||
|
),
|
||||||
|
const Text('Name'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 15,
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 100,
|
||||||
|
child: FormBuilderDateTimePicker(
|
||||||
|
name: 'rec_date',
|
||||||
|
initialEntryMode:
|
||||||
|
DatePickerEntryMode.calendarOnly,
|
||||||
|
initialValue: DateTime.now(),
|
||||||
|
inputType: InputType.date,
|
||||||
|
|
||||||
|
initialTime:
|
||||||
|
const TimeOfDay(hour: 8, minute: 0),
|
||||||
|
// locale: const Locale.fromSubtags(languageCode: 'fr'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Text('Date'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
const Align(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: Text(
|
||||||
|
'APPROVED BY:',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 200,
|
||||||
|
child: FormBuilderDropdown<Signatories>(
|
||||||
|
name: 'apprvd_by',
|
||||||
|
autofocus: false,
|
||||||
|
items: state.signatories
|
||||||
|
.map((signatories) =>
|
||||||
|
DropdownMenuItem(
|
||||||
|
value: signatories,
|
||||||
|
child: Text(
|
||||||
|
'${signatories.firstname} ${signatories.middlename} ${signatories.lastname}'),
|
||||||
|
))
|
||||||
|
.toList()),
|
||||||
|
),
|
||||||
|
const Text('Name'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 50,
|
||||||
|
),
|
||||||
|
const Align(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: Text(
|
||||||
|
'MEMORANDA: ',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
const SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 500,
|
||||||
|
height: 100,
|
||||||
|
child: SearchField(
|
||||||
|
itemHeight: 70,
|
||||||
|
suggestions: memoranda
|
||||||
|
.map((Memoranda memoranda) =>
|
||||||
|
SearchFieldListItem(
|
||||||
|
'${memoranda.memoranda}',
|
||||||
|
item:
|
||||||
|
memoranda, // Change: Use individual Memoranda object
|
||||||
|
child: ListTile(
|
||||||
|
title: Text(
|
||||||
|
'${memoranda.memoranda}',
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
))
|
||||||
|
.toList(),
|
||||||
|
validator: FormBuilderValidators.required(
|
||||||
|
errorText: "This field is required"),
|
||||||
|
// searchInputDecoration:
|
||||||
|
// normalTextFieldStyle(
|
||||||
|
// "Memoranda", "")
|
||||||
|
// .copyWith(
|
||||||
|
// suffixIcon: const Icon(
|
||||||
|
// Icons.arrow_drop_down),
|
||||||
|
// ),
|
||||||
|
// focusNode: focus,
|
||||||
|
suggestionState: Suggestion.expand,
|
||||||
|
onSuggestionTap: (memoranda) {
|
||||||
|
setState(() {
|
||||||
|
_memoranda = memoranda.item!.memoranda!;
|
||||||
|
});
|
||||||
|
focus.unfocus();
|
||||||
|
},
|
||||||
|
)),
|
||||||
|
const SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
const Text('Sworn Statement No. :'),
|
||||||
|
SizedBox(
|
||||||
|
width: 150,
|
||||||
|
height: 20,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
name: 'sworn_statement',
|
||||||
|
decoration: const InputDecoration(),
|
||||||
|
validator:
|
||||||
|
FormBuilderValidators.compose([]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
const Text('Date Received:'),
|
||||||
|
SizedBox(
|
||||||
|
width: 150,
|
||||||
|
height: 20,
|
||||||
|
child: FormBuilderDateTimePicker(
|
||||||
|
name: 'date_received',
|
||||||
|
initialEntryMode:
|
||||||
|
DatePickerEntryMode.calendarOnly,
|
||||||
|
initialValue: DateTime.now(),
|
||||||
|
inputType: InputType.date,
|
||||||
|
|
||||||
|
initialTime:
|
||||||
|
const TimeOfDay(hour: 8, minute: 0),
|
||||||
|
// locale: const Locale.fromSubtags(languageCode: 'fr'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
const Text(
|
||||||
|
'Date of Entry in the Rec. of Ass. :'),
|
||||||
|
SizedBox(
|
||||||
|
width: 100,
|
||||||
|
height: 20,
|
||||||
|
child: FormBuilderDateTimePicker(
|
||||||
|
name: 'date_of_entry',
|
||||||
|
initialEntryMode:
|
||||||
|
DatePickerEntryMode.calendarOnly,
|
||||||
|
initialValue: DateTime.now(),
|
||||||
|
inputType: InputType.date,
|
||||||
|
|
||||||
|
initialTime:
|
||||||
|
const TimeOfDay(hour: 8, minute: 0),
|
||||||
|
// locale: const Locale.fromSubtags(languageCode: 'fr'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
const Text('By:'),
|
||||||
|
SizedBox(
|
||||||
|
width: 150,
|
||||||
|
height: 20,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
name: 'by',
|
||||||
|
decoration: const InputDecoration(),
|
||||||
|
validator:
|
||||||
|
FormBuilderValidators.compose([]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () async {
|
||||||
|
// final tempID =
|
||||||
|
// await SharedPreferences.getInstance();
|
||||||
|
// print(tempID.getInt('tempid')! - 1);
|
||||||
|
// final List<PropertyAssessment>
|
||||||
|
// propertyAssessments = [];
|
||||||
|
|
||||||
|
// PropertyAssessment ass =
|
||||||
|
// PropertyAssessment(
|
||||||
|
// id: 1,
|
||||||
|
// bldgapprDetailsId:
|
||||||
|
// tempID.getInt('tempid')! - 1,
|
||||||
|
// actualUse: formKey.currentState!
|
||||||
|
// .value['actual_use'] ??
|
||||||
|
// '', // Replace null with an empty string
|
||||||
|
// marketValue: '0.00',
|
||||||
|
// assessmentLevel: '0.00',
|
||||||
|
// assessedValue: '0.00',
|
||||||
|
// taxable: isTaxable,
|
||||||
|
// exempt: isExempt,
|
||||||
|
// qtr: int.parse(formKey
|
||||||
|
// .currentState!.value['qtr'] ??
|
||||||
|
// '0'), // Replace null with '0'
|
||||||
|
// yr: int.parse(
|
||||||
|
// formKey.currentState!.value['yr'] ??
|
||||||
|
// '0'), // Replace null with '0'
|
||||||
|
// appraisedbyName: (formKey
|
||||||
|
// .currentState!
|
||||||
|
// .value['appraised_by']
|
||||||
|
// ?.firstname ??
|
||||||
|
// '') +
|
||||||
|
// ' ' +
|
||||||
|
// (formKey
|
||||||
|
// .currentState!
|
||||||
|
// .value['appraised_by']
|
||||||
|
// ?.middlename ??
|
||||||
|
// '') +
|
||||||
|
// ' ' +
|
||||||
|
// (formKey
|
||||||
|
// .currentState!
|
||||||
|
// .value['appraised_by']
|
||||||
|
// ?.lastname ??
|
||||||
|
// ''),
|
||||||
|
// appraisedbyDate: formKey.currentState!
|
||||||
|
// .value['app_date']
|
||||||
|
// as DateTime? ??
|
||||||
|
// DateTime
|
||||||
|
// .now(), // Replace null with current date
|
||||||
|
// recommendapprName: (formKey
|
||||||
|
// .currentState!
|
||||||
|
// .value['rec_approval']
|
||||||
|
// ?.firstname ??
|
||||||
|
// '') +
|
||||||
|
// ' ' +
|
||||||
|
// (formKey
|
||||||
|
// .currentState!
|
||||||
|
// .value['rec_approval']
|
||||||
|
// ?.middlename ??
|
||||||
|
// '') +
|
||||||
|
// ' ' +
|
||||||
|
// (formKey
|
||||||
|
// .currentState!
|
||||||
|
// .value['rec_approval']
|
||||||
|
// ?.lastname ??
|
||||||
|
// ''),
|
||||||
|
// recommendapprDate: formKey.currentState!
|
||||||
|
// .value['rec_date']
|
||||||
|
// as DateTime? ??
|
||||||
|
// DateTime
|
||||||
|
// .now(), // Replace null with current date
|
||||||
|
// approvedbyName: (formKey
|
||||||
|
// .currentState!
|
||||||
|
// .value['apprvd_by']
|
||||||
|
// ?.firstname ??
|
||||||
|
// '') +
|
||||||
|
// ' ' +
|
||||||
|
// (formKey
|
||||||
|
// .currentState!
|
||||||
|
// .value['apprvd_by']
|
||||||
|
// ?.middlename ??
|
||||||
|
// '') +
|
||||||
|
// ' ' +
|
||||||
|
// (formKey
|
||||||
|
// .currentState!
|
||||||
|
// .value['apprvd_by']
|
||||||
|
// ?.lastname ??
|
||||||
|
// ''),
|
||||||
|
// memoranda: _memoranda,
|
||||||
|
// swornstatementNo: formKey.currentState!
|
||||||
|
// .value['sworn_statement'] ??
|
||||||
|
// '', // Replace null with an empty string
|
||||||
|
// dateReceived: formKey.currentState!
|
||||||
|
// .value['date_received']
|
||||||
|
// as DateTime? ??
|
||||||
|
// DateTime
|
||||||
|
// .now(), // Replace null with current date
|
||||||
|
// entryDateAssessment: formKey
|
||||||
|
// .currentState!
|
||||||
|
// .value['date_of_entry']
|
||||||
|
// as DateTime? ??
|
||||||
|
// DateTime
|
||||||
|
// .now(), // Replace null with current date
|
||||||
|
// entryDateBy: formKey
|
||||||
|
// .currentState!.value['by'] ??
|
||||||
|
// '', // Replace null with an empty string
|
||||||
|
// );
|
||||||
|
|
||||||
|
// propertyAssessments.add(ass);
|
||||||
|
|
||||||
|
// context
|
||||||
|
// .read<PropertyAssessmentBloc>()
|
||||||
|
// .add(UpdatePropertyAssessment(
|
||||||
|
// assessment:
|
||||||
|
// propertyAssessments[0]));
|
||||||
|
// widget.function();
|
||||||
|
},
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: primary,
|
||||||
|
foregroundColor: Colors.red),
|
||||||
|
child: const SizedBox(
|
||||||
|
width: 200,
|
||||||
|
height: 50,
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
'Save',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
))
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,143 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/building/add/add_building.dart';
|
||||||
|
import 'package:unit2/widgets/passo/custom_button.dart';
|
||||||
|
import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart';
|
||||||
|
|
||||||
|
import '../../../../../bloc/offline/offline_passo/building/owner_info_bloc/crud_bloc.dart';
|
||||||
|
|
||||||
|
class PropertyInfoOfflinePage extends StatefulWidget {
|
||||||
|
final VoidCallback handleButtonPress;
|
||||||
|
const PropertyInfoOfflinePage(this.handleButtonPress, {super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_PropertyInfoPage createState() => _PropertyInfoPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PropertyInfoPage extends State<PropertyInfoOfflinePage> {
|
||||||
|
int tempId = 0;
|
||||||
|
final transaction_codes = ['New', 'Revision'];
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SingleChildScrollView(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(20.0),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(
|
||||||
|
left: 0, top: 20, right: 0, bottom: 10),
|
||||||
|
child: const Text('PROPERTY OWNER INFO',
|
||||||
|
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18),
|
||||||
|
textAlign: TextAlign.left),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
customDropDownField("Transaction Code", "", "transaction_code",
|
||||||
|
transaction_codes),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField("ARP No. / TD No.", "", 'arp_td')),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField("Pin", "", 'pin')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
customTextField("Owner", "", 'owner'),
|
||||||
|
customTextField("Address", "", 'address'),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField("Tel No.", "", 'tel_no'),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField("TIN", "", 'tin'))
|
||||||
|
]),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"Administrator / Benificial User", "", 'benificiary'),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField("TIN", "", 'benificiary_tin'))
|
||||||
|
]),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child:
|
||||||
|
customTextField("Address", "", 'benificiary_address'),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child:
|
||||||
|
customTextField("Tel No.", "", 'benificiary_telno'))
|
||||||
|
]),
|
||||||
|
const SizedBox(height: 25),
|
||||||
|
CustomButton(
|
||||||
|
icon: const Icon(Icons.chevron_right, color: Colors.white),
|
||||||
|
onPressed: () async {
|
||||||
|
final tempID = await SharedPreferences.getInstance();
|
||||||
|
// Dispatch the event to add the property_info
|
||||||
|
context.read<CrudBloc>().add(
|
||||||
|
AddTodo(
|
||||||
|
id: '1',
|
||||||
|
transCode: offlineBldgKey
|
||||||
|
.currentState!.value['transaction_code']
|
||||||
|
?.toString() ??
|
||||||
|
'',
|
||||||
|
tdn: offlineBldgKey.currentState!.value['arp_td'] ??
|
||||||
|
'',
|
||||||
|
pin:
|
||||||
|
offlineBldgKey.currentState!.value['pin'] ?? '',
|
||||||
|
owner: offlineBldgKey.currentState!.value['owner'] ??
|
||||||
|
'',
|
||||||
|
address:
|
||||||
|
offlineBldgKey.currentState!.value['address'] ??
|
||||||
|
'',
|
||||||
|
telno: offlineBldgKey.currentState!.value['tel_no'] ??
|
||||||
|
'',
|
||||||
|
tin:
|
||||||
|
offlineBldgKey.currentState!.value['tin'] ?? '',
|
||||||
|
adminUser: offlineBldgKey
|
||||||
|
.currentState!.value['benificiary'] ??
|
||||||
|
'',
|
||||||
|
adminAddress: offlineBldgKey.currentState!
|
||||||
|
.value['benificiary_address'] ??
|
||||||
|
'',
|
||||||
|
adminTin: offlineBldgKey.currentState!.value['benificiary_tin'] ?? '',
|
||||||
|
adminTelno: offlineBldgKey.currentState!.value['benificiary_telno'] ?? '',
|
||||||
|
faasType: "BUILDING",
|
||||||
|
assessedById: '1',
|
||||||
|
assessedByName: 'Cyril'),
|
||||||
|
);
|
||||||
|
widget.handleButtonPress();
|
||||||
|
},
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,431 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:fluttertoast/fluttertoast.dart';
|
||||||
|
import 'package:multiselect/multiselect.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/building/structural_materials_offline.dart/structural_material_offline_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart';
|
||||||
|
import 'package:unit2/model/passo/structural_materials_ii.dart';
|
||||||
|
import 'package:unit2/screens/passo/Building/add_building.dart';
|
||||||
|
import 'package:unit2/widgets/passo/custom_button.dart';
|
||||||
|
import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart';
|
||||||
|
|
||||||
|
class MaterialOption {
|
||||||
|
final String id;
|
||||||
|
final String label;
|
||||||
|
|
||||||
|
MaterialOption(this.id, this.label);
|
||||||
|
}
|
||||||
|
|
||||||
|
class StructuralMaterialsOfflinePage extends StatefulWidget {
|
||||||
|
final VoidCallback NextBtn;
|
||||||
|
final VoidCallback PrevBtn;
|
||||||
|
|
||||||
|
StructuralMaterialsOfflinePage(this.NextBtn, this.PrevBtn);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_StructuralMaterialsOfflinePage createState() =>
|
||||||
|
_StructuralMaterialsOfflinePage();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _StructuralMaterialsOfflinePage
|
||||||
|
extends State<StructuralMaterialsOfflinePage> {
|
||||||
|
List<String> foundation = [];
|
||||||
|
List<String> column = [];
|
||||||
|
List<String> beam = [];
|
||||||
|
List<String> truss_framing = [];
|
||||||
|
List<String> roof = [];
|
||||||
|
List<String> flooring = [];
|
||||||
|
List<String> walls = [];
|
||||||
|
bool foundationOthers = false;
|
||||||
|
bool columOthers = false;
|
||||||
|
bool beamsOthers = false;
|
||||||
|
bool tfOthers = false;
|
||||||
|
bool roofOthers = false;
|
||||||
|
bool flooringOthers = false;
|
||||||
|
bool wpOthers = false;
|
||||||
|
|
||||||
|
List<MaterialOption> columnOptions = [
|
||||||
|
MaterialOption('steel', 'Steel'),
|
||||||
|
MaterialOption('concrete', 'Reinforced Concrete'),
|
||||||
|
MaterialOption('wood', 'Wood'),
|
||||||
|
];
|
||||||
|
|
||||||
|
List<String> selectedColumnValues = [];
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return StatefulBuilder(builder: (context, structuralState) {
|
||||||
|
return SingleChildScrollView(
|
||||||
|
padding: const EdgeInsets.all(30.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
margin:
|
||||||
|
const EdgeInsets.only(left: 0, top: 20, right: 0, bottom: 10),
|
||||||
|
child: const Text('STRUCTURAL MATERIALS',
|
||||||
|
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18),
|
||||||
|
textAlign: TextAlign.left),
|
||||||
|
),
|
||||||
|
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||||
|
Text(
|
||||||
|
'FOUNDATION',
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const Text('Others'),
|
||||||
|
Checkbox(
|
||||||
|
checkColor: Colors.white,
|
||||||
|
value: foundationOthers,
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
structuralState(() {
|
||||||
|
foundationOthers = value!;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
|
child: Visibility(
|
||||||
|
visible: foundationOthers,
|
||||||
|
child: customTextField(
|
||||||
|
"Enter other foundation", "", "other_foundation"),
|
||||||
|
replacement: DropDownMultiSelect(
|
||||||
|
selected_values_style: TextStyle(color: Colors.black),
|
||||||
|
onChanged: (List<String> x) {
|
||||||
|
structuralState(() {
|
||||||
|
foundation = x;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
options: const ['Reinforced Concrete', 'Plain Concrete'],
|
||||||
|
selectedValues: foundation,
|
||||||
|
whenEmpty: 'Select Foundations',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||||
|
Text(
|
||||||
|
'COLUMNS',
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const Text('Others'),
|
||||||
|
Checkbox(
|
||||||
|
checkColor: Colors.white,
|
||||||
|
value: columOthers,
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
structuralState(() {
|
||||||
|
columOthers = value!;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
|
child: Visibility(
|
||||||
|
visible: columOthers,
|
||||||
|
child:
|
||||||
|
customTextField("Enter other columns", "", "other_column"),
|
||||||
|
replacement: DropDownMultiSelect(
|
||||||
|
selected_values_style: TextStyle(color: Colors.black),
|
||||||
|
onChanged: (List<String> x) {
|
||||||
|
structuralState(() {
|
||||||
|
column = x;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
options: const ['Steel', 'Reinforced Concrete', 'Wood'],
|
||||||
|
selectedValues: column,
|
||||||
|
whenEmpty: 'Select Column/s',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||||
|
Text(
|
||||||
|
'BEAMS',
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const Text('Others'),
|
||||||
|
Checkbox(
|
||||||
|
checkColor: Colors.white,
|
||||||
|
value: beamsOthers,
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
structuralState(() {
|
||||||
|
beamsOthers = value!;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
|
child: Visibility(
|
||||||
|
visible: beamsOthers,
|
||||||
|
child: customTextField("Enter other beam/s", "", "other_beam"),
|
||||||
|
replacement: DropDownMultiSelect(
|
||||||
|
selected_values_style: TextStyle(color: Colors.black),
|
||||||
|
onChanged: (List<String> x) {
|
||||||
|
structuralState(() {
|
||||||
|
beam = x;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
options: const ['Steel', 'Reinforced Concrete', 'Wood'],
|
||||||
|
selectedValues: beam,
|
||||||
|
whenEmpty: 'Select Beam/s',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||||
|
Text(
|
||||||
|
'TRUSS FRAMING',
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const Text('Others'),
|
||||||
|
Checkbox(
|
||||||
|
checkColor: Colors.white,
|
||||||
|
value: tfOthers,
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
structuralState(() {
|
||||||
|
tfOthers = value!;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
|
child: Visibility(
|
||||||
|
visible: tfOthers,
|
||||||
|
child: customTextField(
|
||||||
|
"Enter other truss framing/s", "", "other_tf"),
|
||||||
|
replacement: DropDownMultiSelect(
|
||||||
|
selected_values_style: TextStyle(color: Colors.black),
|
||||||
|
onChanged: (List<String> x) {
|
||||||
|
structuralState(() {
|
||||||
|
truss_framing = x;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
options: const ['Steel', 'Wood'],
|
||||||
|
selectedValues: truss_framing,
|
||||||
|
whenEmpty: 'Select Truss Framing/s',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||||
|
Text(
|
||||||
|
'ROOF',
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const Text('Others'),
|
||||||
|
Checkbox(
|
||||||
|
checkColor: Colors.white,
|
||||||
|
value: roofOthers,
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
structuralState(() {
|
||||||
|
roofOthers = value!;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
|
child: Visibility(
|
||||||
|
visible: roofOthers,
|
||||||
|
child: customTextField("Enter other roof/s", "", "other_roof"),
|
||||||
|
replacement: DropDownMultiSelect(
|
||||||
|
selected_values_style: TextStyle(color: Colors.black),
|
||||||
|
onChanged: (List<String> x) {
|
||||||
|
structuralState(() {
|
||||||
|
roof = x;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
options: const [
|
||||||
|
'Reinforced Concrete',
|
||||||
|
'Tiles',
|
||||||
|
'G.I Sheet',
|
||||||
|
'Aluminum',
|
||||||
|
'Asbestos',
|
||||||
|
'Long Span',
|
||||||
|
'Concrete Desk',
|
||||||
|
'Nipa/Anahaw/Cogon'
|
||||||
|
],
|
||||||
|
selectedValues: roof,
|
||||||
|
whenEmpty: 'Select Roof/s',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||||
|
Text(
|
||||||
|
'FLOORING',
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const Text('Others'),
|
||||||
|
Checkbox(
|
||||||
|
checkColor: Colors.white,
|
||||||
|
value: flooringOthers,
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
structuralState(() {
|
||||||
|
flooringOthers = value!;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
|
child: Visibility(
|
||||||
|
visible: flooringOthers,
|
||||||
|
child: customTextField(
|
||||||
|
"Enter other flooring/s", "", "other_flooring"),
|
||||||
|
replacement: DropDownMultiSelect(
|
||||||
|
selected_values_style: TextStyle(color: Colors.black),
|
||||||
|
onChanged: (List<String> x) {
|
||||||
|
structuralState(() {
|
||||||
|
flooring = x;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
options: const [
|
||||||
|
'Reinforced Concrete',
|
||||||
|
'Plain Cement',
|
||||||
|
'Marble',
|
||||||
|
'Wood',
|
||||||
|
'Tiles'
|
||||||
|
],
|
||||||
|
selectedValues: flooring,
|
||||||
|
whenEmpty: 'Select Flooring/s',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||||
|
Text(
|
||||||
|
'WALLS & PARTITIONS',
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const Text('Others'),
|
||||||
|
Checkbox(
|
||||||
|
checkColor: Colors.white,
|
||||||
|
value: wpOthers,
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
structuralState(() {
|
||||||
|
wpOthers = value!;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
|
child: Visibility(
|
||||||
|
visible: wpOthers,
|
||||||
|
child: customTextField(
|
||||||
|
"Enter other walls & partition/s", "", "other_wp"),
|
||||||
|
replacement: DropDownMultiSelect(
|
||||||
|
selected_values_style: TextStyle(color: Colors.black),
|
||||||
|
onChanged: (List<String> x) {
|
||||||
|
setState(() {
|
||||||
|
walls = x;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
options: const [
|
||||||
|
'Reinforced Concrete',
|
||||||
|
'Plain Concrete',
|
||||||
|
'Wood',
|
||||||
|
'CHIB',
|
||||||
|
'G.I Sheet',
|
||||||
|
'Build-a-wall',
|
||||||
|
'Sawali',
|
||||||
|
'Bamboo'
|
||||||
|
],
|
||||||
|
selectedValues: walls,
|
||||||
|
whenEmpty: 'Select Walls & Partition/s',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: [
|
||||||
|
CustomButton(
|
||||||
|
icon: const Icon(Icons.chevron_left_rounded,
|
||||||
|
color: Colors.white),
|
||||||
|
onPressed: () {
|
||||||
|
{
|
||||||
|
widget.PrevBtn();
|
||||||
|
}
|
||||||
|
;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
CustomButton(
|
||||||
|
icon: const Icon(Icons.chevron_right_rounded,
|
||||||
|
color: Colors.white),
|
||||||
|
onPressed: () async {
|
||||||
|
{
|
||||||
|
final tempID = await SharedPreferences.getInstance();
|
||||||
|
|
||||||
|
context.read<StructuralMaterialOfflineBloc>().add(
|
||||||
|
AddStructuralMaterial(
|
||||||
|
id: 1,
|
||||||
|
bldgapprDetailsId: tempID.getInt('tempid')! - 1,
|
||||||
|
foundation: foundationOthers
|
||||||
|
? formKey
|
||||||
|
.currentState!.value['other_foundation']
|
||||||
|
.split(',')
|
||||||
|
: foundation,
|
||||||
|
columns: columOthers
|
||||||
|
? formKey.currentState!.value['other_column']
|
||||||
|
.split(',')
|
||||||
|
: column,
|
||||||
|
beams: beamsOthers
|
||||||
|
? formKey.currentState!.value['other_beam']
|
||||||
|
.split(',')
|
||||||
|
: beam,
|
||||||
|
trussFraming: tfOthers
|
||||||
|
? formKey.currentState!.value['other_tf']
|
||||||
|
.split(',')
|
||||||
|
: truss_framing,
|
||||||
|
roof: roofOthers
|
||||||
|
? formKey.currentState!.value['other_roof']
|
||||||
|
.split(',')
|
||||||
|
: roof,
|
||||||
|
flooring: flooringOthers
|
||||||
|
? formKey
|
||||||
|
.currentState!.value['other_flooring']
|
||||||
|
.split(',')
|
||||||
|
: flooring,
|
||||||
|
walls: wpOthers
|
||||||
|
? formKey.currentState!.value['other_wp']
|
||||||
|
.split(',')
|
||||||
|
: walls,
|
||||||
|
others: ["Others"]));
|
||||||
|
}
|
||||||
|
;
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,596 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||||
|
import 'package:form_builder_validators/form_builder_validators.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:searchfield/searchfield.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/building/additional_items_offline/additional_items_offline_bloc.dart';
|
||||||
|
|
||||||
|
import '../../../../../model/passo/additional_items.dart';
|
||||||
|
import '../../../../../model/passo/class_components.dart';
|
||||||
|
import '../../../../../model/passo/unit_construct.dart';
|
||||||
|
import '../../../../../theme-data.dart/form-style.dart';
|
||||||
|
|
||||||
|
class AddExtraItemsEditOffline extends StatefulWidget {
|
||||||
|
final List<UnitConstruct> unit;
|
||||||
|
final List<ClassComponents> options;
|
||||||
|
final int tempId;
|
||||||
|
|
||||||
|
AddExtraItemsEditOffline(this.unit, this.options, this.tempId);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_AddExtraItemsEditOffline createState() => _AddExtraItemsEditOffline();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AddExtraItemsEditOffline extends State<AddExtraItemsEditOffline> {
|
||||||
|
GlobalKey<FormBuilderState> formKey = GlobalKey<FormBuilderState>();
|
||||||
|
final focus = FocusNode();
|
||||||
|
double _computedValue = 0;
|
||||||
|
bool isPainted = false;
|
||||||
|
bool isSecondHand = false;
|
||||||
|
TextEditingController textEditingController = TextEditingController();
|
||||||
|
double _unitBase = 0;
|
||||||
|
int _areaValue = 0;
|
||||||
|
double _depValue = 0;
|
||||||
|
double _unitValue = 0;
|
||||||
|
double _marketValue = 0;
|
||||||
|
String _className = "";
|
||||||
|
int _classId = 0;
|
||||||
|
String _structureType = "";
|
||||||
|
bool _withoutBUCC = false;
|
||||||
|
int _notPaintedUnitVal = 0;
|
||||||
|
int _secondHandUnitVal = 0;
|
||||||
|
|
||||||
|
BoxDecoration box1() {
|
||||||
|
return const BoxDecoration(boxShadow: [
|
||||||
|
BoxShadow(color: Colors.black12, spreadRadius: 5, blurRadius: 5)
|
||||||
|
], color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(3)));
|
||||||
|
}
|
||||||
|
|
||||||
|
double _computeValue(double unitbase, double unitvalue, double area) {
|
||||||
|
// Compute some value based on the text here
|
||||||
|
return (unitbase * unitvalue) * area;
|
||||||
|
}
|
||||||
|
|
||||||
|
double _amountofDepreciation(unitVal, unitBase, area, depreciation) {
|
||||||
|
return ((unitVal * unitBase) * area) * depreciation;
|
||||||
|
}
|
||||||
|
|
||||||
|
double _adjustedMarketValue(unitVal, unitBase, area, depreciation) {
|
||||||
|
double depAmount = ((unitVal * unitBase) * area) * depreciation;
|
||||||
|
|
||||||
|
return ((unitVal * unitBase) * area) - depAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
double _totalMarketValue(unitVal, unitBase, area, depreciation, withBUCC,
|
||||||
|
className, painted, secondHand, paintedUnitVal, secondhandUntVal) {
|
||||||
|
if (withBUCC == false) {
|
||||||
|
if (painted == true || secondHand == true) {
|
||||||
|
final deductions = (paintedUnitVal + secondhandUntVal) / 100;
|
||||||
|
|
||||||
|
print(deductions);
|
||||||
|
return (((unitVal - deductions) * unitBase) * area);
|
||||||
|
} else {
|
||||||
|
return ((unitVal * unitBase) * area);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return (unitVal * area);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BlocBuilder<AdditionalItemsOfflineBloc, AdditionalItemsOfflineState>(
|
||||||
|
buildWhen: (previous, current) {
|
||||||
|
return false;
|
||||||
|
}, builder: (context, state) {
|
||||||
|
if (state is ShowAddItemsScreen) {
|
||||||
|
return FormBuilder(
|
||||||
|
key: formKey,
|
||||||
|
onChanged: () {
|
||||||
|
formKey.currentState?.save();
|
||||||
|
},
|
||||||
|
autovalidateMode: AutovalidateMode.disabled,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Container(
|
||||||
|
height: 800,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(
|
||||||
|
left: 0, top: 10, right: 0, bottom: 0),
|
||||||
|
child: FormBuilderDropdown(
|
||||||
|
name: 'extra_item',
|
||||||
|
autofocus: false,
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle("Additional Item", ""),
|
||||||
|
items: widget.options
|
||||||
|
.map((e) => DropdownMenuItem(
|
||||||
|
value: e,
|
||||||
|
child: Text(e.componentName),
|
||||||
|
))
|
||||||
|
.toList(),
|
||||||
|
onChanged: (value) {
|
||||||
|
if (value!.minBaseUnitvalPercent != '0.00') {
|
||||||
|
setState(() {
|
||||||
|
_unitValue =
|
||||||
|
double.parse(value.minBaseUnitvalPercent);
|
||||||
|
_className = value.componentName;
|
||||||
|
_classId = value.id;
|
||||||
|
_withoutBUCC = value.withoutBucc;
|
||||||
|
});
|
||||||
|
formKey.currentState!.patchValue(
|
||||||
|
{'unitValue': value.minBaseUnitvalPercent});
|
||||||
|
}
|
||||||
|
if (value.maxBaseUnitvalPercent != '0.00') {
|
||||||
|
setState(() {
|
||||||
|
_unitValue =
|
||||||
|
double.parse(value.maxBaseUnitvalPercent);
|
||||||
|
_className = value.componentName;
|
||||||
|
_classId = value.id;
|
||||||
|
_withoutBUCC = value.withoutBucc;
|
||||||
|
});
|
||||||
|
formKey.currentState!.patchValue(
|
||||||
|
{'unitValue': value.maxBaseUnitvalPercent});
|
||||||
|
}
|
||||||
|
if (value.minUnitvalSqrmtr != '0.00') {
|
||||||
|
setState(() {
|
||||||
|
_unitValue =
|
||||||
|
double.parse(value.minUnitvalSqrmtr);
|
||||||
|
_className = value.componentName;
|
||||||
|
_classId = value.id;
|
||||||
|
_withoutBUCC = value.withoutBucc;
|
||||||
|
});
|
||||||
|
formKey.currentState!.patchValue(
|
||||||
|
{'unitValue': value.minUnitvalSqrmtr});
|
||||||
|
}
|
||||||
|
if (value.maxUnitvalSqrmtr != '0.00') {
|
||||||
|
setState(() {
|
||||||
|
_unitValue =
|
||||||
|
double.parse(value.maxUnitvalSqrmtr);
|
||||||
|
_className = value.componentName;
|
||||||
|
_classId = value.id;
|
||||||
|
_withoutBUCC = value.withoutBucc;
|
||||||
|
});
|
||||||
|
formKey.currentState!.patchValue(
|
||||||
|
{'unitValue': value.maxUnitvalSqrmtr});
|
||||||
|
}
|
||||||
|
if (value.minAddBaseunitval != '0.00') {
|
||||||
|
setState(() {
|
||||||
|
_unitValue =
|
||||||
|
double.parse(value.minAddBaseunitval);
|
||||||
|
_className = value.componentName;
|
||||||
|
_classId = value.id;
|
||||||
|
_withoutBUCC = value.withoutBucc;
|
||||||
|
});
|
||||||
|
formKey.currentState!.patchValue(
|
||||||
|
{'unitValue': value.minAddBaseunitval});
|
||||||
|
}
|
||||||
|
if (value.maxAddBaseunitval != '0.00') {
|
||||||
|
setState(() {
|
||||||
|
_unitValue =
|
||||||
|
double.parse(value.maxAddBaseunitval);
|
||||||
|
_className = value.componentName;
|
||||||
|
_classId = value.id;
|
||||||
|
_withoutBUCC = value.withoutBucc;
|
||||||
|
});
|
||||||
|
formKey.currentState!.patchValue(
|
||||||
|
{'unitValue': value.maxAddBaseunitval});
|
||||||
|
}
|
||||||
|
if (value.minDeductBaserate != '0.00') {
|
||||||
|
setState(() {
|
||||||
|
_unitValue =
|
||||||
|
double.parse(value.minDeductBaserate);
|
||||||
|
_className = value.componentName;
|
||||||
|
_classId = value.id;
|
||||||
|
_withoutBUCC = value.withoutBucc;
|
||||||
|
});
|
||||||
|
formKey.currentState!.patchValue(
|
||||||
|
{'unitValue': value.minDeductBaserate});
|
||||||
|
}
|
||||||
|
if (value.maxDeductBaserate != '0.00') {
|
||||||
|
setState(() {
|
||||||
|
_unitValue =
|
||||||
|
double.parse(value.maxDeductBaserate);
|
||||||
|
_className = value.componentName;
|
||||||
|
_classId = value.id;
|
||||||
|
_withoutBUCC = value.withoutBucc;
|
||||||
|
});
|
||||||
|
formKey.currentState!.patchValue(
|
||||||
|
{'unitValue': value.maxDeductBaserate});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(
|
||||||
|
left: 0, top: 10, right: 0, bottom: 0),
|
||||||
|
child: SizedBox(
|
||||||
|
height: 45,
|
||||||
|
child: SearchField(
|
||||||
|
itemHeight: 70,
|
||||||
|
suggestions: widget.unit
|
||||||
|
.map((UnitConstruct unit) =>
|
||||||
|
SearchFieldListItem(
|
||||||
|
unit.bldgType! +
|
||||||
|
' - ' +
|
||||||
|
unit.building,
|
||||||
|
item: unit,
|
||||||
|
child: ListTile(
|
||||||
|
title: Text(
|
||||||
|
unit.bldgType +
|
||||||
|
' - ' +
|
||||||
|
unit.building!.toUpperCase(),
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
)))
|
||||||
|
.toList(),
|
||||||
|
|
||||||
|
validator: FormBuilderValidators.required(
|
||||||
|
errorText: "This field is required"),
|
||||||
|
|
||||||
|
searchInputDecoration: normalTextFieldStyle(
|
||||||
|
"Structure Type", "")
|
||||||
|
.copyWith(
|
||||||
|
suffixIcon:
|
||||||
|
const Icon(Icons.arrow_drop_down)),
|
||||||
|
////agency suggestion tap
|
||||||
|
focusNode: focus,
|
||||||
|
suggestionState: Suggestion.expand,
|
||||||
|
onSuggestionTap: (unit) {
|
||||||
|
setState(() {
|
||||||
|
_unitBase =
|
||||||
|
double.parse(unit.item!.unitValue);
|
||||||
|
_structureType = unit.item!.bldgType +
|
||||||
|
' - ' +
|
||||||
|
unit.item!.building;
|
||||||
|
});
|
||||||
|
focus.unfocus();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// const SizedBox(height: 10),
|
||||||
|
// Container(
|
||||||
|
// margin: const EdgeInsets.only(
|
||||||
|
// left: 0, top: 10, right: 0, bottom: 0),
|
||||||
|
// child: FormBuilderDropdown(
|
||||||
|
// name: 'struc_type',
|
||||||
|
// autofocus: false,
|
||||||
|
// decoration:
|
||||||
|
// normalTextFieldStyle("Structure Type", ""),
|
||||||
|
// items: widget.unit
|
||||||
|
// .map((e) => DropdownMenuItem(
|
||||||
|
// value: e,
|
||||||
|
// child:
|
||||||
|
// Text(e.bldgType + " - " + e.building),
|
||||||
|
// ))
|
||||||
|
// .toList(),
|
||||||
|
// onChanged: (val) {
|
||||||
|
// setState(() {
|
||||||
|
// _unitBase = double.parse(val!.unitValue);
|
||||||
|
// _structureType = val.bldgType;
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
name: 'unitValue',
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle("Unit Value", ""),
|
||||||
|
validator: FormBuilderValidators.compose([]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
name: 'areaValue',
|
||||||
|
decoration: normalTextFieldStyle("Area", ""),
|
||||||
|
validator: FormBuilderValidators.compose([]),
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
_areaValue = int.parse(value!);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
// const SizedBox(height: 10),
|
||||||
|
// FormBuilderTextField(
|
||||||
|
// name: 'depRate',
|
||||||
|
// decoration:
|
||||||
|
// normalTextFieldStyle("Depreciation Rate", ""),
|
||||||
|
// validator: FormBuilderValidators.compose([]),
|
||||||
|
// onChanged: (value) {
|
||||||
|
// setState(() {
|
||||||
|
// _depValue = double.parse(value!);
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// const SizedBox(height: 10),
|
||||||
|
// FormBuilderTextField(
|
||||||
|
// name: 'marketValue',
|
||||||
|
// decoration: normalTextFieldStyle(
|
||||||
|
// NumberFormat.currency(
|
||||||
|
// locale: 'en-PH', symbol: "₱")
|
||||||
|
// .format(_totalMarketValue(_unitValue,
|
||||||
|
// _unitBase, _areaValue, _depValue)),
|
||||||
|
// ""),
|
||||||
|
// validator: FormBuilderValidators.compose([]),
|
||||||
|
// onChanged: (value) {
|
||||||
|
// setState(() {
|
||||||
|
// _marketValue = double.parse(value!);
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// const SizedBox(height: 10),
|
||||||
|
// Text('Amount of Depreciation'),
|
||||||
|
// const SizedBox(height: 5),
|
||||||
|
// Container(
|
||||||
|
// height: 45.0,
|
||||||
|
// width: double.infinity,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// color: Colors.white,
|
||||||
|
// border: Border.all(
|
||||||
|
// color: Colors.grey,
|
||||||
|
// width: 1.0,
|
||||||
|
// ),
|
||||||
|
// borderRadius: BorderRadius.circular(5.0),
|
||||||
|
// ),
|
||||||
|
// child: Align(
|
||||||
|
// alignment: Alignment.center,
|
||||||
|
// child: Text(NumberFormat.currency(
|
||||||
|
// locale: 'en-PH', symbol: "₱")
|
||||||
|
// .format(_amountofDepreciation(_unitValue,
|
||||||
|
// _unitBase, _areaValue, _depValue)))),
|
||||||
|
// ),
|
||||||
|
|
||||||
|
Visibility(
|
||||||
|
visible: !_withoutBUCC,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Text('Building is not painted?'),
|
||||||
|
const SizedBox(height: 5),
|
||||||
|
Container(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Checkbox(
|
||||||
|
value: isPainted,
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
setState(() {
|
||||||
|
isPainted = value!;
|
||||||
|
if (value == false) {
|
||||||
|
_notPaintedUnitVal = 0;
|
||||||
|
} else {
|
||||||
|
_notPaintedUnitVal = 10;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
Container(
|
||||||
|
height: 40.0,
|
||||||
|
width: 100,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
border: Border.all(
|
||||||
|
color: Colors.grey,
|
||||||
|
width: 1.0,
|
||||||
|
),
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(5.0),
|
||||||
|
),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(' - ' +
|
||||||
|
_notPaintedUnitVal.toString() +
|
||||||
|
'%')),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Text('Uses second hand materials?'),
|
||||||
|
const SizedBox(height: 5),
|
||||||
|
Container(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Checkbox(
|
||||||
|
value: isSecondHand,
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
setState(() {
|
||||||
|
isSecondHand = value!;
|
||||||
|
if (isSecondHand == false) {
|
||||||
|
_secondHandUnitVal = 0;
|
||||||
|
formKey.currentState!.patchValue(
|
||||||
|
{'secondHandMat': '0'});
|
||||||
|
} else {
|
||||||
|
_secondHandUnitVal = 5;
|
||||||
|
formKey.currentState!.patchValue(
|
||||||
|
{'secondHandMat': '5'});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 40,
|
||||||
|
width: 100,
|
||||||
|
child: FormBuilderTextField(
|
||||||
|
enabled: isSecondHand,
|
||||||
|
name: 'secondHandMat',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
"Unit Value", ""),
|
||||||
|
validator:
|
||||||
|
FormBuilderValidators.compose(
|
||||||
|
[]),
|
||||||
|
onChanged: (value) {
|
||||||
|
// Check if the value is not null before parsing to double
|
||||||
|
if (value != null &&
|
||||||
|
value.isNotEmpty) {
|
||||||
|
setState(() {
|
||||||
|
_secondHandUnitVal =
|
||||||
|
int.parse(value);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Handle the case when the value is empty or null
|
||||||
|
// For example, set _secondHandUnitVal to a default value or show an error message.
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 40,
|
||||||
|
width: 40,
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
'%',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Text('Market Value'),
|
||||||
|
const SizedBox(height: 5),
|
||||||
|
Container(
|
||||||
|
height: 45.0,
|
||||||
|
width: double.infinity,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
border: Border.all(
|
||||||
|
color: Colors.grey,
|
||||||
|
width: 1.0,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(5.0),
|
||||||
|
),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(NumberFormat.currency(
|
||||||
|
locale: 'en-PH', symbol: "₱")
|
||||||
|
.format(_totalMarketValue(
|
||||||
|
_unitValue,
|
||||||
|
_unitBase,
|
||||||
|
_areaValue,
|
||||||
|
_depValue,
|
||||||
|
_withoutBUCC,
|
||||||
|
_className,
|
||||||
|
isPainted,
|
||||||
|
isSecondHand,
|
||||||
|
_notPaintedUnitVal,
|
||||||
|
_secondHandUnitVal)))),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 120,
|
||||||
|
height: 60,
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
context
|
||||||
|
.read<AdditionalItemsOfflineBloc>()
|
||||||
|
.add(AddAdditionalItems(
|
||||||
|
id: 1,
|
||||||
|
bldgapprDetailsId: widget.tempId,
|
||||||
|
classId: _classId,
|
||||||
|
className: _className,
|
||||||
|
structType: _structureType,
|
||||||
|
unitValue: _withoutBUCC == true
|
||||||
|
? 0
|
||||||
|
: _unitValue,
|
||||||
|
baseUnitValue: _unitBase,
|
||||||
|
area: _areaValue,
|
||||||
|
marketValue:
|
||||||
|
(_unitValue * _unitBase) *
|
||||||
|
_areaValue,
|
||||||
|
depreciationRate: _depValue,
|
||||||
|
adjustedMarketVal: _totalMarketValue(
|
||||||
|
_unitValue,
|
||||||
|
_unitBase,
|
||||||
|
_areaValue,
|
||||||
|
_depValue,
|
||||||
|
_withoutBUCC,
|
||||||
|
_className,
|
||||||
|
isPainted,
|
||||||
|
isSecondHand,
|
||||||
|
_notPaintedUnitVal,
|
||||||
|
_secondHandUnitVal),
|
||||||
|
actualUse: 'Test',
|
||||||
|
amtDepreciation:
|
||||||
|
_amountofDepreciation(
|
||||||
|
_unitValue,
|
||||||
|
_unitBase,
|
||||||
|
_areaValue,
|
||||||
|
_depValue,
|
||||||
|
),
|
||||||
|
painted: true,
|
||||||
|
secondhand: true,
|
||||||
|
paintedUnitval: '1',
|
||||||
|
secondhandUnitval: '1'));
|
||||||
|
},
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
primary: Colors.black,
|
||||||
|
),
|
||||||
|
child: const Text("Submit"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width:
|
||||||
|
5), // Use SizedBox for horizontal spacing in a Row
|
||||||
|
Container(
|
||||||
|
width: 120,
|
||||||
|
height: 60,
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
context
|
||||||
|
.read<AdditionalItemsOfflineBloc>()
|
||||||
|
.add(LoadAdditionalItems());
|
||||||
|
},
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
primary: Colors.black,
|
||||||
|
),
|
||||||
|
child: const Text("Cancel"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
return Container();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,318 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||||
|
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||||
|
import 'package:unit2/model/passo/class_components%20_offline.dart';
|
||||||
|
|
||||||
|
import '../../../../../bloc/offline/offline_passo/building/additional_items_offline/additional_items_offline_bloc.dart';
|
||||||
|
import '../../../../../model/passo/additional_items.dart';
|
||||||
|
import '../../../../../model/passo/class_components.dart';
|
||||||
|
import '../../../../../model/passo/unit_construct.dart';
|
||||||
|
import '../../../../../utils/alerts.dart';
|
||||||
|
import '../../../../../widgets/passo/custom_button.dart';
|
||||||
|
import '../../../../passo/Building/edit_building/AddExtraItems.dart';
|
||||||
|
|
||||||
|
class AdditionalItemEditPageOffline extends StatefulWidget {
|
||||||
|
final List<UnitConstruct> unit;
|
||||||
|
final List<ClassComponentsOffline> options;
|
||||||
|
final int tempId;
|
||||||
|
final VoidCallback NextBtn;
|
||||||
|
final VoidCallback PrevBtn;
|
||||||
|
|
||||||
|
AdditionalItemEditPageOffline(
|
||||||
|
this.unit, this.options, this.tempId, this.NextBtn, this.PrevBtn);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_AdditionalItemEditPageOffline createState() =>
|
||||||
|
_AdditionalItemEditPageOffline();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AdditionalItemEditPageOffline
|
||||||
|
extends State<AdditionalItemEditPageOffline> {
|
||||||
|
void deleteItem(int itemId) {
|
||||||
|
context
|
||||||
|
.read<AdditionalItemsOfflineBloc>()
|
||||||
|
.add(DeleteAdditionalItems(id: itemId));
|
||||||
|
}
|
||||||
|
|
||||||
|
// double _totalMarketValue(items) {
|
||||||
|
// double total = 0;
|
||||||
|
// items.forEach((row) {
|
||||||
|
// total += double.parse(row.adjustedMarketVal);
|
||||||
|
// });
|
||||||
|
// return total;
|
||||||
|
// }
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
body: ProgressHUD(
|
||||||
|
padding: const EdgeInsets.all(24),
|
||||||
|
backgroundColor: Colors.black87,
|
||||||
|
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||||
|
child: BlocConsumer<AdditionalItemsOfflineBloc,
|
||||||
|
AdditionalItemsOfflineState>(
|
||||||
|
listener: (context, state) {},
|
||||||
|
builder: (context, state) {
|
||||||
|
final state = context.watch<AdditionalItemsOfflineBloc>().state;
|
||||||
|
if (state is AdditionalItemsLoaded) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
height: 500,
|
||||||
|
child: Expanded(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(15.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(
|
||||||
|
left: 0, top: 20, right: 0, bottom: 10),
|
||||||
|
child: const Text('ADDITIONAL ITEMS',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 18),
|
||||||
|
textAlign: TextAlign.left),
|
||||||
|
),
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.topRight,
|
||||||
|
child: ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: Colors.red,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
context
|
||||||
|
.read<AdditionalItemsOfflineBloc>()
|
||||||
|
.add(ShowAdditionalItems());
|
||||||
|
},
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
const Text('ADD ITEM'), // <-- Text
|
||||||
|
const SizedBox(
|
||||||
|
width: 5,
|
||||||
|
),
|
||||||
|
const Icon(
|
||||||
|
// <-- Icon
|
||||||
|
Icons.add,
|
||||||
|
size: 24.0,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
child: DataTable(
|
||||||
|
// ignore: prefer_const_literals_to_create_immutables
|
||||||
|
columns: [
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('Items'),
|
||||||
|
),
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('Unit Value'),
|
||||||
|
),
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('% of BUCC'),
|
||||||
|
),
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('Market Value'),
|
||||||
|
),
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('Action'),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
rows: state.addItem.map((dataRow) {
|
||||||
|
return DataRow(
|
||||||
|
cells: [
|
||||||
|
DataCell(Text(dataRow.className)),
|
||||||
|
DataCell(Text(dataRow.baseUnitValue)),
|
||||||
|
DataCell(Text(dataRow.unitValue)),
|
||||||
|
DataCell(Text(((double.parse(
|
||||||
|
dataRow.adjustedMarketVal)))
|
||||||
|
.toString())),
|
||||||
|
DataCell(Row(
|
||||||
|
children: [
|
||||||
|
InkWell(
|
||||||
|
child: Container(
|
||||||
|
height: 30,
|
||||||
|
width: 30,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.delete,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 20.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
deleteItem(dataRow.id);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
child: Container(
|
||||||
|
height: 30,
|
||||||
|
width: 30,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.edit,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 20.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () {},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
))
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Padding(
|
||||||
|
// padding: const EdgeInsets.only(left: 20.0, right: 20.0),
|
||||||
|
// child: Row(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
// children: [
|
||||||
|
// Text(
|
||||||
|
// 'Total',
|
||||||
|
// style:
|
||||||
|
// TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
|
||||||
|
// ),
|
||||||
|
// Text(
|
||||||
|
// NumberFormat.currency(locale: 'en-PH', symbol: "₱")
|
||||||
|
// .format(_totalMarketValue(state.items)),
|
||||||
|
// style:
|
||||||
|
// TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
|
||||||
|
// )
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(15.0),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: [
|
||||||
|
CustomButton(
|
||||||
|
icon: const Icon(Icons.chevron_left_rounded,
|
||||||
|
color: Colors.white),
|
||||||
|
onPressed: () {
|
||||||
|
{
|
||||||
|
widget.PrevBtn();
|
||||||
|
}
|
||||||
|
;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
CustomButton(
|
||||||
|
icon: const Icon(Icons.chevron_right_rounded,
|
||||||
|
color: Colors.white),
|
||||||
|
onPressed: () {
|
||||||
|
{
|
||||||
|
widget.NextBtn();
|
||||||
|
}
|
||||||
|
;
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (state is AdditionalItemsDeletedState) {
|
||||||
|
if (state.success) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
successAlert(context, "Deletion Successful",
|
||||||
|
"Extra item has been deleted successfully", () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
context.read<AdditionalItemsOfflineBloc>().add(
|
||||||
|
LoadAdditionalItemsEdit(
|
||||||
|
items: const <AdditionalItems>[],
|
||||||
|
id: widget.tempId));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (state is ShowAddItemsScreen) {
|
||||||
|
return ConstrainedBox(
|
||||||
|
constraints: BoxConstraints(maxHeight: 1000.0),
|
||||||
|
child: AlertDialog(
|
||||||
|
insetPadding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 20.0,
|
||||||
|
vertical: 10.0,
|
||||||
|
),
|
||||||
|
title: Text(
|
||||||
|
'ADD EXTRA ITEMS',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
content: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: AddExtraItemsEdit(
|
||||||
|
widget.unit, widget.options, widget.tempId))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Container(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(
|
||||||
|
left: 0, top: 20, right: 0, bottom: 10),
|
||||||
|
child: const Text('ADDITIONAL MATERIALS',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold, fontSize: 18),
|
||||||
|
textAlign: TextAlign.left),
|
||||||
|
),
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.topRight,
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
context
|
||||||
|
.read<AdditionalItemsOfflineBloc>()
|
||||||
|
.add(ShowAdditionalItems());
|
||||||
|
},
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
const Text('ADD ITEM'), // <-- Text
|
||||||
|
const SizedBox(
|
||||||
|
width: 5,
|
||||||
|
),
|
||||||
|
const Icon(
|
||||||
|
// <-- Icon
|
||||||
|
Icons.add,
|
||||||
|
size: 24.0,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,152 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||||
|
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||||
|
import 'package:im_stepper/stepper.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/class_components_admin.dart/class_components_admin_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/unit_construction/unit_construction_admin_bloc.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/building/edit/additional_items_edit.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/building/edit/general_description_edit.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/building/edit/landref_location_edit.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/building/edit/property_owner_info_edit.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/building/edit/structural_materials_edit.dart';
|
||||||
|
|
||||||
|
import '../../../../../model/passo/property_info.dart';
|
||||||
|
import '../../../../../theme-data.dart/colors.dart';
|
||||||
|
|
||||||
|
class EditBuildingOffline extends StatefulWidget {
|
||||||
|
final int index;
|
||||||
|
final PropertyInfo faas;
|
||||||
|
final String title;
|
||||||
|
|
||||||
|
const EditBuildingOffline(
|
||||||
|
{super.key,
|
||||||
|
required this.title,
|
||||||
|
required this.index,
|
||||||
|
required this.faas});
|
||||||
|
@override
|
||||||
|
_EditBuildingOffline createState() => _EditBuildingOffline();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _EditBuildingOffline extends State<EditBuildingOffline> {
|
||||||
|
// THE FOLLOWING TWO VARIABLES ARE REQUIRED TO CONTROL THE STEPPER.
|
||||||
|
int activeStep = 0; // Initial step set to 5.
|
||||||
|
|
||||||
|
int upperBound = 6; // upperBound MUST BE total number of icons minus 1.
|
||||||
|
|
||||||
|
void PrevBtn() {
|
||||||
|
setState(() {
|
||||||
|
activeStep--;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void NextBtn() {
|
||||||
|
setState(() {
|
||||||
|
activeStep++;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
centerTitle: true,
|
||||||
|
backgroundColor: primary,
|
||||||
|
title: Text('Building FAAS Edit'),
|
||||||
|
),
|
||||||
|
body: ProgressHUD(
|
||||||
|
padding: const EdgeInsets.all(24),
|
||||||
|
backgroundColor: Colors.black87,
|
||||||
|
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||||
|
child: BlocConsumer<UnitConstructionAdminBloc,
|
||||||
|
UnitConstructionAdminState>(
|
||||||
|
listener: (context, state) {
|
||||||
|
// TODO: implement listener
|
||||||
|
},
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state is UnitConstructLoaded) {
|
||||||
|
final unit = state.unit;
|
||||||
|
return BlocConsumer<ClassComponentsAdminBloc,
|
||||||
|
ClassComponentsAdminState>(
|
||||||
|
listener: (context, state) {
|
||||||
|
// TODO: implement listener
|
||||||
|
},
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state is ClassComponentsAdminLoaded) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
NumberStepper(
|
||||||
|
numbers: [1, 2, 3, 4, 5, 6, 7],
|
||||||
|
activeStepColor: primary,
|
||||||
|
numberStyle: TextStyle(color: Colors.white),
|
||||||
|
lineColor: primary,
|
||||||
|
// activeStep property set to activeStep variable defined above.
|
||||||
|
activeStep: activeStep,
|
||||||
|
activeStepBorderColor: Colors.white,
|
||||||
|
activeStepBorderWidth: 1,
|
||||||
|
// This ensures step-tapping updates the activeStep.
|
||||||
|
onStepReached: (index) {
|
||||||
|
setState(() {
|
||||||
|
activeStep = index;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: StatefulBuilder(builder:
|
||||||
|
(BuildContext context, StateSetter setState) {
|
||||||
|
return Container(
|
||||||
|
child: content(
|
||||||
|
PrevBtn, NextBtn, unit, state.classes),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns the header text based on the activeStep.
|
||||||
|
Widget content(PrevBtn, NextBtn, unit, classes) {
|
||||||
|
switch (activeStep) {
|
||||||
|
case 0:
|
||||||
|
return PropertyOwnerInfoEditOffline(
|
||||||
|
widget.index,
|
||||||
|
widget.faas,
|
||||||
|
'EDit',
|
||||||
|
PrevBtn,
|
||||||
|
NextBtn,
|
||||||
|
);
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
return BldgLocLandRefEditOffline(widget.faas.id!, NextBtn, PrevBtn);
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
return GeneralDescriptionEditOffline(NextBtn, PrevBtn);
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
return StructuralMaterialsPageEditOffline(NextBtn, PrevBtn);
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
return AdditionalItemEditPageOffline(
|
||||||
|
unit, classes, widget.faas.id!, NextBtn, PrevBtn);
|
||||||
|
|
||||||
|
// case 5:
|
||||||
|
// return PropertyAppraisalEditPage(widget.faas.id!, NextBtn, PrevBtn);
|
||||||
|
|
||||||
|
// case 6:
|
||||||
|
// return PropertyAssessmentEditPage(widget.faas.id!);
|
||||||
|
|
||||||
|
default:
|
||||||
|
return Container();
|
||||||
|
// return PropertyOwnerInfoEdit(
|
||||||
|
// widget.index, widget.faas, widget.title, NextBtn, PrevBtn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,381 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||||
|
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||||
|
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/unit_construction/unit_construction_admin_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/building/general_description/general_description_bloc.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/building/edit/property_owner_info_edit.dart';
|
||||||
|
|
||||||
|
import '../../../../../model/passo/general_description.dart';
|
||||||
|
import '../../../../../model/passo/unit_construct.dart';
|
||||||
|
import '../../../../../theme-data.dart/form-style.dart';
|
||||||
|
import '../../../../../widgets/passo/custom_button.dart';
|
||||||
|
import '../../../../../widgets/passo/custom_formBuilder_fields.dart';
|
||||||
|
|
||||||
|
class GeneralDescriptionEditOffline extends StatefulWidget {
|
||||||
|
final VoidCallback NextBtn;
|
||||||
|
final VoidCallback PrevBtn;
|
||||||
|
|
||||||
|
GeneralDescriptionEditOffline(this.NextBtn, this.PrevBtn);
|
||||||
|
@override
|
||||||
|
_GeneralDescriptionEditOffline createState() =>
|
||||||
|
_GeneralDescriptionEditOffline();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _GeneralDescriptionEditOffline
|
||||||
|
extends State<GeneralDescriptionEditOffline> {
|
||||||
|
final actual_use = [
|
||||||
|
"Residential",
|
||||||
|
"Agricultural",
|
||||||
|
"Commercial",
|
||||||
|
"Industrial",
|
||||||
|
"Mineral",
|
||||||
|
"Timberland",
|
||||||
|
];
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
body: Column(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: ProgressHUD(
|
||||||
|
padding: const EdgeInsets.all(24),
|
||||||
|
backgroundColor: Colors.black87,
|
||||||
|
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||||
|
child:
|
||||||
|
BlocConsumer<GeneralDescriptionBloc, GeneralDescriptionState>(
|
||||||
|
listener: (context, state) async {
|
||||||
|
// if (state is GenDescLoading) {
|
||||||
|
// final progress = ProgressHUD.of(context);
|
||||||
|
// progress!.showWithText("Please wait...");
|
||||||
|
// }
|
||||||
|
// if (state is GenDescLoaded) {
|
||||||
|
// final progress = ProgressHUD.of(context);
|
||||||
|
// progress?.dismiss();
|
||||||
|
|
||||||
|
// final tempID = await SharedPreferences.getInstance();
|
||||||
|
// await tempID.setInt(
|
||||||
|
// 'totalValue', int.parse(state.gendesc.totalFloorArea!));
|
||||||
|
// await tempID.setString(
|
||||||
|
// 'actualUse', state.gendesc.actualUse!);
|
||||||
|
|
||||||
|
// }
|
||||||
|
// if (state is GenDescErrorState) {
|
||||||
|
// final progress = ProgressHUD.of(context);
|
||||||
|
// progress?.dismiss();
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state is SpecificGeneralDescriptionLoaded) {
|
||||||
|
final gendesc = state.gendesc;
|
||||||
|
return BlocConsumer<UnitConstructionAdminBloc,
|
||||||
|
UnitConstructionAdminState>(
|
||||||
|
listener: (context, state) {
|
||||||
|
// TODO: implement listener
|
||||||
|
},
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state is UnitConstructLoaded) {
|
||||||
|
return FormBuilder(
|
||||||
|
key: offlineBldgEditKey,
|
||||||
|
initialValue: {
|
||||||
|
'bldg_permit': gendesc.bldgPermit,
|
||||||
|
'date_issued': gendesc.dateIssued.toString(),
|
||||||
|
'cct': gendesc.cct.toString(),
|
||||||
|
'coc_issued':
|
||||||
|
gendesc.certCompletionIssued.toString(),
|
||||||
|
'coo_issued':
|
||||||
|
gendesc.certOccupancyIssued.toString(),
|
||||||
|
'date_cnstructed': gendesc.dateIssued.toString(),
|
||||||
|
'date_occupied': gendesc.dateOccupied.toString(),
|
||||||
|
'bldg_age': gendesc.bldgAge.toString(),
|
||||||
|
'no_of_storeys': gendesc.noStoreys.toString(),
|
||||||
|
'area_of_1stFl': gendesc.area1Stfloor,
|
||||||
|
'area_of_2ndFl': gendesc.area2Ndfloor,
|
||||||
|
'area_of_3rdFl': gendesc.area3Rdfloor,
|
||||||
|
'area_of_4thFl': gendesc.area4Thfloor,
|
||||||
|
'total_area': gendesc.totalFloorArea.toString(),
|
||||||
|
'actual_use': gendesc.actualUse
|
||||||
|
},
|
||||||
|
enabled: true,
|
||||||
|
onChanged: () {
|
||||||
|
offlineBldgEditKey.currentState!.save();
|
||||||
|
debugPrint(offlineBldgEditKey.currentState!.value
|
||||||
|
.toString());
|
||||||
|
},
|
||||||
|
autovalidateMode: AutovalidateMode.disabled,
|
||||||
|
skipDisabled: true,
|
||||||
|
child: Expanded(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.vertical,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(20.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(
|
||||||
|
left: 0,
|
||||||
|
top: 20,
|
||||||
|
right: 0,
|
||||||
|
bottom: 10),
|
||||||
|
child: const Text('GENERAL DESCRIPTION',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 18),
|
||||||
|
textAlign: TextAlign.left),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(
|
||||||
|
left: 0,
|
||||||
|
top: 10,
|
||||||
|
right: 0,
|
||||||
|
bottom: 0),
|
||||||
|
child: FormBuilderDropdown(
|
||||||
|
name: 'bldg_type',
|
||||||
|
autofocus: false,
|
||||||
|
decoration: normalTextFieldStyle(
|
||||||
|
gendesc.bldgKind ??
|
||||||
|
"Kind of Building",
|
||||||
|
"Kind of Building"),
|
||||||
|
items: state.unit
|
||||||
|
.map((e) => DropdownMenuItem(
|
||||||
|
value: e,
|
||||||
|
child: Text(e.bldgType +
|
||||||
|
'-' +
|
||||||
|
e.building),
|
||||||
|
))
|
||||||
|
.toList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
customDropDownField("Actual Use", "",
|
||||||
|
'actual_use', actual_use),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"Bldg. Permit No.",
|
||||||
|
"",
|
||||||
|
'bldg_permit'),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child: customDatTimePicker(
|
||||||
|
"Certificate of Occupancy Issued ON",
|
||||||
|
"",
|
||||||
|
'date_issued'))
|
||||||
|
]),
|
||||||
|
customTextField(
|
||||||
|
"Condominium Certificate of Title (CCT)",
|
||||||
|
"",
|
||||||
|
'cct'),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: customDatTimePicker(
|
||||||
|
"Certificate of Completion Issued ON",
|
||||||
|
"",
|
||||||
|
'coc_issued'),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child: customDatTimePicker(
|
||||||
|
"Certificate of Occupancy Issued ON",
|
||||||
|
"",
|
||||||
|
'coo_issued'))
|
||||||
|
]),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: customDatTimePicker(
|
||||||
|
"Date Constructed /Completed",
|
||||||
|
"",
|
||||||
|
'date_cnstructed'),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child: customDatTimePicker(
|
||||||
|
"Date Occupied",
|
||||||
|
"",
|
||||||
|
'date_occupied'))
|
||||||
|
]),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"Bldg. Age", "", 'bldg_age'),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"No. of storeys",
|
||||||
|
"",
|
||||||
|
'no_of_storeys'))
|
||||||
|
]),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"Area of 1st Floor",
|
||||||
|
"",
|
||||||
|
'area_of_1stFl'),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"Area of 2nd Floor",
|
||||||
|
"",
|
||||||
|
'area_of_2ndFl'))
|
||||||
|
]),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"Area of 3rd Floor",
|
||||||
|
"",
|
||||||
|
'area_of_3rdFl')),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"Area of 4th Floor",
|
||||||
|
"",
|
||||||
|
'area_of_4thFl'))
|
||||||
|
]),
|
||||||
|
customTextField(
|
||||||
|
"Total Area", "", 'total_area'),
|
||||||
|
SizedBox(
|
||||||
|
height: 50,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceEvenly,
|
||||||
|
children: [
|
||||||
|
CustomButton(
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.chevron_left_rounded,
|
||||||
|
color: Colors.white),
|
||||||
|
onPressed: () {
|
||||||
|
{
|
||||||
|
widget.PrevBtn();
|
||||||
|
}
|
||||||
|
;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
CustomButton(
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.chevron_right_rounded,
|
||||||
|
color: Colors.white),
|
||||||
|
onPressed: () {
|
||||||
|
{
|
||||||
|
offlineBldgEditKey.currentState!
|
||||||
|
.save();
|
||||||
|
|
||||||
|
context.read<GeneralDescriptionBloc>().add(AddGendesc(
|
||||||
|
id: 1,
|
||||||
|
bldgapprDetailsId: 1,
|
||||||
|
assessedById: "1",
|
||||||
|
assessedByName: 'hhs',
|
||||||
|
bldgKind: offlineBldgEditKey
|
||||||
|
.currentState
|
||||||
|
?.value['bldg_type']
|
||||||
|
?.building ??
|
||||||
|
gendesc.bldgKind,
|
||||||
|
strucType: offlineBldgEditKey
|
||||||
|
.currentState
|
||||||
|
?.value['bldg_type']
|
||||||
|
?.bldgType ??
|
||||||
|
gendesc.strucType,
|
||||||
|
bldgPermit: offlineBldgEditKey
|
||||||
|
.currentState
|
||||||
|
?.value['bldg_permit'],
|
||||||
|
dateIssued: offlineBldgEditKey
|
||||||
|
.currentState
|
||||||
|
?.value['coc_issued'],
|
||||||
|
cct: offlineBldgEditKey
|
||||||
|
.currentState
|
||||||
|
?.value['cct'],
|
||||||
|
certCompletionIssued: offlineBldgEditKey
|
||||||
|
.currentState
|
||||||
|
?.value['coc_issued'],
|
||||||
|
certOccupancyIssued: offlineBldgEditKey
|
||||||
|
.currentState
|
||||||
|
?.value['coo_issued'],
|
||||||
|
dateCompleted: offlineBldgEditKey.currentState?.value['date_cnstructed'],
|
||||||
|
dateOccupied: offlineBldgEditKey.currentState?.value['date_occupied'],
|
||||||
|
bldgAge: offlineBldgEditKey.currentState?.value['bldg_age']!,
|
||||||
|
noStoreys: offlineBldgEditKey.currentState?.value['no_of_storeys']!,
|
||||||
|
area1Stfloor: offlineBldgEditKey.currentState?.value['area_of_1stFl'],
|
||||||
|
area2Ndfloor: offlineBldgEditKey.currentState?.value['area_of_2ndFl'],
|
||||||
|
area3Rdfloor: offlineBldgEditKey.currentState?.value['area_of_3rdFl'],
|
||||||
|
area4Thfloor: offlineBldgEditKey.currentState?.value['area_of_4thFl'],
|
||||||
|
totalFloorArea: offlineBldgEditKey.currentState?.value['total_area'],
|
||||||
|
floorSketch: null,
|
||||||
|
actualUse: offlineBldgEditKey.currentState?.value['actual_use']));
|
||||||
|
|
||||||
|
widget.NextBtn();
|
||||||
|
}
|
||||||
|
;
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// if (state is GenDescErrorState) {
|
||||||
|
// return SomethingWentWrong(
|
||||||
|
// message: onError,
|
||||||
|
// onpressed: () {
|
||||||
|
// context.read<GeneralDescriptionBloc>().add(LoadGenDesc(
|
||||||
|
// id: widget.tempId, gendesc: GeneralDesc()));
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,442 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||||
|
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||||
|
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/barangay_admin/barangay_admin_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/municipalities_admin/municipalities_admin_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/building/landref/landref_location_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/building/location/location_bloc.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/building/edit/property_owner_info_edit.dart';
|
||||||
|
import 'package:unit2/theme-data.dart/form-style.dart';
|
||||||
|
|
||||||
|
import '../../../../../model/passo/barangay.dart';
|
||||||
|
import '../../../../../model/passo/bldg_loc.dart';
|
||||||
|
import '../../../../../model/passo/city.dart';
|
||||||
|
import '../../../../../widgets/passo/custom_button.dart';
|
||||||
|
import '../../../../../widgets/passo/custom_formBuilder_fields.dart';
|
||||||
|
|
||||||
|
class BldgLocLandRefEditOffline extends StatefulWidget {
|
||||||
|
final int tempId;
|
||||||
|
final VoidCallback NextBtn;
|
||||||
|
final VoidCallback PrevBtn;
|
||||||
|
|
||||||
|
BldgLocLandRefEditOffline(this.tempId, this.NextBtn, this.PrevBtn);
|
||||||
|
@override
|
||||||
|
_BldgLocLandRefEditOffline createState() => _BldgLocLandRefEditOffline();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _BldgLocLandRefEditOffline extends State<BldgLocLandRefEditOffline> {
|
||||||
|
Set<String> seenCityCodes = Set<String>();
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
body: ProgressHUD(
|
||||||
|
padding: const EdgeInsets.all(24),
|
||||||
|
backgroundColor: Colors.black87,
|
||||||
|
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||||
|
child: BlocConsumer<LocationBloc, LocationState>(
|
||||||
|
listener: (context, state) {
|
||||||
|
// if (state is LocationLoading) {
|
||||||
|
// final progress = ProgressHUD.of(context);
|
||||||
|
// progress!.showWithText("Please wait...");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (state is LocationErrorState) {
|
||||||
|
// final progress = ProgressHUD.of(context);
|
||||||
|
// progress?.dismiss();
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state is SpecificLocationLoaded) {
|
||||||
|
final bldgloc = state.location;
|
||||||
|
return BlocConsumer<LandrefLocationBloc, LandrefLocationState>(
|
||||||
|
listener: (context, state) {
|
||||||
|
// if (state is LandrefLoading) {
|
||||||
|
// final progress = ProgressHUD.of(context);
|
||||||
|
// progress!.showWithText("Please wait...");
|
||||||
|
// }
|
||||||
|
// if (state is LandrefErrorState) {
|
||||||
|
// final progress = ProgressHUD.of(context);
|
||||||
|
// progress?.dismiss();
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state is SpecificLandrefLoaded) {
|
||||||
|
final landRef = state.landref;
|
||||||
|
return BlocConsumer<MunicipalitiesAdminBloc,
|
||||||
|
MunicipalitiesAdminState>(listener: (context, state) {
|
||||||
|
// if (state is MunicipalityLoading) {
|
||||||
|
// final progress = ProgressHUD.of(context);
|
||||||
|
// progress!.showWithText("Please wait...");
|
||||||
|
// }
|
||||||
|
// if (state is MunicipalityErrorState) {
|
||||||
|
// final progress = ProgressHUD.of(context);
|
||||||
|
// progress?.dismiss();
|
||||||
|
// }
|
||||||
|
}, builder: (context, state) {
|
||||||
|
if (state is MunicipalitiesLoaded) {
|
||||||
|
final cityList = state.city;
|
||||||
|
Set<City> uniqueItems = {};
|
||||||
|
|
||||||
|
// Iterate through the dropdownItems list to filter out duplicates
|
||||||
|
for (var item in cityList) {
|
||||||
|
uniqueItems.add(item);
|
||||||
|
}
|
||||||
|
return BlocConsumer<BarangayAdminBloc,
|
||||||
|
BarangayAdminState>(listener: (context, state) {
|
||||||
|
if (state is BarangayLoaded) {
|
||||||
|
final progress = ProgressHUD.of(context);
|
||||||
|
progress!.showWithText("Please wait...");
|
||||||
|
}
|
||||||
|
if (state is BarangayLoaded) {
|
||||||
|
final progress = ProgressHUD.of(context);
|
||||||
|
progress?.dismiss();
|
||||||
|
}
|
||||||
|
// if (state is BarangayErrorState) {
|
||||||
|
// final progress = ProgressHUD.of(context);
|
||||||
|
// progress?.dismiss();
|
||||||
|
// }
|
||||||
|
}, builder: (context, state) {
|
||||||
|
if (state is BarangayLoaded) {
|
||||||
|
List<Brgy> brgyList = state.brgy;
|
||||||
|
List<String> brgyNAmes = brgyList
|
||||||
|
.map((brgy) => brgy.barangayDescription)
|
||||||
|
.toList()
|
||||||
|
.cast<String>();
|
||||||
|
return FormBuilder(
|
||||||
|
key: offlineBldgEditKey,
|
||||||
|
initialValue: {
|
||||||
|
'street': bldgloc.street ?? "",
|
||||||
|
'province': bldgloc.province ?? "",
|
||||||
|
'l_owner': landRef.owner,
|
||||||
|
'oct_tct_cloa': landRef.cloaNo ?? "no",
|
||||||
|
'survey_no': landRef.surveyNo ?? "",
|
||||||
|
'lot_no': landRef.lotNo ?? "",
|
||||||
|
'blk_no': landRef.blkNo ?? "",
|
||||||
|
'l_td_arp': landRef.tdn ?? "",
|
||||||
|
'area': landRef.area ?? ""
|
||||||
|
},
|
||||||
|
enabled: true,
|
||||||
|
onChanged: () {
|
||||||
|
offlineBldgEditKey.currentState!.save();
|
||||||
|
debugPrint(offlineBldgEditKey
|
||||||
|
.currentState!.value
|
||||||
|
.toString());
|
||||||
|
},
|
||||||
|
autovalidateMode: AutovalidateMode.disabled,
|
||||||
|
skipDisabled: true,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(20.0),
|
||||||
|
child: ListView(
|
||||||
|
shrinkWrap: true,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(
|
||||||
|
left: 0,
|
||||||
|
top: 20,
|
||||||
|
right: 0,
|
||||||
|
bottom: 10),
|
||||||
|
child: const Text('BUILDING LOCATION',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 18),
|
||||||
|
textAlign: TextAlign.left),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
height: 45.0,
|
||||||
|
width: double.infinity,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
border: Border.all(
|
||||||
|
color: Colors.grey,
|
||||||
|
width: 1.0,
|
||||||
|
),
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(
|
||||||
|
5.0),
|
||||||
|
),
|
||||||
|
child: const Align(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
"AGUSAN DEL NORTE",
|
||||||
|
style:
|
||||||
|
TextStyle(fontSize: 15),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: FormBuilderDropdown<City>(
|
||||||
|
name: 'municipality',
|
||||||
|
autofocus: false,
|
||||||
|
decoration:
|
||||||
|
normalTextFieldStyle(
|
||||||
|
bldgloc.municipality ??
|
||||||
|
"Municipality",
|
||||||
|
"",
|
||||||
|
),
|
||||||
|
items: uniqueItems
|
||||||
|
.map(
|
||||||
|
(city) =>
|
||||||
|
DropdownMenuItem<
|
||||||
|
City>(
|
||||||
|
value: city,
|
||||||
|
child: Text(
|
||||||
|
city.cityDescription ??
|
||||||
|
''),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
|
// onChanged: (selectedCityCode) {
|
||||||
|
// // Find the corresponding City object using selectedCityCode
|
||||||
|
// final selectedCity = cityList
|
||||||
|
// .firstWhere((city) =>
|
||||||
|
// city.cityCode ==
|
||||||
|
// selectedCityCode);
|
||||||
|
|
||||||
|
// final barangayBloc = context
|
||||||
|
// .read<BarangayAdminBloc>();
|
||||||
|
// barangayBloc.add(LoadBarangay(
|
||||||
|
// id: selectedCityCode!
|
||||||
|
// .cityCode!));
|
||||||
|
// },
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child: customDropDownField(
|
||||||
|
bldgloc.barangay,
|
||||||
|
"",
|
||||||
|
'brgy',
|
||||||
|
brgyNAmes)),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"No. / Street", "", 'street'),
|
||||||
|
),
|
||||||
|
|
||||||
|
// Expanded(
|
||||||
|
// // optional flex property if flex is 1 because the default flex is 1
|
||||||
|
// flex: 1,
|
||||||
|
// child: customDropDownField(
|
||||||
|
// bldgloc.barangay ?? "",
|
||||||
|
// "Barangay",
|
||||||
|
// 'brgy',
|
||||||
|
// brgyNAmes))
|
||||||
|
]),
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(
|
||||||
|
left: 0,
|
||||||
|
top: 20,
|
||||||
|
right: 0,
|
||||||
|
bottom: 10),
|
||||||
|
child: const Text('LAND REFERENCE',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 18),
|
||||||
|
textAlign: TextAlign.left),
|
||||||
|
),
|
||||||
|
customTextField(
|
||||||
|
"Land Owner", "", 'l_owner'),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"OCT/TCT/CLOA No.",
|
||||||
|
"",
|
||||||
|
'oct_tct_cloa'),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"Survey No.",
|
||||||
|
"",
|
||||||
|
'survey_no'))
|
||||||
|
]),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"Lot No.", "", 'lot_no'),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"Blk No.", "", 'blk_no'))
|
||||||
|
]),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"TD / ARP No.",
|
||||||
|
"",
|
||||||
|
'l_td_arp'),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"Area", "", 'area'))
|
||||||
|
]),
|
||||||
|
SizedBox(
|
||||||
|
height: 50,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceEvenly,
|
||||||
|
children: [
|
||||||
|
CustomButton(
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.chevron_left_rounded,
|
||||||
|
color: Colors.white),
|
||||||
|
onPressed: () {
|
||||||
|
{
|
||||||
|
widget.PrevBtn();
|
||||||
|
}
|
||||||
|
;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
CustomButton(
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.chevron_right_rounded,
|
||||||
|
color: Colors.white),
|
||||||
|
onPressed: () {
|
||||||
|
{
|
||||||
|
// var bldgLocData = BldgLoc(
|
||||||
|
// id: widget.tempId,
|
||||||
|
// street: offlineBldgEditKey.currentState
|
||||||
|
// ?.value['street'],
|
||||||
|
// barangay: offlineBldgEditKey.currentState
|
||||||
|
// ?.value['brgy'],
|
||||||
|
// municipality: offlineBldgEditKey
|
||||||
|
// .currentState
|
||||||
|
// ?.value[
|
||||||
|
// 'municipality']
|
||||||
|
// ?.cityDescription ??
|
||||||
|
// bldgloc.municipality,
|
||||||
|
// province: offlineBldgEditKey.currentState
|
||||||
|
// ?.value['province'],
|
||||||
|
// );
|
||||||
|
// var landRefData = LandRef(
|
||||||
|
// id: widget.tempId,
|
||||||
|
// owner: offlineBldgEditKey.currentState
|
||||||
|
// ?.value['l_owner'],
|
||||||
|
// cloaNo: offlineBldgEditKey.currentState
|
||||||
|
// ?.value['oct_tct_cloa'],
|
||||||
|
// lotNo: offlineBldgEditKey.currentState
|
||||||
|
// ?.value['lot_no'],
|
||||||
|
// tdn: offlineBldgEditKey.currentState
|
||||||
|
// ?.value['l_td_arp'],
|
||||||
|
// area: offlineBldgEditKey.currentState
|
||||||
|
// ?.value['area'],
|
||||||
|
// surveyNo: offlineBldgEditKey.currentState
|
||||||
|
// ?.value['survey_no'],
|
||||||
|
// blkNo: offlineBldgEditKey.currentState
|
||||||
|
// ?.value['blk_no'],
|
||||||
|
// );
|
||||||
|
// context.read<PropertyInfoBloc>()
|
||||||
|
// ..add(UpdateBldgLoc(
|
||||||
|
// bldg_loc: bldgLocData))
|
||||||
|
// ..add(UpdateLandRef(
|
||||||
|
// land_ref: landRefData));
|
||||||
|
|
||||||
|
widget.NextBtn();
|
||||||
|
}
|
||||||
|
;
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// if (state is BarangayErrorState) {
|
||||||
|
// return SomethingWentWrong(
|
||||||
|
// message: onError,
|
||||||
|
// onpressed: () {
|
||||||
|
// context
|
||||||
|
// .read<BarangayBloc>()
|
||||||
|
// .add(LoadBarangay(id: '01'));
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
return Container();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// if (state is MunicipalityErrorState) {
|
||||||
|
// return SomethingWentWrong(
|
||||||
|
// message: onError,
|
||||||
|
// onpressed: () {
|
||||||
|
// context
|
||||||
|
// .read<MunicipalityBloc>()
|
||||||
|
// .add(LoadMunicipality());
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
return Container();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// if (state is LandrefErrorState) {
|
||||||
|
// return SomethingWentWrong(
|
||||||
|
// message: onError,
|
||||||
|
// onpressed: () {
|
||||||
|
// context.read<LandrefBloc>().add(
|
||||||
|
// LoadLandref(id: widget.tempId, landRef: LandRef()));
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (state is LocationErrorState) {
|
||||||
|
// return SomethingWentWrong(
|
||||||
|
// message: onError,
|
||||||
|
// onpressed: () {
|
||||||
|
// context
|
||||||
|
// .read<LocationBloc>()
|
||||||
|
// .add(LoadLocation(id: widget.tempId, bldgloc: BldgLoc()));
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,212 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||||
|
import 'package:unit2/model/passo/property_info.dart';
|
||||||
|
import 'package:unit2/widgets/passo/custom_button.dart';
|
||||||
|
import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart';
|
||||||
|
|
||||||
|
GlobalKey<FormBuilderState> offlineBldgEditKey = GlobalKey<FormBuilderState>();
|
||||||
|
|
||||||
|
class PropertyOwnerInfoEditOffline extends StatefulWidget {
|
||||||
|
final int index;
|
||||||
|
final PropertyInfo faas;
|
||||||
|
final String title;
|
||||||
|
final VoidCallback NextBtn;
|
||||||
|
final VoidCallback PrevBtn;
|
||||||
|
|
||||||
|
const PropertyOwnerInfoEditOffline(
|
||||||
|
this.index, this.faas, this.title, this.NextBtn, this.PrevBtn);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<PropertyOwnerInfoEditOffline> createState() =>
|
||||||
|
_PropertyOwnerInfoEditOffline();
|
||||||
|
}
|
||||||
|
|
||||||
|
ButtonStyle secondaryBtnStyle(
|
||||||
|
Color background, Color borderColor, Color overlay) {
|
||||||
|
return ButtonStyle(
|
||||||
|
elevation: MaterialStateProperty.all<double>(0),
|
||||||
|
backgroundColor: MaterialStateProperty.all<Color>(background),
|
||||||
|
overlayColor: MaterialStateProperty.all<Color>(overlay),
|
||||||
|
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
|
||||||
|
RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(8.0),
|
||||||
|
side: BorderSide(
|
||||||
|
width: 2,
|
||||||
|
color: borderColor,
|
||||||
|
))));
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PropertyOwnerInfoEditOffline
|
||||||
|
extends State<PropertyOwnerInfoEditOffline> {
|
||||||
|
Map<String, dynamic> myMap = {'zero': 0, 'one': 1, 'two': 2};
|
||||||
|
|
||||||
|
final transaction_codes = ['New', 'Revision'];
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.vertical,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(15.0),
|
||||||
|
child: Expanded(
|
||||||
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
FormBuilder(
|
||||||
|
key: offlineBldgEditKey,
|
||||||
|
initialValue: {
|
||||||
|
'transaction_code': widget.faas.transCode,
|
||||||
|
'arp_td': widget.faas.tdn,
|
||||||
|
'pin': widget.faas.pin,
|
||||||
|
'owner': widget.faas.owner,
|
||||||
|
'address': widget.faas.address,
|
||||||
|
'tel_no': widget.faas.telno,
|
||||||
|
'tin': widget.faas.tin,
|
||||||
|
'benificiary': widget.faas.adminUser,
|
||||||
|
'benificiary_telno': widget.faas.adminTelno,
|
||||||
|
'benificiary_address': widget.faas.adminAddress,
|
||||||
|
'benificaiary_tin': widget.faas.adminTin,
|
||||||
|
},
|
||||||
|
enabled: true,
|
||||||
|
onChanged: () {
|
||||||
|
offlineBldgEditKey.currentState!.save();
|
||||||
|
debugPrint(
|
||||||
|
offlineBldgEditKey.currentState!.value.toString());
|
||||||
|
},
|
||||||
|
autovalidateMode: AutovalidateMode.disabled,
|
||||||
|
skipDisabled: true,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(
|
||||||
|
left: 0, top: 20, right: 0, bottom: 10),
|
||||||
|
child: const Text('PROPERTY OWNER INFO',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 18),
|
||||||
|
textAlign: TextAlign.left),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
customDropDownField("Transaction Code", "",
|
||||||
|
"transaction_code", transaction_codes),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"ARP No. / TD No.", "", 'arp_td')),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField("Pin", "", 'pin')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
customTextField("Owner", "", 'owner'),
|
||||||
|
customTextField("Address", "", 'address'),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"Tel No.", "", 'tel_no'),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField("TIN", "", 'tin'))
|
||||||
|
]),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"Administrator / Benificial User",
|
||||||
|
"",
|
||||||
|
'benificiary'),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"TIN", "", 'benificiary_tin'))
|
||||||
|
]),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"Address", "", 'benificiary_address'),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10.0),
|
||||||
|
Expanded(
|
||||||
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
|
flex: 1,
|
||||||
|
child: customTextField(
|
||||||
|
"Tel No.", "", 'benificiary_telno'))
|
||||||
|
]),
|
||||||
|
const SizedBox(height: 25),
|
||||||
|
SizedBox(
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
child: CustomButton(
|
||||||
|
icon: const Icon(Icons.chevron_right,
|
||||||
|
color: Colors.white),
|
||||||
|
onPressed: () {
|
||||||
|
var property_info = PropertyInfo(
|
||||||
|
id: widget.faas.id,
|
||||||
|
transCode: offlineBldgEditKey
|
||||||
|
.currentState!.value['transaction_code']
|
||||||
|
.toString(),
|
||||||
|
tdn: offlineBldgEditKey
|
||||||
|
.currentState!.value['arp_td'],
|
||||||
|
pin: offlineBldgEditKey
|
||||||
|
.currentState!.value['pin'],
|
||||||
|
owner: offlineBldgEditKey
|
||||||
|
.currentState!.value['owner'],
|
||||||
|
address: offlineBldgEditKey
|
||||||
|
.currentState!.value['address'],
|
||||||
|
telno: offlineBldgEditKey
|
||||||
|
.currentState!.value['tel_no'],
|
||||||
|
tin: offlineBldgEditKey
|
||||||
|
.currentState!.value['tin'],
|
||||||
|
adminUser: offlineBldgEditKey
|
||||||
|
.currentState!.value['benificiary'],
|
||||||
|
adminAddress: offlineBldgEditKey
|
||||||
|
.currentState!
|
||||||
|
.value['benificiary_address'],
|
||||||
|
adminTin: offlineBldgEditKey
|
||||||
|
.currentState!.value['benificiary_tin'],
|
||||||
|
adminTelno: offlineBldgEditKey.currentState!
|
||||||
|
.value['benificiary_telno'],
|
||||||
|
);
|
||||||
|
|
||||||
|
// context.read<PropertyInfoBloc>().add(
|
||||||
|
// UpdatPropertyInfo(
|
||||||
|
// property_info: property_info));
|
||||||
|
|
||||||
|
widget.NextBtn();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
])),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,428 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:multiselect/multiselect.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/building/structural_materials_offline.dart/structural_material_offline_bloc.dart';
|
||||||
|
|
||||||
|
import '../../../../../model/passo/structureMaterial.dart';
|
||||||
|
import '../../../../../widgets/passo/custom_button.dart';
|
||||||
|
import '../../../../../widgets/passo/custom_formBuilder_fields.dart';
|
||||||
|
|
||||||
|
class StructuralMaterialsPageEditOffline extends StatefulWidget {
|
||||||
|
// final VoidCallback onPutStructuralMaterials;
|
||||||
|
final VoidCallback NextBtn;
|
||||||
|
final VoidCallback PrevBtn;
|
||||||
|
|
||||||
|
StructuralMaterialsPageEditOffline(this.NextBtn, this.PrevBtn);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_StructuralMaterialsPageEditOffline createState() =>
|
||||||
|
_StructuralMaterialsPageEditOffline();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _StructuralMaterialsPageEditOffline
|
||||||
|
extends State<StructuralMaterialsPageEditOffline> {
|
||||||
|
bool foundationOthers = false;
|
||||||
|
bool columOthers = false;
|
||||||
|
bool beamsOthers = false;
|
||||||
|
bool tfOthers = false;
|
||||||
|
bool roofOthers = false;
|
||||||
|
bool flooringOthers = false;
|
||||||
|
bool wpOthers = false;
|
||||||
|
List<String> foundation = [];
|
||||||
|
List<String> column = [];
|
||||||
|
List<String> beam = [];
|
||||||
|
List<String> truss_framing = [];
|
||||||
|
List<String> roof = [];
|
||||||
|
List<String> flooring = [];
|
||||||
|
List<String> walls = [];
|
||||||
|
|
||||||
|
List<String> selectedColumnValues = [];
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BlocConsumer<StructuralMaterialOfflineBloc,
|
||||||
|
StructuralMaterialOfflineState>(listener: (context, state) {
|
||||||
|
if (state is SpecificStructuralMaterialLoaded) {
|
||||||
|
setState(() {
|
||||||
|
foundation = state.materials.foundation?.split(', ') ?? [];
|
||||||
|
column = state.materials.columns?.split(', ') ?? [];
|
||||||
|
beam = state.materials.beams?.split(', ') ?? [];
|
||||||
|
truss_framing = state.materials.trussFraming?.split(', ') ?? [];
|
||||||
|
roof = state.materials.roof?.split(', ') ?? [];
|
||||||
|
flooring = state.materials.flooring?.split(', ') ?? [];
|
||||||
|
walls = state.materials.walls?.split(', ') ?? [];
|
||||||
|
// Update other local state variables here if needed
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// TODO: implement listener
|
||||||
|
}, builder: (context, state) {
|
||||||
|
if (state is SpecificStructuralMaterialLoaded) {
|
||||||
|
return SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.vertical,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(15.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
// Added this line
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(
|
||||||
|
left: 0, top: 20, right: 0, bottom: 10),
|
||||||
|
child: const Text(
|
||||||
|
'STRUCTURAL MATERIALS',
|
||||||
|
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18),
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
const Text(
|
||||||
|
'FOUNDATION',
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const Text('Others'),
|
||||||
|
Checkbox(
|
||||||
|
checkColor: Colors.white,
|
||||||
|
value: foundationOthers,
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
setState(() {
|
||||||
|
foundationOthers = value!;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
|
child: Visibility(
|
||||||
|
visible: foundationOthers,
|
||||||
|
child: customTextField(
|
||||||
|
"Enter other foundation", "", "other_foundation"),
|
||||||
|
replacement: DropDownMultiSelect(
|
||||||
|
selected_values_style: TextStyle(color: Colors.black),
|
||||||
|
onChanged: (List<String> x) {
|
||||||
|
setState(() {
|
||||||
|
foundation = x;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
options: const ['Reinforced Concrete', 'Plain Concrete'],
|
||||||
|
selectedValues: foundation,
|
||||||
|
whenEmpty: 'Select Foundations',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'COLUMNS',
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const Text('Others'),
|
||||||
|
Checkbox(
|
||||||
|
checkColor: Colors.white,
|
||||||
|
value: columOthers,
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
setState(() {
|
||||||
|
columOthers = value!;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
|
child: Visibility(
|
||||||
|
visible: columOthers,
|
||||||
|
child: customTextField(
|
||||||
|
"Enter other columns", "", "other_column"),
|
||||||
|
replacement: DropDownMultiSelect(
|
||||||
|
selected_values_style: TextStyle(color: Colors.black),
|
||||||
|
onChanged: (List<String> x) {
|
||||||
|
setState(() {
|
||||||
|
column = x;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
options: const ['Steel', 'Reinforced Concrete', 'Wood'],
|
||||||
|
selectedValues: column,
|
||||||
|
whenEmpty: 'Select Column/s',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'BEAMS',
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const Text('Others'),
|
||||||
|
Checkbox(
|
||||||
|
checkColor: Colors.white,
|
||||||
|
value: beamsOthers,
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
setState(() {
|
||||||
|
beamsOthers = value!;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
|
child: Visibility(
|
||||||
|
visible: beamsOthers,
|
||||||
|
child:
|
||||||
|
customTextField("Enter other beam/s", "", "other_beam"),
|
||||||
|
replacement: DropDownMultiSelect(
|
||||||
|
selected_values_style: TextStyle(color: Colors.black),
|
||||||
|
onChanged: (List<String> x) {
|
||||||
|
setState(() {
|
||||||
|
beam = x;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
options: const ['Steel', 'Reinforced Concrete', 'Wood'],
|
||||||
|
selectedValues: beam,
|
||||||
|
whenEmpty: 'Select Beam/s',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'TRUSS FRAMING',
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const Text('Others'),
|
||||||
|
Checkbox(
|
||||||
|
checkColor: Colors.white,
|
||||||
|
value: tfOthers,
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
setState(() {
|
||||||
|
tfOthers = value!;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
|
child: Visibility(
|
||||||
|
visible: tfOthers,
|
||||||
|
child: customTextField(
|
||||||
|
"Enter other truss framing/s", "", "other_tf"),
|
||||||
|
replacement: DropDownMultiSelect(
|
||||||
|
selected_values_style: TextStyle(color: Colors.black),
|
||||||
|
onChanged: (List<String> x) {
|
||||||
|
setState(() {
|
||||||
|
truss_framing = x;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
options: const ['Steel', 'Wood'],
|
||||||
|
selectedValues: truss_framing,
|
||||||
|
whenEmpty: 'Select Truss Framing/s',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'ROOF',
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const Text('Others'),
|
||||||
|
Checkbox(
|
||||||
|
checkColor: Colors.white,
|
||||||
|
value: roofOthers,
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
setState(() {
|
||||||
|
roofOthers = value!;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
|
child: Visibility(
|
||||||
|
visible: roofOthers,
|
||||||
|
child:
|
||||||
|
customTextField("Enter other roof/s", "", "other_roof"),
|
||||||
|
replacement: DropDownMultiSelect(
|
||||||
|
selected_values_style: TextStyle(color: Colors.black),
|
||||||
|
onChanged: (List<String> x) {
|
||||||
|
setState(() {
|
||||||
|
roof = x;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
options: const [
|
||||||
|
'Reinforced Concrete',
|
||||||
|
'Tiles',
|
||||||
|
'G.I Sheet',
|
||||||
|
'Aluminum',
|
||||||
|
'Asbestos',
|
||||||
|
'Long Span',
|
||||||
|
'Concrete Desk',
|
||||||
|
'Nipa/Anahaw/Cogon'
|
||||||
|
],
|
||||||
|
selectedValues: roof,
|
||||||
|
whenEmpty: 'Select Roof/s',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'FLOORING',
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const Text('Others'),
|
||||||
|
Checkbox(
|
||||||
|
checkColor: Colors.white,
|
||||||
|
value: flooringOthers,
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
setState(() {
|
||||||
|
flooringOthers = value!;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
|
child: Visibility(
|
||||||
|
visible: flooringOthers,
|
||||||
|
child: customTextField(
|
||||||
|
"Enter other flooring/s", "", "other_flooring"),
|
||||||
|
replacement: DropDownMultiSelect(
|
||||||
|
selected_values_style: TextStyle(color: Colors.black),
|
||||||
|
onChanged: (List<String> x) {
|
||||||
|
setState(() {
|
||||||
|
flooring = x;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
options: const [
|
||||||
|
'Reinforced Concrete',
|
||||||
|
'Plain Cement',
|
||||||
|
'Marble',
|
||||||
|
'Wood',
|
||||||
|
'Tiles'
|
||||||
|
],
|
||||||
|
selectedValues: flooring,
|
||||||
|
whenEmpty: 'Select Flooring/s',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'WALLS & PARTITIONS',
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const Text('Others'),
|
||||||
|
Checkbox(
|
||||||
|
checkColor: Colors.white,
|
||||||
|
value: wpOthers,
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
setState(() {
|
||||||
|
wpOthers = value!;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
|
child: Visibility(
|
||||||
|
visible: wpOthers,
|
||||||
|
child: customTextField(
|
||||||
|
"Enter other walls & partition/s", "", "other_wp"),
|
||||||
|
replacement: DropDownMultiSelect(
|
||||||
|
selected_values_style: TextStyle(color: Colors.black),
|
||||||
|
onChanged: (List<String> x) {
|
||||||
|
setState(() {
|
||||||
|
walls = x;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
options: const [
|
||||||
|
'Reinforced Concrete',
|
||||||
|
'Plain Concrete',
|
||||||
|
'Wood',
|
||||||
|
'CHIB',
|
||||||
|
'G.I Sheet',
|
||||||
|
'Build-a-wall',
|
||||||
|
'Sawali',
|
||||||
|
'Bamboo'
|
||||||
|
],
|
||||||
|
selectedValues: walls,
|
||||||
|
whenEmpty: 'Select Walls & Partition/s',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: [
|
||||||
|
CustomButton(
|
||||||
|
icon: const Icon(Icons.chevron_left_rounded,
|
||||||
|
color: Colors.white),
|
||||||
|
onPressed: () {
|
||||||
|
widget.PrevBtn();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
CustomButton(
|
||||||
|
icon: const Icon(Icons.chevron_right_rounded,
|
||||||
|
color: Colors.white),
|
||||||
|
onPressed: () {
|
||||||
|
var strucMaterials = StructureMaterials(
|
||||||
|
foundation: foundation.toString(),
|
||||||
|
columns: column.toString(),
|
||||||
|
beams: beam.toString(),
|
||||||
|
trussFraming: truss_framing.toString(),
|
||||||
|
roof: roof.toString(),
|
||||||
|
flooring: flooring.toString(),
|
||||||
|
walls: walls.toString(),
|
||||||
|
others: ["Others"].toString(),
|
||||||
|
);
|
||||||
|
widget.NextBtn();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// if (state is StructuralMaterialsErrorState) {
|
||||||
|
// return Text(state.error);
|
||||||
|
// }
|
||||||
|
return Container();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,303 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||||
|
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
||||||
|
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/barangay_admin/barangay_admin_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/class_components_admin.dart/class_components_admin_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/memoranda/memoranda_admin_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/municipalities_admin/municipalities_admin_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/signatories/signatories_admin_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/admin/unit_construction/unit_construction_admin_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/building/additional_items_offline/additional_items_offline_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/building/appraisal_offline/bldg_appraisal_offline_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/building/assessment_offline/bldg_assessment_offline_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/building/general_description/general_description_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/building/landref/landref_location_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/building/location/location_bloc.dart';
|
||||||
|
import 'package:unit2/bloc/offline/offline_passo/building/structural_materials_offline.dart/structural_material_offline_bloc.dart';
|
||||||
|
import 'package:unit2/model/passo/additional_items.dart';
|
||||||
|
import 'package:unit2/model/passo/property_info.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/building/add/add_building.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/building/edit/edit_building.dart';
|
||||||
|
import 'package:unit2/theme-data.dart/colors.dart';
|
||||||
|
import 'package:unit2/widgets/empty_data.dart';
|
||||||
|
|
||||||
|
import '../../../bloc/offline/offline_passo/building/owner_info_bloc/crud_bloc.dart';
|
||||||
|
|
||||||
|
class BuildingHomeOffline extends StatelessWidget {
|
||||||
|
const BuildingHomeOffline({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
void deleteItem(int itemId) {
|
||||||
|
context.read<CrudBloc>().add(DeleteTodo(id: itemId));
|
||||||
|
}
|
||||||
|
|
||||||
|
// void triggerBlocEvent() {
|
||||||
|
// final myBloc = BlocProvider.of<PropertyOwnerInfoBloc>(context);
|
||||||
|
// myBloc.add(LoadPropertyInfo());
|
||||||
|
// }
|
||||||
|
|
||||||
|
return Scaffold(
|
||||||
|
body: ProgressHUD(
|
||||||
|
backgroundColor: Colors.black87,
|
||||||
|
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||||
|
child: BlocBuilder<CrudBloc, CrudState>(
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state is DisplayTodos) {
|
||||||
|
if (state.todo.isNotEmpty) {
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: ListView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: state.todo.length,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
return _listCard(state.todo[index], context,
|
||||||
|
index, deleteItem, state.todo.length);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return const EmptyData(
|
||||||
|
message:
|
||||||
|
"You don't have any building faas added. Please click + to add");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
)),
|
||||||
|
floatingActionButton: SpeedDial(
|
||||||
|
//provide here features of your parent FAB
|
||||||
|
icon: Icons.add,
|
||||||
|
backgroundColor: primary,
|
||||||
|
heroTag: null,
|
||||||
|
useRotationAnimation: true,
|
||||||
|
activeIcon: Icons.close,
|
||||||
|
animationCurve: Curves.elasticInOut,
|
||||||
|
children: [
|
||||||
|
SpeedDialChild(
|
||||||
|
child: const Icon(
|
||||||
|
Icons.maps_home_work_rounded,
|
||||||
|
color: primary,
|
||||||
|
),
|
||||||
|
label: 'Building & Other Structure',
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(context,
|
||||||
|
MaterialPageRoute(builder: (BuildContext context) {
|
||||||
|
return MultiBlocProvider(providers: [
|
||||||
|
BlocProvider(
|
||||||
|
create: (context) => CrudBloc(),
|
||||||
|
),
|
||||||
|
BlocProvider(
|
||||||
|
create: (context) => AdditionalItemsOfflineBloc(),
|
||||||
|
),
|
||||||
|
BlocProvider(
|
||||||
|
create: (context) => MunicipalitiesAdminBloc()
|
||||||
|
..add(const LoadMunicipalities()),
|
||||||
|
),
|
||||||
|
BlocProvider(
|
||||||
|
create: (context) => BarangayAdminBloc()
|
||||||
|
..add(
|
||||||
|
const LoadBarangayInMunicipality(cityCode: '01')),
|
||||||
|
),
|
||||||
|
BlocProvider(
|
||||||
|
create: (context) => ClassComponentsAdminBloc()
|
||||||
|
..add(const LoadClassComponents()),
|
||||||
|
),
|
||||||
|
BlocProvider(
|
||||||
|
create: (context) => UnitConstructionAdminBloc()
|
||||||
|
..add(const LoadUnitConstruct()),
|
||||||
|
),
|
||||||
|
BlocProvider(
|
||||||
|
create: (context) => SignatoriesAdminBloc()
|
||||||
|
..add(const LoadSignatories()),
|
||||||
|
),
|
||||||
|
BlocProvider(
|
||||||
|
create: (context) =>
|
||||||
|
MemorandaAdminBloc()..add(const LoadMemoranda()),
|
||||||
|
),
|
||||||
|
BlocProvider(create: (context) => LandrefLocationBloc()),
|
||||||
|
BlocProvider(create: (context) => LocationBloc()),
|
||||||
|
BlocProvider(
|
||||||
|
create: (context) => GeneralDescriptionBloc()),
|
||||||
|
BlocProvider(
|
||||||
|
create: (context) => StructuralMaterialOfflineBloc()),
|
||||||
|
BlocProvider(
|
||||||
|
create: (context) => AdditionalItemsOfflineBloc()
|
||||||
|
..add(const LoadAdditionalItems())),
|
||||||
|
BlocProvider(
|
||||||
|
create: (context) => BldgAppraisalOfflineBloc()),
|
||||||
|
BlocProvider(
|
||||||
|
create: (context) => BldgAssessmentOfflineBloc()),
|
||||||
|
], child: AddBuilding(deleteItem));
|
||||||
|
}));
|
||||||
|
}),
|
||||||
|
SpeedDialChild(
|
||||||
|
child: const Icon(
|
||||||
|
Icons.forest_rounded,
|
||||||
|
color: primary,
|
||||||
|
),
|
||||||
|
label: 'Land/Other Improvements',
|
||||||
|
onTap: () {},
|
||||||
|
),
|
||||||
|
SpeedDialChild(
|
||||||
|
child: const Icon(
|
||||||
|
Icons.precision_manufacturing_rounded,
|
||||||
|
color: primary,
|
||||||
|
),
|
||||||
|
label: 'Machinery',
|
||||||
|
onTap: () {},
|
||||||
|
),
|
||||||
|
// SpeedDialChild(
|
||||||
|
// child: const Icon(
|
||||||
|
// Icons.report_problem_rounded,
|
||||||
|
// color: primary,
|
||||||
|
// ),
|
||||||
|
// label: 'Testing Screen',
|
||||||
|
// onTap: () {
|
||||||
|
// Navigator.of(context)
|
||||||
|
// .push(MaterialPageRoute(builder: (ctx) => Multi_Select()));
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Card _listCard(
|
||||||
|
PropertyInfo property_info, context, index, deleteItem, bldgLength) {
|
||||||
|
return Card(
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
//set border radius more than 50% of height and width to make circle
|
||||||
|
),
|
||||||
|
margin: const EdgeInsets.all(5.0),
|
||||||
|
elevation: 5,
|
||||||
|
shadowColor: Colors.grey,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(15.0),
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
Navigator.push(context,
|
||||||
|
MaterialPageRoute(builder: (BuildContext context) {
|
||||||
|
return MultiBlocProvider(
|
||||||
|
providers: [
|
||||||
|
BlocProvider(
|
||||||
|
create: (context) => CrudBloc()..add(FetchTodos()),
|
||||||
|
),
|
||||||
|
BlocProvider(
|
||||||
|
create: (context) => MunicipalitiesAdminBloc()
|
||||||
|
..add(const LoadMunicipalities()),
|
||||||
|
),
|
||||||
|
BlocProvider(
|
||||||
|
create: (context) => BarangayAdminBloc()
|
||||||
|
..add(const LoadBarangayInMunicipality(cityCode: '01')),
|
||||||
|
),
|
||||||
|
BlocProvider(
|
||||||
|
create: (context) => ClassComponentsAdminBloc()
|
||||||
|
..add(const LoadClassComponents()),
|
||||||
|
),
|
||||||
|
BlocProvider(
|
||||||
|
create: (context) => UnitConstructionAdminBloc()
|
||||||
|
..add(const LoadUnitConstruct()),
|
||||||
|
),
|
||||||
|
BlocProvider(
|
||||||
|
create: (context) =>
|
||||||
|
SignatoriesAdminBloc()..add(const LoadSignatories()),
|
||||||
|
),
|
||||||
|
BlocProvider(
|
||||||
|
create: (context) =>
|
||||||
|
MemorandaAdminBloc()..add(const LoadMemoranda()),
|
||||||
|
),
|
||||||
|
BlocProvider(
|
||||||
|
create: (context) => LandrefLocationBloc()
|
||||||
|
..add(FetchSingleLandref(id: property_info.id!))),
|
||||||
|
BlocProvider(
|
||||||
|
create: (context) => LocationBloc()
|
||||||
|
..add(FetchSingleLocation(id: property_info.id!))),
|
||||||
|
BlocProvider(
|
||||||
|
create: (context) => GeneralDescriptionBloc()
|
||||||
|
..add(FetchSingleGeneralDescription(
|
||||||
|
id: property_info.id!))),
|
||||||
|
BlocProvider(
|
||||||
|
create: (context) => StructuralMaterialOfflineBloc()
|
||||||
|
..add(FetchSingleStructuralMaterial(
|
||||||
|
id: property_info.id!))),
|
||||||
|
BlocProvider(
|
||||||
|
create: (context) => AdditionalItemsOfflineBloc()
|
||||||
|
..add(LoadAdditionalItemsEdit(
|
||||||
|
items: const <AdditionalItems>[],
|
||||||
|
id: property_info.id!))),
|
||||||
|
],
|
||||||
|
child: EditBuildingOffline(
|
||||||
|
index: index,
|
||||||
|
faas: property_info,
|
||||||
|
title: 'Bldg & Structure Edit',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 40, // Adjust this to your desired size
|
||||||
|
height: 40, // Adjust this to your desired size
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
border: Border.all(
|
||||||
|
color: primary, // Border color
|
||||||
|
width: 2, // Border width
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: const Icon(
|
||||||
|
Icons.maps_home_work_rounded,
|
||||||
|
color: primary, // Icon color
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 20,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'${property_info.owner}',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
),
|
||||||
|
SizedBox(height: 5),
|
||||||
|
Text(
|
||||||
|
'${property_info.tdn} - ${property_info.id}',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
deleteItem(property_info.id);
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.delete_rounded),
|
||||||
|
color: primary,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||||
|
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||||
|
import 'package:flutter_zoom_drawer/flutter_zoom_drawer.dart';
|
||||||
|
import 'package:fluttericon/font_awesome5_icons.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/admin/admin_main_screen.dart';
|
||||||
|
import 'package:unit2/screens/offline/passo/passo_offline_dashboard.dart';
|
||||||
|
|
||||||
|
import '../../../theme-data.dart/colors.dart';
|
||||||
|
import '../../unit2/homepage.dart/components/dashboard/shared_card_label.dart';
|
||||||
|
|
||||||
|
class PassoOfflineMainScreen extends StatelessWidget {
|
||||||
|
const PassoOfflineMainScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
backgroundColor: primary,
|
||||||
|
title: const Text("PASSO Offlne Home"),
|
||||||
|
centerTitle: true,
|
||||||
|
),
|
||||||
|
body: Padding(
|
||||||
|
padding: const EdgeInsets.all(24),
|
||||||
|
child: GridView.count(
|
||||||
|
shrinkWrap: true,
|
||||||
|
crossAxisCount: 4,
|
||||||
|
crossAxisSpacing: 8,
|
||||||
|
mainAxisSpacing: 10,
|
||||||
|
physics: const BouncingScrollPhysics(),
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 5),
|
||||||
|
children: [
|
||||||
|
CardLabel(
|
||||||
|
icon: FontAwesome5.tools,
|
||||||
|
title: "Admin Settings",
|
||||||
|
ontap: () {
|
||||||
|
Navigator.push(context,
|
||||||
|
MaterialPageRoute(builder: ((context) {
|
||||||
|
return const AdminMainScreen();
|
||||||
|
})));
|
||||||
|
}),
|
||||||
|
CardLabel(
|
||||||
|
icon: FontAwesome5.eye,
|
||||||
|
title: "Field Surveyor",
|
||||||
|
ontap: () {
|
||||||
|
Navigator.push(context,
|
||||||
|
MaterialPageRoute(builder: ((context) {
|
||||||
|
return PassoOfflineDashBoard();
|
||||||
|
})));
|
||||||
|
}),
|
||||||
|
CardLabel(
|
||||||
|
icon: FontAwesome5.eye,
|
||||||
|
title: "Super Admin",
|
||||||
|
ontap: () {
|
||||||
|
Navigator.push(context,
|
||||||
|
MaterialPageRoute(builder: ((context) {
|
||||||
|
return PassoOfflineDashBoard();
|
||||||
|
})));
|
||||||
|
})
|
||||||
|
])));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
|
||||||
|
import 'package:unit2/screens/offline/passo/building_home_offline.dart';
|
||||||
|
import 'package:unit2/theme-data.dart/colors.dart';
|
||||||
|
import 'package:unit2/widgets/empty_data.dart';
|
||||||
|
|
||||||
|
import '../../../bloc/offline/offline_passo/building/owner_info_bloc/crud_bloc.dart';
|
||||||
|
|
||||||
|
class PassoOfflineDashBoard extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_PassoOfflineDashBoard createState() => _PassoOfflineDashBoard();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PassoOfflineDashBoard extends State<PassoOfflineDashBoard> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return DefaultTabController(
|
||||||
|
length: 3,
|
||||||
|
child: Scaffold(
|
||||||
|
body: NestedScrollView(
|
||||||
|
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
||||||
|
return <Widget>[
|
||||||
|
const SliverAppBar(
|
||||||
|
backgroundColor: primary,
|
||||||
|
title: Text('Faas Dashboard'),
|
||||||
|
centerTitle: true,
|
||||||
|
pinned: true,
|
||||||
|
floating: true,
|
||||||
|
bottom: TabBar(
|
||||||
|
isScrollable: true,
|
||||||
|
tabs: [
|
||||||
|
Tab(child: Text('Building')),
|
||||||
|
Tab(child: Text('Land')),
|
||||||
|
Tab(child: Text('Machineries')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
},
|
||||||
|
body: TabBarView(
|
||||||
|
children: <Widget>[
|
||||||
|
BlocProvider(
|
||||||
|
create: (context) => CrudBloc()..add(FetchTodos()),
|
||||||
|
child: BuildingHomeOffline(),
|
||||||
|
),
|
||||||
|
EmptyData(
|
||||||
|
message: "Sorry, this page is under construction.",
|
||||||
|
),
|
||||||
|
EmptyData(
|
||||||
|
message: "Sorry, this page is under construction.",
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -537,8 +537,9 @@ class _AddExtraItems extends State<AddExtraItems> {
|
||||||
_areaValue,
|
_areaValue,
|
||||||
_depValue,
|
_depValue,
|
||||||
),
|
),
|
||||||
painted: true,
|
painted: isPainted == true ? '1' : '0',
|
||||||
secondhand: true,
|
secondhand:
|
||||||
|
isSecondHand == true ? '1' : '0',
|
||||||
paintedUnitval: '1',
|
paintedUnitval: '1',
|
||||||
secondhandUnitval: '1');
|
secondhandUnitval: '1');
|
||||||
|
|
||||||
|
|
|
@ -115,18 +115,20 @@ class _GeneralDescriptionPage extends State<GeneralDescriptionPage> {
|
||||||
child: customDatTimePicker(
|
child: customDatTimePicker(
|
||||||
"Date Occupied", "", 'date_occupied'))
|
"Date Occupied", "", 'date_occupied'))
|
||||||
]),
|
]),
|
||||||
Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <
|
Row(
|
||||||
Widget>[
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
Expanded(
|
children: <Widget>[
|
||||||
flex: 1,
|
Expanded(
|
||||||
child: customTextField("Bldg. Age", "", 'bldg_age'),
|
flex: 1,
|
||||||
),
|
child: customTextField("Bldg. Age", "", 'bldg_age'),
|
||||||
const SizedBox(width: 10.0),
|
),
|
||||||
Expanded(
|
const SizedBox(width: 10.0),
|
||||||
// optional flex property if flex is 1 because the default flex is 1
|
Expanded(
|
||||||
flex: 1,
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
child: customTextField("No. of storeys", "", 'no_of_storeys'))
|
flex: 1,
|
||||||
]),
|
child: customTextField(
|
||||||
|
"No. of storeys", "", 'no_of_storeys'))
|
||||||
|
]),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
@ -200,10 +202,9 @@ class _GeneralDescriptionPage extends State<GeneralDescriptionPage> {
|
||||||
formKey.currentState?.value['date_cnstructed'],
|
formKey.currentState?.value['date_cnstructed'],
|
||||||
dateOccupied:
|
dateOccupied:
|
||||||
formKey.currentState?.value['date_occupied'],
|
formKey.currentState?.value['date_occupied'],
|
||||||
bldgAge: int.tryParse(
|
bldgAge: formKey.currentState?.value['bldg_age'],
|
||||||
formKey.currentState?.value['bldg_age']),
|
noStoreys:
|
||||||
noStoreys: int.tryParse(
|
formKey.currentState?.value['no_of_storeys'],
|
||||||
formKey.currentState?.value['no_of_storeys']),
|
|
||||||
area1Stfloor: '0',
|
area1Stfloor: '0',
|
||||||
area2Ndfloor: '0',
|
area2Ndfloor: '0',
|
||||||
area3Rdfloor: '0',
|
area3Rdfloor: '0',
|
||||||
|
|
|
@ -644,7 +644,7 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
child: Text(
|
child: const Text(
|
||||||
"Cost of Additional Items",
|
"Cost of Additional Items",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
|
@ -653,7 +653,7 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
child: Text(
|
child: const Text(
|
||||||
'',
|
'',
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
),
|
),
|
||||||
|
@ -665,7 +665,7 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
child: Text(
|
child: const Text(
|
||||||
"Sub-total",
|
"Sub-total",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
|
@ -687,7 +687,7 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
child: Text(
|
child: const Text(
|
||||||
"Total Construction Cost",
|
"Total Construction Cost",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
|
@ -716,7 +716,7 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
child: Text(
|
child: const Text(
|
||||||
"Depreciation Rate",
|
"Depreciation Rate",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
|
@ -858,7 +858,7 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
|
||||||
width: 100,
|
width: 100,
|
||||||
margin:
|
margin:
|
||||||
const EdgeInsets
|
const EdgeInsets
|
||||||
.only(
|
.only(
|
||||||
top: 15,
|
top: 15,
|
||||||
left: 15),
|
left: 15),
|
||||||
padding:
|
padding:
|
||||||
|
@ -880,7 +880,7 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
|
||||||
width: 100,
|
width: 100,
|
||||||
margin:
|
margin:
|
||||||
const EdgeInsets
|
const EdgeInsets
|
||||||
.only(
|
.only(
|
||||||
top: 15,
|
top: 15,
|
||||||
left: 15),
|
left: 15),
|
||||||
padding:
|
padding:
|
||||||
|
@ -902,7 +902,7 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
|
||||||
width: 100,
|
width: 100,
|
||||||
margin:
|
margin:
|
||||||
const EdgeInsets
|
const EdgeInsets
|
||||||
.only(
|
.only(
|
||||||
top: 15,
|
top: 15,
|
||||||
left: 15),
|
left: 15),
|
||||||
padding:
|
padding:
|
||||||
|
@ -924,7 +924,7 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
|
||||||
width: 100,
|
width: 100,
|
||||||
margin:
|
margin:
|
||||||
const EdgeInsets
|
const EdgeInsets
|
||||||
.only(
|
.only(
|
||||||
top: 15,
|
top: 15,
|
||||||
left: 15),
|
left: 15),
|
||||||
padding:
|
padding:
|
||||||
|
@ -952,7 +952,7 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
|
||||||
width: 100,
|
width: 100,
|
||||||
margin:
|
margin:
|
||||||
const EdgeInsets
|
const EdgeInsets
|
||||||
.only(
|
.only(
|
||||||
top: 15,
|
top: 15,
|
||||||
left: 15),
|
left: 15),
|
||||||
padding:
|
padding:
|
||||||
|
@ -977,7 +977,7 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
|
||||||
width: 100,
|
width: 100,
|
||||||
margin:
|
margin:
|
||||||
const EdgeInsets
|
const EdgeInsets
|
||||||
.only(
|
.only(
|
||||||
top: 15,
|
top: 15,
|
||||||
left: 15),
|
left: 15),
|
||||||
padding:
|
padding:
|
||||||
|
@ -1009,7 +1009,7 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
|
||||||
width: 100,
|
width: 100,
|
||||||
margin:
|
margin:
|
||||||
const EdgeInsets
|
const EdgeInsets
|
||||||
.only(
|
.only(
|
||||||
top: 15,
|
top: 15,
|
||||||
left: 15),
|
left: 15),
|
||||||
padding:
|
padding:
|
||||||
|
@ -1046,7 +1046,7 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
|
||||||
width: 100,
|
width: 100,
|
||||||
margin:
|
margin:
|
||||||
const EdgeInsets
|
const EdgeInsets
|
||||||
.only(
|
.only(
|
||||||
top: 15,
|
top: 15,
|
||||||
left: 15),
|
left: 15),
|
||||||
padding:
|
padding:
|
||||||
|
|
|
@ -396,7 +396,7 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(
|
const SizedBox(
|
||||||
height: 30,
|
height: 30,
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
|
@ -421,14 +421,14 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(
|
const SizedBox(
|
||||||
height: 30,
|
height: 30,
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment.spaceBetween,
|
MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
const Text(
|
||||||
'Date of Entry in the Rec. of Ass. :'),
|
'Date of Entry in the Rec. of Ass. :'),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 100,
|
width: 100,
|
||||||
|
@ -447,7 +447,7 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(
|
const SizedBox(
|
||||||
height: 30,
|
height: 30,
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
|
@ -467,7 +467,7 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(
|
const SizedBox(
|
||||||
height: 30,
|
height: 30,
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
|
|
|
@ -83,46 +83,44 @@ class _PropertyInfoPage extends State<PropertyInfoPage> {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
child: customTextField("TIN", "", 'benificiary_tin'))
|
child: customTextField("TIN", "", 'benificiary_tin'))
|
||||||
]),
|
]),
|
||||||
Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <
|
Row(
|
||||||
Widget>[
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
Expanded(
|
children: <Widget>[
|
||||||
flex: 1,
|
Expanded(
|
||||||
child: customTextField("Address", "", 'benificiary_address'),
|
flex: 1,
|
||||||
),
|
child:
|
||||||
const SizedBox(width: 10.0),
|
customTextField("Address", "", 'benificiary_address'),
|
||||||
Expanded(
|
),
|
||||||
// optional flex property if flex is 1 because the default flex is 1
|
const SizedBox(width: 10.0),
|
||||||
flex: 1,
|
Expanded(
|
||||||
child: customTextField("Tel No.", "", 'benificiary_telno'))
|
// optional flex property if flex is 1 because the default flex is 1
|
||||||
]),
|
flex: 1,
|
||||||
|
child:
|
||||||
|
customTextField("Tel No.", "", 'benificiary_telno'))
|
||||||
|
]),
|
||||||
const SizedBox(height: 25),
|
const SizedBox(height: 25),
|
||||||
CustomButton(
|
CustomButton(
|
||||||
icon: const Icon(Icons.chevron_right, color: Colors.white),
|
icon: const Icon(Icons.chevron_right, color: Colors.white),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
try {
|
try {
|
||||||
var property_info = PropertyInfo(
|
var property_info = PropertyInfo(
|
||||||
id: 1,
|
id: 1,
|
||||||
transCode: formKey
|
transCode: formKey.currentState!.value['transaction_code']
|
||||||
.currentState!.value['transaction_code']
|
.toString(),
|
||||||
.toString(),
|
tdn: formKey.currentState!.value['arp_td'],
|
||||||
tdn: formKey.currentState!.value['arp_td'],
|
pin: formKey.currentState!.value['pin'],
|
||||||
pin: formKey.currentState!.value['pin'],
|
owner: formKey.currentState!.value['owner'],
|
||||||
owner: formKey.currentState!.value['owner'],
|
address: formKey.currentState!.value['address'],
|
||||||
address: formKey.currentState!.value['address'],
|
telno: formKey.currentState!.value['tel_no'],
|
||||||
telno: formKey.currentState!.value['tel_no'],
|
tin: formKey.currentState!.value['tin'],
|
||||||
tin: formKey.currentState!.value['tin'],
|
adminUser: formKey.currentState!.value['benificiary'],
|
||||||
adminUser: formKey.currentState!.value['benificiary'],
|
adminAddress:
|
||||||
adminAddress:
|
formKey.currentState!.value['benificiary_address'],
|
||||||
formKey.currentState!.value['benificiary_address'],
|
adminTin: formKey.currentState!.value['benificiary_tin'],
|
||||||
adminTin:
|
adminTelno:
|
||||||
formKey.currentState!.value['benificiary_tin'],
|
formKey.currentState!.value['benificiary_telno'],
|
||||||
adminTelno:
|
faasType: "BUILDING",
|
||||||
formKey.currentState!.value['benificiary_telno'],
|
);
|
||||||
assessedById: '1',
|
|
||||||
assessedByName: 'Cyril',
|
|
||||||
faasType: "BUILDING",
|
|
||||||
dateModified: DateTime.now(),
|
|
||||||
dateCreated: DateTime.now());
|
|
||||||
|
|
||||||
// Dispatch the event to add the property_info
|
// Dispatch the event to add the property_info
|
||||||
context.read<PropertyInfoBloc>().add(
|
context.read<PropertyInfoBloc>().add(
|
||||||
|
|
|
@ -7,13 +7,14 @@ import 'package:searchfield/searchfield.dart';
|
||||||
import 'package:unit2/bloc/passo/bulding/additional_item/additional_item_bloc.dart';
|
import 'package:unit2/bloc/passo/bulding/additional_item/additional_item_bloc.dart';
|
||||||
import 'package:unit2/bloc/passo/bulding/additional_items_edit/additional_items_edit_bloc.dart';
|
import 'package:unit2/bloc/passo/bulding/additional_items_edit/additional_items_edit_bloc.dart';
|
||||||
import 'package:unit2/model/passo/additional_items.dart';
|
import 'package:unit2/model/passo/additional_items.dart';
|
||||||
|
import 'package:unit2/model/passo/class_components%20_offline.dart';
|
||||||
import 'package:unit2/model/passo/class_components.dart';
|
import 'package:unit2/model/passo/class_components.dart';
|
||||||
import 'package:unit2/model/passo/unit_construct.dart';
|
import 'package:unit2/model/passo/unit_construct.dart';
|
||||||
import 'package:unit2/theme-data.dart/form-style.dart';
|
import 'package:unit2/theme-data.dart/form-style.dart';
|
||||||
|
|
||||||
class AddExtraItemsEdit extends StatefulWidget {
|
class AddExtraItemsEdit extends StatefulWidget {
|
||||||
final List<UnitConstruct> unit;
|
final List<UnitConstruct> unit;
|
||||||
final List<ClassComponents> options;
|
final List<ClassComponentsOffline> options;
|
||||||
final int tempId;
|
final int tempId;
|
||||||
|
|
||||||
AddExtraItemsEdit(this.unit, this.options, this.tempId);
|
AddExtraItemsEdit(this.unit, this.options, this.tempId);
|
||||||
|
@ -113,28 +114,30 @@ class _AddExtraItemsEdit extends State<AddExtraItemsEdit> {
|
||||||
items: widget.options
|
items: widget.options
|
||||||
.map((e) => DropdownMenuItem(
|
.map((e) => DropdownMenuItem(
|
||||||
value: e,
|
value: e,
|
||||||
child: Text(e.componentName),
|
child: Text(e.componentName!),
|
||||||
))
|
))
|
||||||
.toList(),
|
.toList(),
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
if (value!.minBaseUnitvalPercent != '0.00') {
|
if (value!.minBaseUnitvalPercent != '0.00') {
|
||||||
setState(() {
|
setState(() {
|
||||||
_unitValue =
|
_unitValue = double.parse(
|
||||||
double.parse(value.minBaseUnitvalPercent);
|
value.minBaseUnitvalPercent!);
|
||||||
_className = value.componentName;
|
_className = value.componentName!;
|
||||||
_classId = value.id;
|
_classId = value.id!;
|
||||||
_withoutBUCC = value.withoutBucc;
|
_withoutBUCC =
|
||||||
|
value.withoutBucc == '1' ? true : false;
|
||||||
});
|
});
|
||||||
formKey.currentState!.patchValue(
|
formKey.currentState!.patchValue(
|
||||||
{'unitValue': value.minBaseUnitvalPercent});
|
{'unitValue': value.minBaseUnitvalPercent});
|
||||||
}
|
}
|
||||||
if (value.maxBaseUnitvalPercent != '0.00') {
|
if (value.maxBaseUnitvalPercent != '0.00') {
|
||||||
setState(() {
|
setState(() {
|
||||||
_unitValue =
|
_unitValue = double.parse(
|
||||||
double.parse(value.maxBaseUnitvalPercent);
|
value.maxBaseUnitvalPercent!);
|
||||||
_className = value.componentName;
|
_className = value.componentName!;
|
||||||
_classId = value.id;
|
_classId = value.id!;
|
||||||
_withoutBUCC = value.withoutBucc;
|
_withoutBUCC =
|
||||||
|
value.withoutBucc == '1' ? true : false;
|
||||||
});
|
});
|
||||||
formKey.currentState!.patchValue(
|
formKey.currentState!.patchValue(
|
||||||
{'unitValue': value.maxBaseUnitvalPercent});
|
{'unitValue': value.maxBaseUnitvalPercent});
|
||||||
|
@ -142,10 +145,11 @@ class _AddExtraItemsEdit extends State<AddExtraItemsEdit> {
|
||||||
if (value.minUnitvalSqrmtr != '0.00') {
|
if (value.minUnitvalSqrmtr != '0.00') {
|
||||||
setState(() {
|
setState(() {
|
||||||
_unitValue =
|
_unitValue =
|
||||||
double.parse(value.minUnitvalSqrmtr);
|
double.parse(value.minUnitvalSqrmtr!);
|
||||||
_className = value.componentName;
|
_className = value.componentName!;
|
||||||
_classId = value.id;
|
_classId = value.id!;
|
||||||
_withoutBUCC = value.withoutBucc;
|
_withoutBUCC =
|
||||||
|
value.withoutBucc == '1' ? true : false;
|
||||||
});
|
});
|
||||||
formKey.currentState!.patchValue(
|
formKey.currentState!.patchValue(
|
||||||
{'unitValue': value.minUnitvalSqrmtr});
|
{'unitValue': value.minUnitvalSqrmtr});
|
||||||
|
@ -153,10 +157,12 @@ class _AddExtraItemsEdit extends State<AddExtraItemsEdit> {
|
||||||
if (value.maxUnitvalSqrmtr != '0.00') {
|
if (value.maxUnitvalSqrmtr != '0.00') {
|
||||||
setState(() {
|
setState(() {
|
||||||
_unitValue =
|
_unitValue =
|
||||||
double.parse(value.maxUnitvalSqrmtr);
|
double.parse(value.maxUnitvalSqrmtr!);
|
||||||
_className = value.componentName;
|
_className = value.componentName!;
|
||||||
_classId = value.id;
|
_classId = value.id!;
|
||||||
_withoutBUCC = value.withoutBucc;
|
_withoutBUCC =
|
||||||
|
value.withoutBucc == '1' ? true : false;
|
||||||
|
;
|
||||||
});
|
});
|
||||||
formKey.currentState!.patchValue(
|
formKey.currentState!.patchValue(
|
||||||
{'unitValue': value.maxUnitvalSqrmtr});
|
{'unitValue': value.maxUnitvalSqrmtr});
|
||||||
|
@ -164,10 +170,12 @@ class _AddExtraItemsEdit extends State<AddExtraItemsEdit> {
|
||||||
if (value.minAddBaseunitval != '0.00') {
|
if (value.minAddBaseunitval != '0.00') {
|
||||||
setState(() {
|
setState(() {
|
||||||
_unitValue =
|
_unitValue =
|
||||||
double.parse(value.minAddBaseunitval);
|
double.parse(value.minAddBaseunitval!);
|
||||||
_className = value.componentName;
|
_className = value.componentName!;
|
||||||
_classId = value.id;
|
_classId = value.id!;
|
||||||
_withoutBUCC = value.withoutBucc;
|
_withoutBUCC =
|
||||||
|
value.withoutBucc == '1' ? true : false;
|
||||||
|
;
|
||||||
});
|
});
|
||||||
formKey.currentState!.patchValue(
|
formKey.currentState!.patchValue(
|
||||||
{'unitValue': value.minAddBaseunitval});
|
{'unitValue': value.minAddBaseunitval});
|
||||||
|
@ -175,10 +183,12 @@ class _AddExtraItemsEdit extends State<AddExtraItemsEdit> {
|
||||||
if (value.maxAddBaseunitval != '0.00') {
|
if (value.maxAddBaseunitval != '0.00') {
|
||||||
setState(() {
|
setState(() {
|
||||||
_unitValue =
|
_unitValue =
|
||||||
double.parse(value.maxAddBaseunitval);
|
double.parse(value.maxAddBaseunitval!);
|
||||||
_className = value.componentName;
|
_className = value.componentName!;
|
||||||
_classId = value.id;
|
_classId = value.id!;
|
||||||
_withoutBUCC = value.withoutBucc;
|
_withoutBUCC =
|
||||||
|
value.withoutBucc == '1' ? true : false;
|
||||||
|
;
|
||||||
});
|
});
|
||||||
formKey.currentState!.patchValue(
|
formKey.currentState!.patchValue(
|
||||||
{'unitValue': value.maxAddBaseunitval});
|
{'unitValue': value.maxAddBaseunitval});
|
||||||
|
@ -186,10 +196,12 @@ class _AddExtraItemsEdit extends State<AddExtraItemsEdit> {
|
||||||
if (value.minDeductBaserate != '0.00') {
|
if (value.minDeductBaserate != '0.00') {
|
||||||
setState(() {
|
setState(() {
|
||||||
_unitValue =
|
_unitValue =
|
||||||
double.parse(value.minDeductBaserate);
|
double.parse(value.minDeductBaserate!);
|
||||||
_className = value.componentName;
|
_className = value.componentName!;
|
||||||
_classId = value.id;
|
_classId = value.id!;
|
||||||
_withoutBUCC = value.withoutBucc;
|
_withoutBUCC =
|
||||||
|
value.withoutBucc == '1' ? true : false;
|
||||||
|
;
|
||||||
});
|
});
|
||||||
formKey.currentState!.patchValue(
|
formKey.currentState!.patchValue(
|
||||||
{'unitValue': value.minDeductBaserate});
|
{'unitValue': value.minDeductBaserate});
|
||||||
|
@ -197,10 +209,12 @@ class _AddExtraItemsEdit extends State<AddExtraItemsEdit> {
|
||||||
if (value.maxDeductBaserate != '0.00') {
|
if (value.maxDeductBaserate != '0.00') {
|
||||||
setState(() {
|
setState(() {
|
||||||
_unitValue =
|
_unitValue =
|
||||||
double.parse(value.maxDeductBaserate);
|
double.parse(value.maxDeductBaserate!);
|
||||||
_className = value.componentName;
|
_className = value.componentName!;
|
||||||
_classId = value.id;
|
_classId = value.id!;
|
||||||
_withoutBUCC = value.withoutBucc;
|
_withoutBUCC =
|
||||||
|
value.withoutBucc == '1' ? true : false;
|
||||||
|
;
|
||||||
});
|
});
|
||||||
formKey.currentState!.patchValue(
|
formKey.currentState!.patchValue(
|
||||||
{'unitValue': value.maxDeductBaserate});
|
{'unitValue': value.maxDeductBaserate});
|
||||||
|
@ -548,8 +562,9 @@ class _AddExtraItemsEdit extends State<AddExtraItemsEdit> {
|
||||||
_areaValue,
|
_areaValue,
|
||||||
_depValue,
|
_depValue,
|
||||||
),
|
),
|
||||||
painted: true,
|
painted: isPainted == true ? '1' : '0',
|
||||||
secondhand: true,
|
secondhand:
|
||||||
|
isSecondHand == true ? '1' : '0',
|
||||||
paintedUnitval: '1',
|
paintedUnitval: '1',
|
||||||
secondhandUnitval: '1');
|
secondhandUnitval: '1');
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import 'package:intl/intl.dart';
|
||||||
import 'package:unit2/bloc/passo/bulding/additional_item/additional_item_bloc.dart';
|
import 'package:unit2/bloc/passo/bulding/additional_item/additional_item_bloc.dart';
|
||||||
import 'package:unit2/bloc/passo/bulding/additional_items_edit/additional_items_edit_bloc.dart';
|
import 'package:unit2/bloc/passo/bulding/additional_items_edit/additional_items_edit_bloc.dart';
|
||||||
import 'package:unit2/model/passo/additional_items.dart';
|
import 'package:unit2/model/passo/additional_items.dart';
|
||||||
|
import 'package:unit2/model/passo/class_components%20_offline.dart';
|
||||||
import 'package:unit2/model/passo/class_components.dart';
|
import 'package:unit2/model/passo/class_components.dart';
|
||||||
import 'package:unit2/model/passo/unit_construct.dart';
|
import 'package:unit2/model/passo/unit_construct.dart';
|
||||||
import 'package:unit2/screens/passo/Building/edit_building/AddExtraItems.dart';
|
import 'package:unit2/screens/passo/Building/edit_building/AddExtraItems.dart';
|
||||||
|
@ -14,7 +15,7 @@ import 'package:unit2/widgets/passo/custom_button.dart';
|
||||||
|
|
||||||
class AdditionalItemEditPage extends StatefulWidget {
|
class AdditionalItemEditPage extends StatefulWidget {
|
||||||
final List<UnitConstruct> unit;
|
final List<UnitConstruct> unit;
|
||||||
final List<ClassComponents> options;
|
final List<ClassComponentsOffline> options;
|
||||||
final int tempId;
|
final int tempId;
|
||||||
final VoidCallback NextBtn;
|
final VoidCallback NextBtn;
|
||||||
final VoidCallback PrevBtn;
|
final VoidCallback PrevBtn;
|
||||||
|
|
|
@ -62,9 +62,8 @@ class _GeneralDescriptionEdit extends State<GeneralDescriptionEdit> {
|
||||||
final tempID = await SharedPreferences.getInstance();
|
final tempID = await SharedPreferences.getInstance();
|
||||||
await tempID.setInt(
|
await tempID.setInt(
|
||||||
'totalValue', int.parse(state.gendesc.totalFloorArea!));
|
'totalValue', int.parse(state.gendesc.totalFloorArea!));
|
||||||
await tempID.setString(
|
await tempID.setString(
|
||||||
'actualUse', state.gendesc.actualUse!);
|
'actualUse', state.gendesc.actualUse!);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (state is GenDescErrorState) {
|
if (state is GenDescErrorState) {
|
||||||
final progress = ProgressHUD.of(context);
|
final progress = ProgressHUD.of(context);
|
||||||
|
@ -313,8 +312,8 @@ class _GeneralDescriptionEdit extends State<GeneralDescriptionEdit> {
|
||||||
dateCompleted:
|
dateCompleted:
|
||||||
keys.currentState?.value['date_cnstructed'],
|
keys.currentState?.value['date_cnstructed'],
|
||||||
dateOccupied: keys.currentState?.value['date_occupied'],
|
dateOccupied: keys.currentState?.value['date_occupied'],
|
||||||
bldgAge: int.tryParse(keys.currentState?.value['bldg_age']),
|
bldgAge: keys.currentState?.value['bldg_age'],
|
||||||
noStoreys: int.tryParse(keys.currentState?.value['no_of_storeys']),
|
noStoreys: keys.currentState?.value['no_of_storeys'],
|
||||||
area1Stfloor: keys.currentState?.value['area_of_1stFl'],
|
area1Stfloor: keys.currentState?.value['area_of_1stFl'],
|
||||||
area2Ndfloor: keys.currentState?.value['area_of_2ndFl'],
|
area2Ndfloor: keys.currentState?.value['area_of_2ndFl'],
|
||||||
area3Rdfloor: keys.currentState?.value['area_of_3rdFl'],
|
area3Rdfloor: keys.currentState?.value['area_of_3rdFl'],
|
||||||
|
|
|
@ -200,32 +200,28 @@ class _PropertyOwnerInfoEdit extends State<PropertyOwnerInfoEdit> {
|
||||||
color: Colors.white),
|
color: Colors.white),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
var property_info = PropertyInfo(
|
var property_info = PropertyInfo(
|
||||||
id: widget.faas.id,
|
id: widget.faas.id,
|
||||||
transCode: keys.currentState!
|
transCode: keys.currentState!
|
||||||
.value['transaction_code']
|
.value['transaction_code']
|
||||||
.toString(),
|
.toString(),
|
||||||
tdn: keys
|
tdn: keys.currentState!.value['arp_td'],
|
||||||
.currentState!.value['arp_td'],
|
pin: keys.currentState!.value['pin'],
|
||||||
pin: keys.currentState!.value['pin'],
|
owner:
|
||||||
owner:
|
keys.currentState!.value['owner'],
|
||||||
keys.currentState!.value['owner'],
|
address:
|
||||||
address: keys
|
keys.currentState!.value['address'],
|
||||||
.currentState!.value['address'],
|
telno:
|
||||||
telno: keys
|
keys.currentState!.value['tel_no'],
|
||||||
.currentState!.value['tel_no'],
|
tin: keys.currentState!.value['tin'],
|
||||||
tin: keys.currentState!.value['tin'],
|
adminUser: keys
|
||||||
adminUser: keys.currentState!
|
.currentState!.value['benificiary'],
|
||||||
.value['benificiary'],
|
adminAddress: keys.currentState!
|
||||||
adminAddress: keys.currentState!
|
.value['benificiary_address'],
|
||||||
.value['benificiary_address'],
|
adminTin: keys.currentState!
|
||||||
adminTin: keys.currentState!
|
.value['benificiary_tin'],
|
||||||
.value['benificiary_tin'],
|
adminTelno: keys.currentState!
|
||||||
adminTelno: keys.currentState!
|
.value['benificiary_telno'],
|
||||||
.value['benificiary_telno'],
|
);
|
||||||
assessedById: '1',
|
|
||||||
assessedByName: 'Cyril',
|
|
||||||
dateModified: DateTime.now(),
|
|
||||||
dateCreated: DateTime.now());
|
|
||||||
|
|
||||||
context.read<PropertyInfoBloc>().add(
|
context.read<PropertyInfoBloc>().add(
|
||||||
UpdatPropertyInfo(
|
UpdatPropertyInfo(
|
||||||
|
|
|
@ -21,7 +21,7 @@ class _PassoDashBoard extends State<PassoDashBoard> {
|
||||||
body: NestedScrollView(
|
body: NestedScrollView(
|
||||||
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
||||||
return <Widget>[
|
return <Widget>[
|
||||||
new SliverAppBar(
|
const SliverAppBar(
|
||||||
backgroundColor: primary,
|
backgroundColor: primary,
|
||||||
title: Text('Faas Dashboard'),
|
title: Text('Faas Dashboard'),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
import 'package:flutter/src/widgets/placeholder.dart';
|
import 'package:flutter/src/widgets/placeholder.dart';
|
||||||
>>>>>>> develop
|
|
||||||
import 'package:qr_flutter/qr_flutter.dart';
|
import 'package:qr_flutter/qr_flutter.dart';
|
||||||
import 'package:unit2/theme-data.dart/colors.dart';
|
import 'package:unit2/theme-data.dart/colors.dart';
|
||||||
import 'package:unit2/utils/global.dart';
|
import 'package:unit2/utils/global.dart';
|
||||||
|
@ -16,12 +13,12 @@ class QRFullScreenImage extends StatelessWidget {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
backgroundColor: primary,title: const Text("Profile QR Code"),),
|
backgroundColor: primary,
|
||||||
body: Center(
|
title: const Text("Profile QR Code"),
|
||||||
child: QrImageView(
|
),
|
||||||
data: uuid,
|
body: Center(
|
||||||
size: blockSizeVertical * 50
|
child: QrImageView(data: uuid, size: blockSizeVertical * 50),
|
||||||
),
|
),
|
||||||
),);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
import 'dart:core';
|
||||||
|
|
||||||
|
import 'package:unit2/utils/request.dart';
|
||||||
|
import 'package:unit2/utils/urls.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
|
class BrgyAdminApiServices {
|
||||||
|
static final BrgyAdminApiServices _instance = BrgyAdminApiServices();
|
||||||
|
static BrgyAdminApiServices get instance => _instance;
|
||||||
|
String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z";
|
||||||
|
String xClientKeySecret = "unitcYqAN7GGalyz";
|
||||||
|
|
||||||
|
Future<List> fetch() async {
|
||||||
|
String path = Url.instance.getBarangay();
|
||||||
|
Map<String, String> headers = {
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
'X-Client-Key': xClientKey,
|
||||||
|
'X-Client-Secret': xClientKeySecret
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
http.Response response = await Request.instance
|
||||||
|
.getRequest(param: {}, path: path, headers: headers);
|
||||||
|
|
||||||
|
print(response.statusCode);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
final List result = jsonDecode(response.body)['data'];
|
||||||
|
print(result);
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
throw Exception(response.reasonPhrase);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
throw Exception(e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import '../../../../../utils/request.dart';
|
||||||
|
import '../../../../../utils/urls.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
|
class ClassComponentAdminApiServices {
|
||||||
|
static final ClassComponentAdminApiServices _instance =
|
||||||
|
ClassComponentAdminApiServices();
|
||||||
|
static ClassComponentAdminApiServices get instance => _instance;
|
||||||
|
String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z";
|
||||||
|
String xClientKeySecret = "unitcYqAN7GGalyz";
|
||||||
|
|
||||||
|
Future<List> fetch() async {
|
||||||
|
String path = Url.instance.getClassComponents();
|
||||||
|
Map<String, String> headers = {
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
'X-Client-Key': xClientKey,
|
||||||
|
'X-Client-Secret': xClientKeySecret
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
http.Response response = await Request.instance
|
||||||
|
.getRequest(param: {}, path: path, headers: headers);
|
||||||
|
|
||||||
|
print(response.statusCode);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
final List result = jsonDecode(response.body)['data'];
|
||||||
|
print(result);
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
throw Exception(response.reasonPhrase);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
throw Exception(e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
import 'dart:core';
|
||||||
|
|
||||||
|
import 'package:unit2/utils/request.dart';
|
||||||
|
import 'package:unit2/utils/urls.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
|
class MemorandaAdminApiServices {
|
||||||
|
static final MemorandaAdminApiServices _instance =
|
||||||
|
MemorandaAdminApiServices();
|
||||||
|
static MemorandaAdminApiServices get instance => _instance;
|
||||||
|
String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z";
|
||||||
|
String xClientKeySecret = "unitcYqAN7GGalyz";
|
||||||
|
|
||||||
|
Future<List> fetch() async {
|
||||||
|
String path = Url.instance.getMemoranda();
|
||||||
|
Map<String, String> headers = {
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
'X-Client-Key': xClientKey,
|
||||||
|
'X-Client-Secret': xClientKeySecret
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
http.Response response = await Request.instance
|
||||||
|
.getRequest(param: {}, path: path, headers: headers);
|
||||||
|
|
||||||
|
print(response.statusCode);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
final List result = jsonDecode(response.body)['data'];
|
||||||
|
print(result);
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
throw Exception(response.reasonPhrase);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
throw Exception(e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
import 'dart:core';
|
||||||
|
|
||||||
|
import 'package:unit2/model/passo/city.dart';
|
||||||
|
import 'package:unit2/sevices/offline/offline_passo/admin/sql_services/sql_services.dart';
|
||||||
|
import 'package:unit2/sevices/passo/municipality.dart';
|
||||||
|
import 'package:unit2/utils/request.dart';
|
||||||
|
import 'package:unit2/utils/urls.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
|
class MunicipalityAdminApiServices {
|
||||||
|
static final MunicipalityAdminApiServices _instance =
|
||||||
|
MunicipalityAdminApiServices();
|
||||||
|
static MunicipalityAdminApiServices get instance => _instance;
|
||||||
|
String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z";
|
||||||
|
String xClientKeySecret = "unitcYqAN7GGalyz";
|
||||||
|
|
||||||
|
Future<List> fetch() async {
|
||||||
|
String path = Url.instance.getMunicipality();
|
||||||
|
Map<String, String> headers = {
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
'X-Client-Key': xClientKey,
|
||||||
|
'X-Client-Secret': xClientKeySecret
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
http.Response response = await Request.instance
|
||||||
|
.getRequest(param: {}, path: path, headers: headers);
|
||||||
|
|
||||||
|
print(response.statusCode);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
final List result = jsonDecode(response.body)['data'];
|
||||||
|
print(result);
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
throw Exception(response.reasonPhrase);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
throw Exception(e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue