First commit PASSO App

dev
cyzoox 2023-07-28 10:35:36 +08:00
parent 33db598f6e
commit 5fc0f672bf
63 changed files with 6118 additions and 177 deletions

View File

@ -27,7 +27,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
ndkVersion "25.1.8937393"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8

View File

@ -0,0 +1,60 @@
import 'dart:convert';
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:unit2/model/passo/additional_items.dart';
import 'package:http/http.dart' as http;
import 'package:unit2/sevices/passo/building/additional_items_services.dart';
part 'additional_item_event.dart';
part 'additional_item_state.dart';
class AdditionalItemBloc
extends Bloc<AdditionalItemEvent, AdditionalItemState> {
AdditionalItemBloc() : super(AdditionalItemsLoading()) {
List<AdditionalItems> globalAdditionalItems = [];
on<LoadAdditionalItems>((event, emit) async {
emit(AdditionalItemsLoading());
try {
// final tempID = await SharedPreferences.getInstance();
// print(tempID.getInt('tempid'));
// final additionalItem = await GetAdditionalItems.getAdditionalItems(
// tempID.getInt('tempid'));
emit(AdditionalItemsLoaded(globalAdditionalItems));
} catch (e) {
emit(AdditionalItemsErrorState(e.toString()));
}
});
on<AddAdditionalItems>((event, emit) async {
http.Response response = (await AdditionalItemsServices.instance
.postAdditionalItems(event.items))!;
print(response.body);
if (response.statusCode == 201) {
var jsonResponse = jsonDecode(response.body);
AdditionalItems newAdditional =
AdditionalItems.fromJson(jsonResponse['data']);
print(jsonResponse['data']);
globalAdditionalItems.add(newAdditional);
emit(AdditionalItemsLoaded(globalAdditionalItems));
}
});
on<DeleteAdditionalItems>((event, emit) async {
print(event.id);
http.Response response = (await AdditionalItemsServices.instance
.removeAdditionalItems(event.id));
print(response.statusCode);
if (response.statusCode == 200) {
globalAdditionalItems
.removeWhere(((AdditionalItems element) => element.id == event.id));
emit(AdditionalItemsDeletedState(success: true));
}
});
on<ShowAdditionalItems>((event, emit) async {
emit(ShowAddItemsScreen());
});
}
}

View File

@ -0,0 +1,37 @@
part of 'additional_item_bloc.dart';
abstract class AdditionalItemEvent extends Equatable {
const AdditionalItemEvent();
@override
List<Object> get props => [];
}
class LoadAdditionalItems extends AdditionalItemEvent {
final List<AdditionalItems> items;
const LoadAdditionalItems({this.items = const <AdditionalItems>[]});
@override
List<Object> get props => [items];
}
class AddAdditionalItems extends AdditionalItemEvent {
final AdditionalItems items;
const AddAdditionalItems({required this.items});
@override
List<Object> get props => [items];
}
class DeleteAdditionalItems extends AdditionalItemEvent {
final int id;
const DeleteAdditionalItems({required this.id});
@override
List<Object> get props => [id];
}
class ShowAdditionalItems extends AdditionalItemEvent {}

View File

@ -0,0 +1,35 @@
part of 'additional_item_bloc.dart';
abstract class AdditionalItemState extends Equatable {
const AdditionalItemState();
@override
List<Object> get props => [];
}
class AdditionalItemsLoading extends AdditionalItemState {}
class AdditionalItemsLoaded extends AdditionalItemState {
const AdditionalItemsLoaded(this.items);
final List<AdditionalItems> items;
@override
List<Object> get props => [items];
}
class ShowAddItemsScreen extends AdditionalItemState {}
class AdditionalItemsErrorState extends AdditionalItemState {
const AdditionalItemsErrorState(this.error);
final String error;
@override
List<Object> get props => [error];
}
class AdditionalItemsDeletedState extends AdditionalItemState {
final bool success;
const AdditionalItemsDeletedState({required this.success});
@override
List<Object> get props => [success];
}

View File

@ -0,0 +1,22 @@
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:unit2/model/passo/class_components.dart';
import 'package:unit2/sevices/passo/class_components_services.dart';
part 'class_components_event.dart';
part 'class_components_state.dart';
class ClassComponentsBloc
extends Bloc<ClassComponentsEvent, ClassComponentsState> {
ClassComponentsBloc() : super(ClassComponentLoading()) {
on<LoadClassComponents>((event, emit) async {
emit(ClassComponentLoading());
try {
final classs = await ClassComponentService.instance.getClassComponent();
emit(ClassComponentLoaded(classs));
} catch (e) {
emit(ClassComponentErrorState(e.toString()));
}
});
}
}

View File

@ -0,0 +1,17 @@
part of 'class_components_bloc.dart';
abstract class ClassComponentsEvent extends Equatable {
const ClassComponentsEvent();
@override
List<Object> get props => [];
}
class LoadClassComponents extends ClassComponentsEvent {
final List<ClassComponents> classes;
const LoadClassComponents({this.classes = const <ClassComponents>[]});
@override
List<Object> get props => [classes];
}

View File

@ -0,0 +1,26 @@
part of 'class_components_bloc.dart';
abstract class ClassComponentsState extends Equatable {
const ClassComponentsState();
@override
List<Object> get props => [];
}
class ClassComponentLoading extends ClassComponentsState {}
class ClassComponentLoaded extends ClassComponentsState {
ClassComponentLoaded(this.classes);
final List<ClassComponents> classes;
@override
List<Object> get props => [classes];
}
class ClassComponentErrorState extends ClassComponentsState {
ClassComponentErrorState(this.error);
final String error;
@override
List<Object> get props => [error];
}

View File

@ -0,0 +1,13 @@
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
part 'location_event.dart';
part 'location_state.dart';
class LocationBloc extends Bloc<LocationEvent, LocationState> {
LocationBloc() : super(LocationInitial()) {
on<LocationEvent>((event, emit) {
// TODO: implement event handler
});
}
}

View File

@ -0,0 +1,8 @@
part of 'location_bloc.dart';
abstract class LocationEvent extends Equatable {
const LocationEvent();
@override
List<Object> get props => [];
}

View File

@ -0,0 +1,10 @@
part of 'location_bloc.dart';
abstract class LocationState extends Equatable {
const LocationState();
@override
List<Object> get props => [];
}
class LocationInitial extends LocationState {}

View File

@ -0,0 +1,45 @@
import 'dart:convert';
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:unit2/model/passo/property_appraisal.dart';
import 'package:http/http.dart' as http;
import 'package:unit2/sevices/passo/building/property_appraisal_services.dart';
part 'property_appraisal_event.dart';
part 'property_appraisal_state.dart';
class PropertyAppraisalBloc
extends Bloc<PropertyAppraisalEvent, PropertyAppraisalState> {
PropertyAppraisalBloc() : super(PropertyAppraisalInitial()) {
List<PropertyAppraisal> globalPropertyAppraisal = [];
on<LoadPropertyAppraisal>((event, emit) async {
emit(PropertyAppraisalLoading());
try {
final tempID = await SharedPreferences.getInstance();
final appraisal = await PropertyAppraisalServices.instance
.getPropertyAppraisal(tempID.getInt('tempid'));
emit(PropertyAppraisalLoaded(appraisal));
} catch (e) {
emit(PropertyAppraisalErrorState(e.toString()));
}
});
on<AddPropertyAppraisal>((event, emit) async {
http.Response response = (await PropertyAppraisalServices.instance
.postPropertyAppraisal(event.appraisal))!;
if (response.statusCode == 201) {
var jsonResponse = jsonDecode(response.body);
PropertyAppraisal newAppraisal =
PropertyAppraisal.fromJson(jsonResponse['data']);
print(jsonResponse['data']);
globalPropertyAppraisal.add(newAppraisal);
emit(PropertyAppraisalLoaded(globalPropertyAppraisal));
}
});
}
}

View File

@ -0,0 +1,26 @@
part of 'property_appraisal_bloc.dart';
abstract class PropertyAppraisalEvent extends Equatable {
const PropertyAppraisalEvent();
@override
List<Object> get props => [];
}
class LoadPropertyAppraisal extends PropertyAppraisalEvent {
final List<PropertyAppraisal> appraisal;
const LoadPropertyAppraisal({this.appraisal = const <PropertyAppraisal>[]});
@override
List<Object> get props => [appraisal];
}
class AddPropertyAppraisal extends PropertyAppraisalEvent {
final PropertyAppraisal appraisal;
const AddPropertyAppraisal({required this.appraisal});
@override
List<Object> get props => [appraisal];
}

View File

@ -0,0 +1,28 @@
part of 'property_appraisal_bloc.dart';
abstract class PropertyAppraisalState extends Equatable {
const PropertyAppraisalState();
@override
List<Object> get props => [];
}
class PropertyAppraisalInitial extends PropertyAppraisalState {}
class PropertyAppraisalLoading extends PropertyAppraisalState {}
class PropertyAppraisalLoaded extends PropertyAppraisalState {
PropertyAppraisalLoaded(this.appraisal);
final List<PropertyAppraisal> appraisal;
@override
List<Object> get props => [appraisal];
}
class PropertyAppraisalErrorState extends PropertyAppraisalState {
PropertyAppraisalErrorState(this.error);
final String error;
@override
List<Object> get props => [error];
}

View File

@ -0,0 +1,60 @@
import 'dart:convert';
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:unit2/model/passo/property_assessment.dart';
import 'package:http/http.dart' as http;
import 'package:unit2/sevices/passo/building/property_assessment_services.dart';
part 'property_assessment_event.dart';
part 'property_assessment_state.dart';
class PropertyAssessmentBloc
extends Bloc<PropertyAssessmentEvent, PropertyAssessmentState> {
PropertyAssessmentBloc() : super(PropertyAssessmentInitial()) {
List<PropertyAssessment> globalPropertyAssessment = [];
on<LoadPropertyAssessment>((event, emit) async {
emit(PropertyAssessmentLoading());
try {
final tempID = await SharedPreferences.getInstance();
final assessments = await PropertyAssessmentServices.instance
.getPropertyAssessment(tempID.getInt('tempid')! + 1);
emit(PropertyAssessmentLoaded(assessments));
} catch (e) {
emit(PropertyAssessmentErrorState(e.toString()));
}
});
on<AddPropertyAssessment>((event, emit) async {
http.Response response = (await PropertyAssessmentServices.instance
.postPropertyAssessment(event.assessments))!;
print('Assessment');
print(response.statusCode);
print(response.body);
if (response.statusCode == 201) {
var jsonResponse = jsonDecode(response.body);
PropertyAssessment newAssessment =
PropertyAssessment.fromJson(jsonResponse['data']);
globalPropertyAssessment.add(newAssessment);
emit(PropertyAssessmentLoaded(globalPropertyAssessment));
}
});
on<UpdatePropertyAssessment>((event, emit) async {
final tempID = await SharedPreferences.getInstance();
final tempID2 = tempID.getInt('tempid')! - 1;
http.Response response = (await PropertyAssessmentServices.instance
.propertyAssessmentPutInfo(event.assessment, tempID2))!;
print('assessment');
print(response.statusCode);
print(response.body);
// if (response.statusCode == 201) {
// final faas = await PropertyInfoRepository.getUsers();
// emit(FaasLoaded(faas));
// }
});
}
}

View File

@ -0,0 +1,38 @@
part of 'property_assessment_bloc.dart';
abstract class PropertyAssessmentEvent extends Equatable {
const PropertyAssessmentEvent();
@override
List<Object> get props => [];
}
class LoadPropertyAssessment extends PropertyAssessmentEvent {
final List<PropertyAssessment> assessments;
const LoadPropertyAssessment(
{this.assessments = const <PropertyAssessment>[]});
@override
List<Object> get props => [assessments];
}
class AddPropertyAssessment extends PropertyAssessmentEvent {
final PropertyAssessment assessments;
const AddPropertyAssessment({required this.assessments});
@override
List<Object> get props => [assessments];
}
class UpdatePropertyAssessment extends PropertyAssessmentEvent {
// ignore: non_constant_identifier_names
final PropertyAssessment assessment;
// ignore: non_constant_identifier_names
const UpdatePropertyAssessment({required this.assessment});
@override
List<Object> get props => [assessment];
}

View File

@ -0,0 +1,28 @@
part of 'property_assessment_bloc.dart';
abstract class PropertyAssessmentState extends Equatable {
const PropertyAssessmentState();
@override
List<Object> get props => [];
}
class PropertyAssessmentInitial extends PropertyAssessmentState {}
class PropertyAssessmentLoading extends PropertyAssessmentState {}
class PropertyAssessmentLoaded extends PropertyAssessmentState {
PropertyAssessmentLoaded(this.assessments);
final List<PropertyAssessment> assessments;
@override
List<Object> get props => [assessments];
}
class PropertyAssessmentErrorState extends PropertyAssessmentState {
PropertyAssessmentErrorState(this.error);
final String error;
@override
List<Object> get props => [error];
}

View File

@ -0,0 +1,59 @@
import 'dart:convert';
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:unit2/model/passo/bldg_loc.dart';
import 'package:unit2/model/passo/land_ref.dart';
import 'package:unit2/model/passo/property_info.dart';
import 'package:unit2/sevices/passo/building/property_info_services.dart';
import 'package:http/http.dart' as http;
part 'property_info_event.dart';
part 'property_info_state.dart';
class PropertyInfoBloc extends Bloc<PropertyInfoEvent, PropertyInfoState> {
PropertyInfoBloc() : super(PropertyInfoLoading()) {
on<LoadPropertyInfo>((event, emit) async {
emit(PropertyInfoLoading());
try {
final property_info =
await PropertyInfoService.instance.getpropertyInfo();
emit(PropertyInfoLoaded(property_info));
} catch (e) {
emit(PropertyInfoErrorState(e.toString()));
}
});
on<AddPropertyInfo>((event, emit) async {
final state = this.state;
http.Response response = (await PropertyInfoService.instance
.postPropertyInfo(event.property_info))!;
print(response.body);
if (response.statusCode == 201) {
var jsonResponse = jsonDecode(response.body);
final tempID = await SharedPreferences.getInstance();
print(jsonResponse['data']);
await tempID.setInt('tempid', jsonResponse['data']['id'] + 1);
final faas = await PropertyInfoService.instance.getpropertyInfo();
emit(PropertyInfoLoaded(faas));
}
});
on<UpdateBldgLoc>(((event, emit) async {
final state = this.state;
http.Response response = (await PropertyInfoService.instance
.bldgLocPutInfo(event.bldg_loc, event.bldg_loc.id))!;
print('bldgLoc');
print(response.statusCode);
}));
on<UpdateLandRef>(
(event, emit) async {
final state = this.state;
http.Response response = (await PropertyInfoService.instance
.landRefPutInfo(event.land_ref, event.land_ref.id))!;
print('landref');
print(response.statusCode);
},
);
}
}

View File

@ -0,0 +1,55 @@
part of 'property_info_bloc.dart';
abstract class PropertyInfoEvent extends Equatable {
const PropertyInfoEvent();
@override
List<Object> get props => [];
}
class LoadPropertyInfo extends PropertyInfoEvent {
final List<PropertyInfo> property_info;
const LoadPropertyInfo({this.property_info = const <PropertyInfo>[]});
@override
List<Object> get props => [property_info];
}
class AddPropertyInfo extends PropertyInfoEvent {
final PropertyInfo property_info;
const AddPropertyInfo({required this.property_info});
@override
List<Object> get props => [property_info];
}
class UpdateBldgLoc extends PropertyInfoEvent {
// ignore: non_constant_identifier_names
final BldgLoc bldg_loc;
// ignore: non_constant_identifier_names
const UpdateBldgLoc({required this.bldg_loc});
@override
List<Object> get props => [bldg_loc];
}
class UpdateLandRef extends PropertyInfoEvent {
final LandRef land_ref;
const UpdateLandRef({required this.land_ref});
@override
List<Object> get props => [land_ref];
}
// class UpdateGeneralDesc extends PropertyInfoEvent {
// final GeneralDesc gen_desc;
// const UpdateGeneralDesc({required this.gen_desc});
// @override
// List<Object> get props => [gen_desc];
// }

View File

@ -0,0 +1,26 @@
part of 'property_info_bloc.dart';
abstract class PropertyInfoState extends Equatable {
const PropertyInfoState();
@override
List<Object> get props => [];
}
class PropertyInfoLoading extends PropertyInfoState {}
class PropertyInfoLoaded extends PropertyInfoState {
const PropertyInfoLoaded(this.property_info);
final List<PropertyInfo> property_info;
@override
List<Object> get props => [property_info];
}
class PropertyInfoErrorState extends PropertyInfoState {
const PropertyInfoErrorState(this.error);
final String error;
@override
List<Object> get props => [error];
}

View File

@ -0,0 +1,21 @@
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:unit2/model/passo/signatories.dart';
import 'package:unit2/sevices/passo/signatories_service.dart';
part 'signatories_event.dart';
part 'signatories_state.dart';
class SignatoriesBloc extends Bloc<SignatoriesEvent, SignatoriesState> {
SignatoriesBloc() : super(SignatoriesInitial()) {
on<SignatoriesEvent>((event, emit) async {
emit(SignatoriesLoading());
try {
final signatories = await SignatoriesServices.instance.getSignatories();
emit(SignatoriesLoaded(signatories));
} catch (e) {
emit(SignatoriesErrorState(e.toString()));
}
});
}
}

View File

@ -0,0 +1,17 @@
part of 'signatories_bloc.dart';
abstract class SignatoriesEvent extends Equatable {
const SignatoriesEvent();
@override
List<Object> get props => [];
}
class LoadSignatories extends SignatoriesEvent {
final List<Signatories> signatories;
const LoadSignatories({this.signatories = const <Signatories>[]});
@override
List<Object> get props => [signatories];
}

View File

@ -0,0 +1,28 @@
part of 'signatories_bloc.dart';
abstract class SignatoriesState extends Equatable {
const SignatoriesState();
@override
List<Object> get props => [];
}
class SignatoriesInitial extends SignatoriesState {}
class SignatoriesLoading extends SignatoriesState {}
class SignatoriesLoaded extends SignatoriesState {
SignatoriesLoaded(this.signatories);
final List<Signatories> signatories;
@override
List<Object> get props => [signatories];
}
class SignatoriesErrorState extends SignatoriesState {
SignatoriesErrorState(this.error);
final String error;
@override
List<Object> get props => [error];
}

View File

@ -0,0 +1,21 @@
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:unit2/model/passo/unit_construct.dart';
import 'package:unit2/sevices/passo/unit_construct_services.dart';
part 'unit_construct_event.dart';
part 'unit_construct_state.dart';
class UnitConstructBloc extends Bloc<UnitConstructEvent, UnitConstructState> {
UnitConstructBloc() : super(UnitConstructLoading()) {
on<LoadUnitConstruct>((event, emit) async {
emit(UnitConstructLoading());
try {
final unit = await UnitConstructService.instance.getUnitConstruct();
emit(UnitConstructLoaded(unit));
} catch (e) {
emit(UnitConstructErrorState(e.toString()));
}
});
}
}

View File

@ -0,0 +1,17 @@
part of 'unit_construct_bloc.dart';
abstract class UnitConstructEvent extends Equatable {
const UnitConstructEvent();
@override
List<Object> get props => [];
}
class LoadUnitConstruct extends UnitConstructEvent {
final List<UnitConstruct> unit;
const LoadUnitConstruct({this.unit = const <UnitConstruct>[]});
@override
List<Object> get props => [unit];
}

View File

@ -0,0 +1,26 @@
part of 'unit_construct_bloc.dart';
abstract class UnitConstructState extends Equatable {
const UnitConstructState();
@override
List<Object> get props => [];
}
class UnitConstructLoading extends UnitConstructState {}
class UnitConstructLoaded extends UnitConstructState {
UnitConstructLoaded(this.unit);
final List<UnitConstruct> unit;
@override
List<Object> get props => [unit];
}
class UnitConstructErrorState extends UnitConstructState {
UnitConstructErrorState(this.error);
final String error;
@override
List<Object> get props => [error];
}

View File

@ -7,6 +7,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:hive/hive.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:unit2/bloc/passo/property_info/property_info_bloc.dart';
import 'package:unit2/bloc/profile/profile_bloc.dart';
import 'package:unit2/bloc/user/user_bloc.dart';
import 'package:unit2/theme-data.dart/colors.dart';
@ -17,8 +18,6 @@ import 'package:path_provider/path_provider.dart' as path_provider;
import './utils/router.dart';
import './utils/global.dart';
Future main() async {
WidgetsFlutterBinding.ensureInitialized();
var appDirectory = await path_provider.getApplicationDocumentsDirectory();
@ -66,6 +65,8 @@ class MyApp extends StatelessWidget {
BlocProvider(
create: (_) => ProfileBloc(),
),
BlocProvider(
create: (context) => PropertyInfoBloc()..add(LoadPropertyInfo())),
],
child: MaterialApp(
navigatorKey: NavigationService.navigatorKey,
@ -92,4 +93,3 @@ class MyApp extends StatelessWidget {
);
}
}

View File

@ -0,0 +1,93 @@
// To parse this JSON data, do
//
// final additionalItems = additionalItemsFromJson(jsonString);
import 'package:meta/meta.dart';
import 'dart:convert';
AdditionalItems additionalItemsFromJson(String str) =>
AdditionalItems.fromJson(json.decode(str));
String additionalItemsToJson(AdditionalItems data) =>
json.encode(data.toJson());
class AdditionalItems {
final int id;
final int bldgapprDetailsId;
final int classId;
final String className;
final String structType;
final dynamic unitValue;
final dynamic baseUnitValue;
final dynamic area;
final dynamic marketValue;
final dynamic depreciationRate;
final dynamic adjustedMarketVal;
final dynamic amtDepreciation;
final bool painted;
final bool secondhand;
final dynamic paintedUnitval;
final dynamic secondhandUnitval;
final String actualUse;
AdditionalItems({
required this.id,
required this.bldgapprDetailsId,
required this.classId,
required this.className,
required this.structType,
required this.unitValue,
required this.baseUnitValue,
required this.area,
required this.marketValue,
required this.depreciationRate,
required this.adjustedMarketVal,
required this.amtDepreciation,
required this.painted,
required this.secondhand,
required this.paintedUnitval,
required this.secondhandUnitval,
required this.actualUse,
});
factory AdditionalItems.fromJson(Map<String, dynamic> json) =>
AdditionalItems(
id: json["id"],
bldgapprDetailsId: json["bldgappr_details_id"],
classId: json["class_id"],
className: json["class_name"],
structType: json["struct_type"],
unitValue: json["unit_value"],
baseUnitValue: json["base_unit_value"],
area: json["area"],
marketValue: json["market_value"],
depreciationRate: json["depreciation_rate"],
adjustedMarketVal: json["adjusted_market_val"],
amtDepreciation: json["amt_depreciation"],
painted: json["painted"],
secondhand: json["secondhand"],
paintedUnitval: json["painted_unitval"],
secondhandUnitval: json["secondhand_unitval"],
actualUse: json["actual_use"],
);
Map<String, dynamic> toJson() => {
"id": id,
"bldgappr_details_id": bldgapprDetailsId,
"class_id": classId,
"class_name": className,
"struct_type": structType,
"unit_value": unitValue,
"base_unit_value": baseUnitValue,
"area": area,
"market_value": marketValue,
"depreciation_rate": depreciationRate,
"adjusted_market_val": adjustedMarketVal,
"amt_depreciation": amtDepreciation,
"painted": painted,
"secondhand": secondhand,
"painted_unitval": paintedUnitval,
"secondhand_unitval": secondhandUnitval,
"actual_use": actualUse,
};
}

View File

@ -0,0 +1,45 @@
// To parse this JSON data, do
//
// final bldgLoc = bldgLocFromJson(jsonString);
import 'dart:convert';
BldgLoc bldgLocFromJson(String str) => BldgLoc.fromJson(json.decode(str));
String bldgLocToJson(BldgLoc data) => json.encode(data.toJson());
class BldgLoc {
BldgLoc({
this.id,
this.bldgapprDetailsId,
this.street,
this.barangay,
this.municipality,
this.province,
});
final int? id;
final int? bldgapprDetailsId;
final String? street;
final String? barangay;
final String? municipality;
final String? province;
factory BldgLoc.fromJson(Map<String, dynamic> json) => BldgLoc(
id: json["id"],
bldgapprDetailsId: json["bldgappr_details_id"],
street: json["street"],
barangay: json["barangay"],
municipality: json["municipality"],
province: json["province"],
);
Map<String, dynamic> toJson() => {
"id": id,
"bldgappr_details_id": bldgapprDetailsId,
"street": street,
"barangay": barangay,
"municipality": municipality,
"province": province,
};
}

View File

@ -0,0 +1,93 @@
// To parse this JSON data, do
//
// final classComponents = classComponentsFromJson(jsonString);
import 'package:meta/meta.dart';
import 'dart:convert';
ClassComponents classComponentsFromJson(String str) =>
ClassComponents.fromJson(json.decode(str));
String classComponentsToJson(ClassComponents data) =>
json.encode(data.toJson());
class ClassComponents {
final int id;
final String componentName;
final String minBaseUnitvalPercent;
final String maxBaseUnitvalPercent;
final String minUnitvalSqrmtr;
final String maxUnitvalSqrmtr;
final String minAddBaseunitval;
final String maxAddBaseunitval;
final String minDeductBaserate;
final String maxDeductBaserate;
final String minLinearMeter;
final String maxLinearMeter;
final String minSpacing;
final String maxSpacing;
final String roughFinish;
final String highFinish;
final bool withoutBucc;
ClassComponents({
required this.id,
required this.componentName,
required this.minBaseUnitvalPercent,
required this.maxBaseUnitvalPercent,
required this.minUnitvalSqrmtr,
required this.maxUnitvalSqrmtr,
required this.minAddBaseunitval,
required this.maxAddBaseunitval,
required this.minDeductBaserate,
required this.maxDeductBaserate,
required this.minLinearMeter,
required this.maxLinearMeter,
required this.minSpacing,
required this.maxSpacing,
required this.roughFinish,
required this.highFinish,
required this.withoutBucc,
});
factory ClassComponents.fromJson(Map<String, dynamic> json) =>
ClassComponents(
id: json["id"],
componentName: json["component_name"],
minBaseUnitvalPercent: json["min_base_unitval_percent"],
maxBaseUnitvalPercent: json["max_base_unitval_percent"],
minUnitvalSqrmtr: json["min_unitval_sqrmtr"],
maxUnitvalSqrmtr: json["max_unitval_sqrmtr"],
minAddBaseunitval: json["min_add_baseunitval"],
maxAddBaseunitval: json["max_add_baseunitval"],
minDeductBaserate: json["min_deduct_baserate"],
maxDeductBaserate: json["max_deduct_baserate"],
minLinearMeter: json["min_linear_meter"],
maxLinearMeter: json["max_linear_meter"],
minSpacing: json["min_spacing"],
maxSpacing: json["max_spacing"],
roughFinish: json["rough_finish"],
highFinish: json["high_finish"],
withoutBucc: json["without_bucc"],
);
Map<String, dynamic> toJson() => {
"id": id,
"component_name": componentName,
"min_base_unitval_percent": minBaseUnitvalPercent,
"max_base_unitval_percent": maxBaseUnitvalPercent,
"min_unitval_sqrmtr": minUnitvalSqrmtr,
"max_unitval_sqrmtr": maxUnitvalSqrmtr,
"min_add_baseunitval": minAddBaseunitval,
"max_add_baseunitval": maxAddBaseunitval,
"min_deduct_baserate": minDeductBaserate,
"max_deduct_baserate": maxDeductBaserate,
"min_linear_meter": minLinearMeter,
"max_linear_meter": maxLinearMeter,
"min_spacing": minSpacing,
"max_spacing": maxSpacing,
"rough_finish": roughFinish,
"high_finish": highFinish,
"without_bucc": withoutBucc,
};
}

View File

@ -0,0 +1,57 @@
// To parse this JSON data, do
//
// final landRef = landRefFromJson(jsonString);
import 'dart:convert';
LandRef landRefFromJson(String str) => LandRef.fromJson(json.decode(str));
String landRefToJson(LandRef data) => json.encode(data.toJson());
class LandRef {
LandRef({
this.id,
this.bldgapprDetailsId,
this.owner,
this.cloaNo,
this.lotNo,
this.tdn,
this.area,
this.surveyNo,
this.blkNo,
});
final int? id;
final int? bldgapprDetailsId;
final String? owner;
final String? cloaNo;
final String? lotNo;
final String? tdn;
final String? area;
final String? surveyNo;
final String? blkNo;
factory LandRef.fromJson(Map<String, dynamic> json) => LandRef(
id: json["id"],
bldgapprDetailsId: json["bldgappr_details_id"],
owner: json["owner"],
cloaNo: json["cloa_no"],
lotNo: json["lot_no"],
tdn: json["tdn"],
area: json["area"],
surveyNo: json["survey_no"],
blkNo: json["blk_no"],
);
Map<String, dynamic> toJson() => {
"id": id,
"bldgappr_details_id": bldgapprDetailsId,
"owner": owner,
"cloa_no": cloaNo,
"lot_no": lotNo,
"tdn": tdn,
"area": area,
"survey_no": surveyNo,
"blk_no": blkNo,
};
}

View File

@ -0,0 +1,68 @@
// To parse this JSON data, do
//
// final propertyAppraisal = propertyAppraisalFromJson(jsonString);
import 'dart:convert';
PropertyAppraisal propertyAppraisalFromJson(String str) =>
PropertyAppraisal.fromJson(json.decode(str));
String propertyAppraisalToJson(PropertyAppraisal data) =>
json.encode(data.toJson());
class PropertyAppraisal {
final int id;
final int bldgapprDetailsId;
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;
PropertyAppraisal({
required this.id,
required this.bldgapprDetailsId,
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,
});
factory PropertyAppraisal.fromJson(Map<String, dynamic> json) =>
PropertyAppraisal(
id: json["id"],
bldgapprDetailsId: json["bldgappr_details_id"],
unitconstructCost: json["unitconstruct_cost"],
buildingCore: json["building_core"],
unitconstructSubtotal: json["unitconstruct_subtotal"],
depreciationRate: json["depreciation_rate"],
depreciationCost: json["depreciation_cost"],
costAddItems: json["cost_add_items"],
addItemsSubtotal: json["add_items_subtotal"],
totalpercentDepreciation: json["totalpercent_depreciation"],
marketValue: json["market_value"],
);
Map<String, dynamic> toJson() => {
"id": id,
"bldgappr_details_id": bldgapprDetailsId,
"unitconstruct_cost": unitconstructCost,
"building_core": buildingCore,
"unitconstruct_subtotal": unitconstructSubtotal,
"depreciation_rate": depreciationRate,
"depreciation_cost": depreciationCost,
"cost_add_items": costAddItems,
"add_items_subtotal": addItemsSubtotal,
"totalpercent_depreciation": totalpercentDepreciation,
"market_value": marketValue,
};
}

View File

@ -0,0 +1,109 @@
// To parse this JSON data, do
//
// final propertyAssessment = propertyAssessmentFromJson(jsonString);
import 'package:meta/meta.dart';
import 'dart:convert';
PropertyAssessment propertyAssessmentFromJson(String str) =>
PropertyAssessment.fromJson(json.decode(str));
String propertyAssessmentToJson(PropertyAssessment data) =>
json.encode(data.toJson());
class PropertyAssessment {
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;
PropertyAssessment({
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,
});
factory PropertyAssessment.fromJson(Map<String, dynamic> json) =>
PropertyAssessment(
id: json["id"],
bldgapprDetailsId: json["bldgappr_details_id"],
actualUse: json["actual_use"],
marketValue: json["market_value"],
assessmentLevel: json["assessment_level"],
assessedValue: json["assessed_value"],
taxable: json["taxable"],
exempt: json["exempt"],
qtr: json["qtr"],
yr: json["yr"],
appraisedbyName: json["appraisedby_name"],
appraisedbyDate: DateTime.parse(json["appraisedby_date"]),
recommendapprName: json["recommendappr_name"],
recommendapprDate: DateTime.parse(json["recommendappr_date"]),
approvedbyName: json["approvedby_name"],
memoranda: json["memoranda"],
swornstatementNo: json["swornstatement_no"],
dateReceived: DateTime.parse(json["date_received"]),
entryDateAssessment: DateTime.parse(json["entry_date_assessment"]),
entryDateBy: json["entry_date_by"],
);
Map<String, dynamic> toJson() => {
"id": id,
"bldgappr_details_id": bldgapprDetailsId,
"actual_use": actualUse,
"market_value": marketValue,
"assessment_level": assessmentLevel,
"assessed_value": assessedValue,
"taxable": taxable,
"exempt": exempt,
"qtr": qtr,
"yr": yr,
"appraisedby_name": appraisedbyName,
"appraisedby_date":
"${appraisedbyDate.year.toString().padLeft(4, '0')}-${appraisedbyDate.month.toString().padLeft(2, '0')}-${appraisedbyDate.day.toString().padLeft(2, '0')}",
"recommendappr_name": recommendapprName,
"recommendappr_date":
"${recommendapprDate.year.toString().padLeft(4, '0')}-${recommendapprDate.month.toString().padLeft(2, '0')}-${recommendapprDate.day.toString().padLeft(2, '0')}",
"approvedby_name": approvedbyName,
"memoranda": memoranda,
"swornstatement_no": swornstatementNo,
"date_received":
"${dateReceived.year.toString().padLeft(4, '0')}-${dateReceived.month.toString().padLeft(2, '0')}-${dateReceived.day.toString().padLeft(2, '0')}",
"entry_date_assessment":
"${entryDateAssessment.year.toString().padLeft(4, '0')}-${entryDateAssessment.month.toString().padLeft(2, '0')}-${entryDateAssessment.day.toString().padLeft(2, '0')}",
"entry_date_by": entryDateBy,
};
}

View File

@ -0,0 +1,90 @@
// To parse this JSON data, do
//
// final propertyInfo = propertyInfoFromJson(jsonString);
import 'dart:convert';
PropertyInfo propertyInfoFromJson(String str) =>
PropertyInfo.fromJson(json.decode(str));
String propertyInfoToJson(PropertyInfo data) => json.encode(data.toJson());
class PropertyInfo {
final int? id;
final String? assessedById;
final String? assessedByName;
final DateTime? dateCreated;
final DateTime? dateModified;
final String? transCode;
final String? tdn;
final String? pin;
final String? owner;
final String? address;
final String? telno;
final String? tin;
final String? adminUser;
final String? adminAddress;
final String? adminTelno;
final String? adminTin;
PropertyInfo({
this.id,
this.assessedById,
this.assessedByName,
this.dateCreated,
this.dateModified,
this.transCode,
this.tdn,
this.pin,
this.owner,
this.address,
this.telno,
this.tin,
this.adminUser,
this.adminAddress,
this.adminTelno,
this.adminTin,
});
factory PropertyInfo.fromJson(Map<String, dynamic> json) => PropertyInfo(
id: json["id"],
assessedById: json["assessed_by_id"],
assessedByName: json["assessed_by_name"],
dateCreated: json["date_created"] == null
? null
: DateTime.parse(json["date_created"]),
dateModified: json["date_modified"] == null
? null
: DateTime.parse(json["date_modified"]),
transCode: json["trans_code"],
tdn: json["tdn"],
pin: json["pin"],
owner: json["owner"],
address: json["address"],
telno: json["telno"],
tin: json["tin"],
adminUser: json["admin_user"],
adminAddress: json["admin_address"],
adminTelno: json["admin_telno"],
adminTin: json["admin_tin"],
);
Map<String, dynamic> toJson() => {
"id": id,
"assessed_by_id": assessedById,
"assessed_by_name": assessedByName,
"date_created": dateCreated?.toIso8601String(),
"date_modified": dateModified?.toIso8601String(),
"trans_code": transCode,
"tdn": tdn,
"pin": pin,
"owner": owner,
"address": address,
"telno": telno,
"tin": tin,
"admin_user": adminUser,
"admin_address": adminAddress,
"admin_telno": adminTelno,
"admin_tin": adminTin,
};
}

View File

@ -0,0 +1,42 @@
// To parse this JSON data, do
//
// final signatories = signatoriesFromJson(jsonString);
import 'dart:convert';
Signatories signatoriesFromJson(String str) =>
Signatories.fromJson(json.decode(str));
String signatoriesToJson(Signatories data) => json.encode(data.toJson());
class Signatories {
final int? id;
final int signatoryId;
final String firstname;
final String middlename;
final String lastname;
Signatories({
this.id,
required this.signatoryId,
required this.firstname,
required this.middlename,
required this.lastname,
});
factory Signatories.fromJson(Map<String, dynamic> json) => Signatories(
id: json["id"],
signatoryId: json["signatory_id"],
firstname: json["firstname"],
middlename: json["middlename"],
lastname: json["lastname"],
);
Map<String, dynamic> toJson() => {
"id": id,
"signatory_id": signatoryId,
"firstname": firstname,
"middlename": middlename,
"lastname": lastname,
};
}

View File

@ -0,0 +1,38 @@
// To parse this JSON data, do
//
// final unitConstruct = unitConstructFromJson(jsonString);
import 'dart:convert';
UnitConstruct unitConstructFromJson(String str) =>
UnitConstruct.fromJson(json.decode(str));
String unitConstructToJson(UnitConstruct data) => json.encode(data.toJson());
class UnitConstruct {
final int id;
final String bldgType;
final String building;
final String unitValue;
UnitConstruct({
required this.id,
required this.bldgType,
required this.building,
required this.unitValue,
});
factory UnitConstruct.fromJson(Map<String, dynamic> json) => UnitConstruct(
id: json["id"],
bldgType: json["bldg_type"],
building: json["building"],
unitValue: json["unit_value"],
);
Map<String, dynamic> toJson() => {
"id": id,
"bldg_type": bldgType,
"building": building,
"unit_value": unitValue,
};
}

View File

@ -0,0 +1,237 @@
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/passo/class_components/class_components_bloc.dart';
import 'package:unit2/bloc/passo/property_info/property_info_bloc.dart';
import 'package:unit2/bloc/passo/unit_construct/unit_construct_bloc.dart';
import 'package:unit2/model/passo/bldg_loc.dart';
import 'package:unit2/model/passo/class_components.dart';
import 'package:unit2/model/passo/land_ref.dart';
import 'package:unit2/model/passo/property_info.dart';
import 'package:unit2/screens/passo/Building/add_building_components/additional_items.dart';
import 'package:unit2/screens/passo/Building/add_building_components/bldg_location_landref.dart';
import 'package:unit2/screens/passo/Building/add_building_components/general_description.dart';
import 'package:unit2/screens/passo/Building/add_building_components/property_appraisal.dart';
import 'package:unit2/screens/passo/Building/add_building_components/property_assessment.dart';
import 'package:unit2/screens/passo/Building/add_building_components/property_info.dart';
import 'package:unit2/screens/passo/Building/add_building_components/structural_materials.dart';
import 'package:unit2/theme-data.dart/colors.dart';
import 'package:im_stepper/stepper.dart';
GlobalKey<FormBuilderState> formKey = GlobalKey<FormBuilderState>();
class AddBuilding extends StatefulWidget {
@override
_AddBuilding createState() => _AddBuilding();
}
class _AddBuilding extends State<AddBuilding> {
int activeStep = 0; // Initial step set to 5.
int upperBound = 6;
bool saveStep1 = false;
bool saveStep2 = false;
bool saveStep3 = false;
bool saveStep4 = false;
bool saveStep5 = false;
bool saveStep6 = false;
bool saveStep7 = false;
int tempId = 0;
void onPostPropertyInfo() {
formKey.currentState?.save();
if (formKey.currentState!.value['transaction_code'].toString() != null &&
formKey.currentState!.value['owner'] != null) {
if (activeStep < upperBound && saveStep1 == false) {
setState(() {
activeStep++;
saveStep1 = true;
});
} else {
setState(() {
activeStep++;
});
}
var property_info = PropertyInfo(
id: 1,
transCode: formKey.currentState!.value['transaction_code'].toString(),
tdn: formKey.currentState!.value['arp_td'],
pin: formKey.currentState!.value['pin'],
owner: formKey.currentState!.value['owner'],
address: formKey.currentState!.value['address'],
telno: formKey.currentState!.value['tel_no'],
tin: formKey.currentState!.value['tin'],
adminUser: formKey.currentState!.value['benificiary'],
adminAddress: formKey.currentState!.value['benificiary_address'],
adminTin: formKey.currentState!.value['benificiary_tin'],
adminTelno: formKey.currentState!.value['benificiary_telno'],
assessedById: '1',
assessedByName: 'Cyril',
dateModified: DateTime.now(),
dateCreated: DateTime.now());
context
.read<PropertyInfoBloc>()
.add(AddPropertyInfo(property_info: property_info));
// _loadTempId();
}
}
void onPutBldgLandref() {
// Increment activeStep, when the next button is tapped. However, check for upper bound.
if (activeStep < upperBound && saveStep2 == false) {
setState(() {
activeStep++;
saveStep2 = true;
});
}
var bldgLocData = BldgLoc(
id: tempId,
street: formKey.currentState?.value['street'],
barangay: formKey.currentState?.value['brgy'],
municipality: formKey.currentState?.value['municipality'],
province: formKey.currentState?.value['province'],
);
var landRefData = LandRef(
id: tempId,
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));
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: primary,
centerTitle: true,
title: const Text("Building FAAS"),
),
body: ProgressHUD(
padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocConsumer<PropertyInfoBloc, PropertyInfoState>(listener: (
context,
state,
) {
if (state is PropertyInfoLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is PropertyInfoLoaded ||
state is PropertyInfoErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
}, builder: (context, state) {
if (state is PropertyInfoLoaded) {
return BlocConsumer<UnitConstructBloc, UnitConstructState>(
listener: (context, state) {
// TODO: implement listener
},
builder: (context, state) {
if (state is UnitConstructLoaded) {
final unit = state.unit;
return BlocConsumer<ClassComponentsBloc,
ClassComponentsState>(
listener: (context, state) {
// TODO: implement listener
},
builder: (context, state) {
if (state is ClassComponentLoaded) {
return Column(
children: [
NumberStepper(
numbers: [1, 2, 3, 4, 5, 6, 7],
stepPadding: 5,
activeStepColor: Colors.red,
numberStyle:
const TextStyle(color: Colors.white),
activeStepBorderColor: Colors.white,
// activeStep property set to activeStep variable defined above.
activeStep: activeStep,
// This ensures step-tapping updates the activeStep.
onStepReached: (index) {
setState(() {
activeStep = index;
});
},
),
Expanded(
child: FormBuilder(
key: formKey,
// enabled: false,
onChanged: () {
formKey.currentState?.save();
print(formKey.currentState?.value.toString());
},
autovalidateMode: AutovalidateMode.disabled,
skipDisabled: true,
child: Container(
child: content(
onPostPropertyInfo, unit, state.classes),
),
)),
],
);
}
return Container();
},
);
}
return Container();
},
);
}
return Container();
})),
);
}
Widget content(handleButtonPress, unit, List<ClassComponents> classes) {
switch (activeStep) {
case 0:
return PropertyInfoPage(onPostPropertyInfo);
case 1:
return BldgLocationLandrefPage();
case 2:
return GeneralDescriptionPage(unit);
case 3:
return StructuralMaterialsPage();
case 4:
return AdditionalItemPage(unit, classes);
case 5:
return PropertyAppraisalPage();
case 6:
return PropertyAssessmentPage(onSAveAll);
default:
return Text("Property Info");
}
}
void onSAveAll() {
return Navigator.of(context).pop();
}
}

View File

@ -0,0 +1,568 @@
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/passo/additional_item/additional_item_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';
class AddExtraItems extends StatefulWidget {
final List<UnitConstruct> unit;
final List<ClassComponents> options;
AddExtraItems(this.unit, this.options);
@override
_AddExtraItems createState() => _AddExtraItems();
}
class _AddExtraItems extends State<AddExtraItems> {
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;
double _notPaintedUnitVal = 0;
double _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;
print(deductions);
return (((unitVal - deductions) * unitBase) * area);
} else {
return ((unitVal * unitBase) * area);
}
} else {
return (unitVal * area);
}
}
@override
Widget build(BuildContext context) {
return BlocBuilder<AdditionalItemBloc, AdditionalItemState>(
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: 1000,
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.00;
} else {
_notPaintedUnitVal = 0.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 = 0.05;
formKey.currentState!.patchValue(
{'secondHandMat': '0.05'});
}
});
},
),
const SizedBox(width: 10),
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 =
double.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: 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: () {
var itemss = AdditionalItems(
id: 1,
bldgapprDetailsId: 528,
classId: _classId,
className: _className,
structType: _structureType,
unitValue: _unitValue,
baseUnitValue: _unitBase,
area: _areaValue,
marketValue:
(_unitValue * _unitBase) * _areaValue,
depreciationRate: _depValue,
adjustedMarketVal: _adjustedMarketValue(
_unitValue,
_unitBase,
_areaValue,
_depValue,
),
actualUse: 'Test',
amtDepreciation: _amountofDepreciation(
_unitValue,
_unitBase,
_areaValue,
_depValue,
),
painted: true,
secondhand: true,
paintedUnitval: '1',
secondhandUnitval: '1');
context
.read<AdditionalItemBloc>()
.add(AddAdditionalItems(items: itemss));
},
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<AdditionalItemBloc>()
.add(LoadAdditionalItems());
},
style: ElevatedButton.styleFrom(
primary: Colors.black,
),
child: const Text("Cancel"),
),
),
],
)
],
),
),
)));
}
return Container();
});
}
}

View File

@ -0,0 +1,13 @@
import 'package:flutter/material.dart';
class ExtraItemsPage extends StatefulWidget {
@override
_ExtraItemsPage createState() => _ExtraItemsPage();
}
class _ExtraItemsPage extends State<ExtraItemsPage> {
@override
Widget build(BuildContext context) {
return Container();
}
}

View File

@ -0,0 +1,233 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:unit2/bloc/passo/additional_item/additional_item_bloc.dart';
import 'package:unit2/model/passo/class_components.dart';
import 'package:unit2/model/passo/unit_construct.dart';
import 'package:unit2/screens/passo/Building/add_building_components/AddExtraItems.dart';
import 'package:unit2/utils/alerts.dart';
class AdditionalItemPage extends StatefulWidget {
final List<UnitConstruct> unit;
final List<ClassComponents> options;
AdditionalItemPage(this.unit, this.options);
@override
_AdditionalItemPage createState() => _AdditionalItemPage();
}
class _AdditionalItemPage extends State<AdditionalItemPage> {
void deleteItem(int itemId) {
context.read<AdditionalItemBloc>().add(DeleteAdditionalItems(id: itemId));
}
@override
Widget build(BuildContext context) {
return BlocConsumer<AdditionalItemBloc, AdditionalItemState>(
listener: (context, state) {
// TODO: implement listener
},
builder: (context, state) {
final state = context.watch<AdditionalItemBloc>().state;
if (state is AdditionalItemsLoaded) {
return 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<AdditionalItemBloc>()
.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.items.map((dataRow) {
return DataRow(
cells: [
DataCell(Text(dataRow.className)),
DataCell(Text(dataRow.baseUnitValue)),
DataCell(Text(dataRow.unitValue)),
DataCell(Text(((double.parse(dataRow.unitValue) *
double.parse(dataRow.baseUnitValue) *
double.parse(dataRow.area)))
.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(),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [Text('Total'), Text("0.00")],
)
],
),
),
);
}
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<AdditionalItemBloc>()
.add(const LoadAdditionalItems());
});
});
}
}
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: AddExtraItems(widget.unit, widget.options))
],
),
),
);
}
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<AdditionalItemBloc>()
.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,
),
],
),
),
),
],
),
);
},
);
}
}

View File

@ -0,0 +1,130 @@
import 'package:flutter/material.dart';
import 'package:unit2/widgets/passo/custom_button.dart';
import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart';
class BldgLocationLandrefPage extends StatefulWidget {
BldgLocationLandrefPage();
@override
_BldgLocationLandrefPage createState() => _BldgLocationLandrefPage();
}
class _BldgLocationLandrefPage extends State<BldgLocationLandrefPage> {
@override
Widget build(BuildContext context) {
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(
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: customTextField("Brgy. / District", "", 'brgy'))
]),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Expanded(
flex: 1,
child: customTextField("Municipality", "", 'municipality'),
),
const SizedBox(width: 10.0),
Expanded(
// optional flex property if flex is 1 because the default flex is 1
flex: 1,
child: customTextField("Province / City", "", 'province'))
]),
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: () {
{}
;
},
),
CustomButton(
icon: const Icon(Icons.chevron_right_rounded,
color: Colors.white),
onPressed: () {
{}
;
},
)
],
)
],
),
),
);
}
}

View File

@ -0,0 +1,179 @@
import 'package:flutter/material.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:unit2/model/passo/unit_construct.dart';
import 'package:unit2/theme-data.dart/form-style.dart';
import 'package:unit2/widgets/passo/custom_button.dart';
import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart';
class GeneralDescriptionPage extends StatefulWidget {
final List<UnitConstruct> unit;
GeneralDescriptionPage(this.unit);
@override
_GeneralDescriptionPage createState() => _GeneralDescriptionPage();
}
class _GeneralDescriptionPage extends State<GeneralDescriptionPage> {
final actual_use = [
"Residential",
"Agricultural",
"Commercial",
"Industrial",
"Mineral",
"Timberland",
];
@override
Widget build(BuildContext context) {
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: widget.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: () {
{}
;
},
),
CustomButton(
icon: const Icon(Icons.chevron_right_rounded,
color: Colors.white),
onPressed: () {
{}
;
},
)
],
)
],
),
),
);
}
}

View File

@ -0,0 +1,330 @@
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:unit2/bloc/passo/additional_item/additional_item_bloc.dart';
import 'package:unit2/model/passo/additional_items.dart';
import 'package:unit2/screens/passo/Building/add_building.dart';
import 'package:unit2/theme-data.dart/form-style.dart';
class PropertyAppraisalPage extends StatefulWidget {
PropertyAppraisalPage();
@override
_PropertyAppraisalPage createState() => _PropertyAppraisalPage();
}
class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
double depRate = 0;
calculateAdditionalItems(List<AdditionalItems> items) {
double sum = 0;
double product = 1;
for (AdditionalItems value in items) {
sum += double.parse(value.adjustedMarketVal);
}
return sum;
}
calculateTotalConstructionCost(buildingCost, additionalItems) {
double sum = 0;
double product = 1;
sum = buildingCost + calculateAdditionalItems(additionalItems);
return sum;
}
calculateMarketValue(buildingCost, additionalItems, dep) {
double sum = 0;
double depreciation = 0;
double total = 0;
sum = buildingCost + calculateAdditionalItems(additionalItems);
depreciation = sum * dep;
total = sum - depreciation;
return total;
}
calculateDepCost(buildingCost, additionalItems, dep) {
double sum = 0;
double depreciation = 0;
double total = 0;
sum = buildingCost + calculateAdditionalItems(additionalItems);
depreciation = sum * dep;
total = sum - depreciation;
return depreciation;
}
@override
Widget build(BuildContext context) {
return BlocConsumer<AdditionalItemBloc, AdditionalItemState>(
listener: (context, state) {
// TODO: implement listener
},
builder: (context, state) {
if (state is AdditionalItemsLoaded) {
return SingleChildScrollView(
child: Container(
margin: const EdgeInsets.only(left: 20.0, right: 20.0),
child: Column(
children: [
Container(
margin: const EdgeInsets.only(
left: 0, top: 20, right: 0, bottom: 20),
child: const Text('PROPERTY APPRAISAL',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 18),
textAlign: TextAlign.left),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
child: Text(
"Unit Construction Cost",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 13),
textAlign: TextAlign.left,
),
),
Container(
child: Text(
formKey.currentState!.value['bldg_type'].unitValue +
' sq.m',
textAlign: TextAlign.right,
),
)
],
),
const SizedBox(height: 15),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
child: Text(
"Building Core",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 13),
textAlign: TextAlign.left,
),
),
Container(
child: Text(
'',
textAlign: TextAlign.right,
),
)
],
),
const SizedBox(height: 40),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
child: Text(
"Sub-total",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 13),
textAlign: TextAlign.left,
),
),
Container(
child: Text(
(double.parse(formKey
.currentState!.value['total_area']) *
double.parse(formKey.currentState!
.value['bldg_type'].unitValue))
.toString(),
textAlign: TextAlign.right,
),
)
],
),
const SizedBox(height: 40),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
child: Text(
"Cost of Additional Items",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 13),
textAlign: TextAlign.left,
),
),
Container(
child: Text(
'',
textAlign: TextAlign.right,
),
)
],
),
const SizedBox(height: 15),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
child: Text(
"Sub-total",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 13),
textAlign: TextAlign.left,
),
),
Container(
child: Text(
calculateAdditionalItems(state.items).toString(),
textAlign: TextAlign.right,
),
)
],
),
const SizedBox(height: 15),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
child: Text(
"Total Construction Cost",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 13),
textAlign: TextAlign.left,
),
),
Container(
child: Text(
calculateTotalConstructionCost(
(double.parse(formKey
.currentState!.value['total_area']) *
double.parse(formKey.currentState!
.value['bldg_type'].unitValue)),
state.items)
.toString(),
textAlign: TextAlign.right,
),
)
],
),
const SizedBox(height: 40),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
child: Text(
"Depreciation Rate",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 13),
textAlign: TextAlign.left,
),
),
SizedBox(
width: 90,
height: 25,
child: FormBuilderTextField(
name: 'depRate',
decoration: normalTextFieldStyle("0.00", ""),
validator: FormBuilderValidators.compose([]),
onChanged: (value) {
setState(() {
depRate = double.parse(value!);
});
},
),
),
],
),
const SizedBox(height: 15),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
child: Text(
"Depreciation Cost",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 13),
textAlign: TextAlign.left,
),
),
Container(
child: Text(
calculateDepCost(
(double.parse(formKey
.currentState!.value['total_area']) *
double.parse(formKey.currentState!
.value['bldg_type'].unitValue)),
state.items,
depRate)
.toString(),
textAlign: TextAlign.right,
),
)
],
),
const SizedBox(height: 15),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
child: Text(
"Total % Depreciation",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 13),
textAlign: TextAlign.left,
),
),
Container(
child: Text(
'0.00',
textAlign: TextAlign.right,
),
)
],
),
const SizedBox(height: 15),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
child: Text(
"Market Value",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 13),
textAlign: TextAlign.left,
),
),
Container(
child: Text(
calculateMarketValue(
(double.parse(formKey
.currentState!.value['total_area']) *
double.parse(formKey.currentState!
.value['bldg_type'].unitValue)),
state.items,
depRate)
.toString(),
textAlign: TextAlign.right,
),
)
],
)
],
),
),
);
}
return Container();
},
);
}
}

View File

@ -0,0 +1,113 @@
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:shared_preferences/shared_preferences.dart';
import 'package:unit2/widgets/passo/custom_button.dart';
import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart';
class PropertyInfoPage extends StatefulWidget {
final VoidCallback handleButtonPress;
PropertyInfoPage(this.handleButtonPress);
@override
_PropertyInfoPage createState() => _PropertyInfoPage();
}
class _PropertyInfoPage extends State<PropertyInfoPage> {
int tempId = 0;
final transaction_codes = ['New', 'Revision'];
Future<void> _loadTempId() async {
final prefs = await SharedPreferences.getInstance();
setState(() {
tempId = (prefs.getInt('tempid') ?? 0);
});
}
@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: () {
widget.handleButtonPress();
},
)
]),
),
);
}
}

View File

@ -0,0 +1,228 @@
import 'package:flutter/material.dart';
import 'package:multiselect/multiselect.dart';
class MaterialOption {
final String id;
final String label;
MaterialOption(this.id, this.label);
}
class StructuralMaterialsPage extends StatefulWidget {
@override
_StructuralMaterialsPage createState() => _StructuralMaterialsPage();
}
class _StructuralMaterialsPage extends State<StructuralMaterialsPage> {
List<String> foundation = [];
List<String> column = [];
List<String> beam = [];
List<String> truss_framing = [];
List<String> roof = [];
List<String> flooring = [];
List<String> walls = [];
List<MaterialOption> columnOptions = [
MaterialOption('steel', 'Steel'),
MaterialOption('concrete', 'Reinforced Concrete'),
MaterialOption('wood', 'Wood'),
];
List<String> selectedColumnValues = [];
@override
Widget build(BuildContext context) {
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),
),
const Align(
alignment: Alignment.centerLeft,
child: Text(
'FOUNDATION',
textAlign: TextAlign.start,
),
),
Padding(
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
// DropDownMultiSelect comes from multiselect
child: 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',
),
),
const Align(
alignment: Alignment.centerLeft,
child: Text(
'COLUMNS',
textAlign: TextAlign.start,
),
),
Padding(
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
// DropDownMultiSelect comes from multiselect
child: 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 Columns',
),
),
const Align(
alignment: Alignment.centerLeft,
child: Text(
'BEAMS',
textAlign: TextAlign.start,
),
),
Padding(
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
// DropDownMultiSelect comes from multiselect
child: 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 Beams',
),
),
const Align(
alignment: Alignment.centerLeft,
child: Text(
'TRUSS FRAMING',
textAlign: TextAlign.start,
),
),
Padding(
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
// DropDownMultiSelect comes from multiselect
child: 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',
),
),
const Align(
alignment: Alignment.centerLeft,
child: Text(
'ROOF',
textAlign: TextAlign.start,
),
),
Padding(
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
// DropDownMultiSelect comes from multiselect
child: 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 Roofs',
),
),
const Align(
alignment: Alignment.centerLeft,
child: Text(
'FLOORING',
textAlign: TextAlign.start,
),
),
Padding(
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
// DropDownMultiSelect comes from multiselect
child: 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 Floorings',
),
),
const Align(
alignment: Alignment.centerLeft,
child: Text(
'WALLS & PARTITIONS',
textAlign: TextAlign.start,
),
),
Padding(
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
// DropDownMultiSelect comes from multiselect
child: 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 Foundation',
),
),
],
),
);
}
}

View File

@ -0,0 +1,94 @@
import 'package:flutter/material.dart';
import 'package:multiselect/multiselect.dart';
class Multi_Select extends StatelessWidget {
const Multi_Select();
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
brightness: Brightness.light,
primarySwatch: Colors.red,
primaryColor: Colors.red,
primaryColorLight: Colors.redAccent,
inputDecorationTheme: const InputDecorationTheme(
filled: true,
fillColor: Color(0xFFEEEEEE),
),
),
themeMode: ThemeMode.dark,
darkTheme: ThemeData(
brightness: Brightness.dark,
primarySwatch: Colors.red,
primaryColor: Colors.red,
primaryColorLight: Colors.redAccent,
appBarTheme: const AppBarTheme(backgroundColor: Color(0xFF1b1926)),
snackBarTheme: const SnackBarThemeData(backgroundColor: Colors.red),
canvasColor: const Color(0xFF272537),
dialogBackgroundColor: const Color(0xFF343346),
inputDecorationTheme: const InputDecorationTheme(
filled: true,
fillColor: Color(0xFF383849),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.transparent),
borderRadius: BorderRadius.all(
Radius.circular(35.0),
),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.transparent),
borderRadius: BorderRadius.all(
Radius.circular(35.0),
),
),
),
),
home: const _Multi_Select(title: 'Flutter Demo Home Page'),
);
}
}
class _Multi_Select extends StatefulWidget {
const _Multi_Select({required this.title});
final String title;
@override
State<_Multi_Select> createState() => _Multi_SelectState();
}
class _Multi_SelectState extends State<_Multi_Select> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
List<String> selected = [];
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Padding(
padding: const EdgeInsets.all(20.0),
// DropDownMultiSelect comes from multiselect
child: DropDownMultiSelect(
selected_values_style: TextStyle(color: Colors.white),
onChanged: (List<String> x) {
setState(() {
selected = x;
});
},
options: ['a', 'b', 'c', 'd'],
selectedValues: selected,
whenEmpty: 'Select Something',
),
),
));
}
}

View File

@ -0,0 +1,529 @@
import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
void main() => runApp(const SpeedDial());
class SpeedDials extends StatefulWidget {
const SpeedDials({Key? key}) : super(key: key);
@override
_SpeedDials createState() => _SpeedDials();
}
class _SpeedDials extends State<SpeedDials> {
var theme = ValueNotifier(ThemeMode.dark);
@override
Widget build(BuildContext context) {
const appTitle = 'Flutter Speed Dial Example';
return ValueListenableBuilder<ThemeMode>(
valueListenable: theme,
builder: (context, value, child) => MaterialApp(
title: appTitle,
home: MyHomePage(theme: theme),
debugShowCheckedModeBanner: false,
theme: ThemeData(
brightness: Brightness.light,
primaryColor: Colors.blue,
),
darkTheme: ThemeData(
brightness: Brightness.dark,
primaryColor: Colors.lightBlue[900],
),
themeMode: value,
));
}
}
class MyHomePage extends StatefulWidget {
final ValueNotifier<ThemeMode> theme;
const MyHomePage({Key? key, required this.theme}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
var renderOverlay = true;
var visible = true;
var switchLabelPosition = false;
var extend = false;
var mini = false;
var rmicons = false;
var customDialRoot = false;
var closeManually = false;
var useRAnimation = true;
var isDialOpen = ValueNotifier<bool>(false);
var speedDialDirection = SpeedDialDirection.up;
var buttonSize = const Size(56.0, 56.0);
var childrenButtonSize = const Size(56.0, 56.0);
var selectedfABLocation = FloatingActionButtonLocation.endDocked;
var items = [
FloatingActionButtonLocation.startFloat,
FloatingActionButtonLocation.startDocked,
FloatingActionButtonLocation.centerFloat,
FloatingActionButtonLocation.endFloat,
FloatingActionButtonLocation.endDocked,
FloatingActionButtonLocation.startTop,
FloatingActionButtonLocation.centerTop,
FloatingActionButtonLocation.endTop,
];
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
if (isDialOpen.value) {
isDialOpen.value = false;
return false;
}
return true;
},
child: Scaffold(
appBar: AppBar(
title: const Text("Flutter Speed Dial Example"),
),
body: SingleChildScrollView(
padding: const EdgeInsets.all(16),
physics: const BouncingScrollPhysics(),
child: Center(
child: Container(
constraints: const BoxConstraints(maxWidth: 800),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: const EdgeInsets.symmetric(
vertical: 6,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("SpeedDial Location",
style: Theme.of(context).textTheme.bodyLarge),
const SizedBox(height: 10),
Container(
decoration: BoxDecoration(
color: Theme.of(context).brightness ==
Brightness.dark
? Colors.grey[800]
: Colors.grey[200],
borderRadius: BorderRadius.circular(10)),
child: DropdownButton<FloatingActionButtonLocation>(
value: selectedfABLocation,
isExpanded: true,
icon: const Icon(Icons.arrow_drop_down),
iconSize: 20,
underline: const SizedBox(),
onChanged: (fABLocation) => setState(
() => selectedfABLocation = fABLocation!),
selectedItemBuilder: (BuildContext context) {
return items.map<Widget>((item) {
return Align(
alignment: Alignment.centerLeft,
child: Container(
padding: const EdgeInsets.symmetric(
vertical: 4, horizontal: 10),
child: Text(item.value)));
}).toList();
},
items: items.map((item) {
return DropdownMenuItem<
FloatingActionButtonLocation>(
value: item,
child: Text(
item.value,
),
);
}).toList(),
),
),
],
),
),
Container(
padding: const EdgeInsets.symmetric(
vertical: 6,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("SpeedDial Direction",
style: Theme.of(context).textTheme.bodyLarge),
const SizedBox(height: 10),
Container(
decoration: BoxDecoration(
color: Theme.of(context).brightness ==
Brightness.dark
? Colors.grey[800]
: Colors.grey[200],
borderRadius: BorderRadius.circular(10)),
child: DropdownButton<SpeedDialDirection>(
value: speedDialDirection,
isExpanded: true,
icon: const Icon(Icons.arrow_drop_down),
iconSize: 20,
underline: const SizedBox(),
onChanged: (sdo) {
setState(() {
speedDialDirection = sdo!;
selectedfABLocation = (sdo.isUp &&
selectedfABLocation.value
.contains("Top")) ||
(sdo.isLeft &&
selectedfABLocation.value
.contains("start"))
? FloatingActionButtonLocation.endDocked
: sdo.isDown &&
!selectedfABLocation.value
.contains("Top")
? FloatingActionButtonLocation.endTop
: sdo.isRight &&
selectedfABLocation.value
.contains("end")
? FloatingActionButtonLocation
.startDocked
: selectedfABLocation;
});
},
selectedItemBuilder: (BuildContext context) {
return SpeedDialDirection.values
.toList()
.map<Widget>((item) {
return Container(
padding: const EdgeInsets.symmetric(
vertical: 4, horizontal: 10),
child: Align(
alignment: Alignment.centerLeft,
child: Text(
describeEnum(item).toUpperCase())),
);
}).toList();
},
items: SpeedDialDirection.values
.toList()
.map((item) {
return DropdownMenuItem<SpeedDialDirection>(
value: item,
child: Text(describeEnum(item).toUpperCase()),
);
}).toList(),
),
),
],
),
),
if (!customDialRoot)
SwitchListTile(
contentPadding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 6,
),
value: extend,
title: const Text("Extend Speed Dial"),
onChanged: (val) {
setState(() {
extend = val;
});
}),
SwitchListTile(
contentPadding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 6,
),
value: visible,
title: const Text("Visible"),
onChanged: (val) {
setState(() {
visible = val;
});
}),
SwitchListTile(
contentPadding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 6,
),
value: mini,
title: const Text("Mini"),
onChanged: (val) {
setState(() {
mini = val;
});
}),
SwitchListTile(
contentPadding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 6,
),
value: customDialRoot,
title: const Text("Custom dialRoot"),
onChanged: (val) {
setState(() {
customDialRoot = val;
});
}),
SwitchListTile(
contentPadding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 6,
),
value: renderOverlay,
title: const Text("Render Overlay"),
onChanged: (val) {
setState(() {
renderOverlay = val;
});
}),
SwitchListTile(
contentPadding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 6,
),
value: closeManually,
title: const Text("Close Manually"),
onChanged: (val) {
setState(() {
closeManually = val;
});
}),
SwitchListTile(
contentPadding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 6,
),
value: rmicons,
title: const Text("Remove Icons (for children)"),
onChanged: (val) {
setState(() {
rmicons = val;
});
}),
if (!customDialRoot)
SwitchListTile(
contentPadding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 6,
),
value: useRAnimation,
title: const Text("Use Rotation Animation"),
onChanged: (val) {
setState(() {
useRAnimation = val;
});
}),
SwitchListTile(
contentPadding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 6,
),
value: switchLabelPosition,
title: const Text("Switch Label Position"),
onChanged: (val) {
setState(() {
switchLabelPosition = val;
if (val) {
if ((selectedfABLocation.value.contains("end") ||
selectedfABLocation.value
.toLowerCase()
.contains("top")) &&
speedDialDirection.isUp) {
selectedfABLocation =
FloatingActionButtonLocation.startDocked;
} else if ((selectedfABLocation.value
.contains("end") ||
!selectedfABLocation.value
.toLowerCase()
.contains("top")) &&
speedDialDirection.isDown) {
selectedfABLocation =
FloatingActionButtonLocation.startTop;
}
}
});
}),
const Text("Button Size"),
Slider(
value: buttonSize.width,
min: 50,
max: 500,
label: "Button Size",
onChanged: (val) {
setState(() {
buttonSize = Size(val, val);
});
},
),
const Text("Children Button Size"),
Slider(
value: childrenButtonSize.height,
min: 50,
max: 500,
onChanged: (val) {
setState(() {
childrenButtonSize = Size(val, val);
});
},
),
Container(
padding: const EdgeInsets.symmetric(
vertical: 6,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Navigation",
style: Theme.of(context).textTheme.bodyLarge),
const SizedBox(height: 10),
ElevatedButton(
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (_) =>
MyHomePage(theme: widget.theme),
),
);
},
child: const Text("Push Duplicate Page")),
],
),
),
],
),
),
)),
floatingActionButtonLocation: selectedfABLocation,
floatingActionButton: SpeedDial(
// animatedIcon: AnimatedIcons.menu_close,
// animatedIconTheme: IconThemeData(size: 22.0),
// / This is ignored if animatedIcon is non null
// child: Text("open"),
// activeChild: Text("close"),
icon: Icons.add,
activeIcon: Icons.close,
spacing: 3,
mini: mini,
openCloseDial: isDialOpen,
childPadding: const EdgeInsets.all(5),
spaceBetweenChildren: 4,
dialRoot: customDialRoot
? (ctx, open, toggleChildren) {
return ElevatedButton(
onPressed: toggleChildren,
style: ElevatedButton.styleFrom(
backgroundColor: Colors.blue[900],
padding: const EdgeInsets.symmetric(
horizontal: 22, vertical: 18),
),
child: const Text(
"Custom Dial Root",
style: TextStyle(fontSize: 17),
),
);
}
: null,
buttonSize:
buttonSize, // it's the SpeedDial size which defaults to 56 itself
// iconTheme: IconThemeData(size: 22),
label: extend
? const Text("Open")
: null, // The label of the main button.
/// The active label of the main button, Defaults to label if not specified.
activeLabel: extend ? const Text("Close") : null,
/// Transition Builder between label and activeLabel, defaults to FadeTransition.
// labelTransitionBuilder: (widget, animation) => ScaleTransition(scale: animation,child: widget),
/// The below button size defaults to 56 itself, its the SpeedDial childrens size
childrenButtonSize: childrenButtonSize,
visible: visible,
direction: speedDialDirection,
switchLabelPosition: switchLabelPosition,
/// If true user is forced to close dial manually
closeManually: closeManually,
/// If false, backgroundOverlay will not be rendered.
renderOverlay: renderOverlay,
// overlayColor: Colors.black,
// overlayOpacity: 0.5,
onOpen: () => debugPrint('OPENING DIAL'),
onClose: () => debugPrint('DIAL CLOSED'),
useRotationAnimation: useRAnimation,
tooltip: 'Open Speed Dial',
heroTag: 'speed-dial-hero-tag',
// foregroundColor: Colors.black,
// backgroundColor: Colors.white,
// activeForegroundColor: Colors.red,
// activeBackgroundColor: Colors.blue,
elevation: 8.0,
animationCurve: Curves.elasticInOut,
isOpenOnStart: false,
shape: customDialRoot
? const RoundedRectangleBorder()
: const StadiumBorder(),
// childMargin: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
children: [
SpeedDialChild(
child: !rmicons ? const Icon(Icons.accessibility) : null,
backgroundColor: Colors.red,
foregroundColor: Colors.white,
label: 'First',
onTap: () => setState(() => rmicons = !rmicons),
onLongPress: () => debugPrint('FIRST CHILD LONG PRESS'),
),
SpeedDialChild(
child: !rmicons ? const Icon(Icons.brush) : null,
backgroundColor: Colors.deepOrange,
foregroundColor: Colors.white,
label: 'Second',
onTap: () => debugPrint('SECOND CHILD'),
),
SpeedDialChild(
child: !rmicons ? const Icon(Icons.margin) : null,
backgroundColor: Colors.indigo,
foregroundColor: Colors.white,
label: 'Show Snackbar',
visible: true,
onTap: () => ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text(("Third Child Pressed")))),
onLongPress: () => debugPrint('THIRD CHILD LONG PRESS'),
),
],
),
bottomNavigationBar: BottomAppBar(
shape: const CircularNotchedRectangle(),
notchMargin: 8.0,
child: Row(
mainAxisAlignment: selectedfABLocation ==
FloatingActionButtonLocation.startDocked
? MainAxisAlignment.end
: selectedfABLocation == FloatingActionButtonLocation.endDocked
? MainAxisAlignment.start
: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: [
IconButton(
icon: const Icon(Icons.nightlight_round),
tooltip: "Switch Theme",
onPressed: () => {
widget.theme.value = widget.theme.value.index == 2
? ThemeMode.light
: ThemeMode.dark
},
),
ValueListenableBuilder<bool>(
valueListenable: isDialOpen,
builder: (ctx, value, _) => IconButton(
icon: const Icon(Icons.open_in_browser),
tooltip: (!value ? "Open" : "Close") + (" Speed Dial"),
onPressed: () => {isDialOpen.value = !isDialOpen.value},
))
],
),
),
),
);
}
}
extension EnumExt on FloatingActionButtonLocation {
/// Get Value of The SpeedDialDirection Enum like Up, Down, etc. in String format
String get value => toString().split(".")[1];
}

View File

@ -0,0 +1,235 @@
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/bloc/passo/additional_item/additional_item_bloc.dart';
import 'package:unit2/bloc/passo/class_components/class_components_bloc.dart';
import 'package:unit2/bloc/passo/property_appraisal/property_appraisal_bloc.dart';
import 'package:unit2/bloc/passo/property_assessment/property_assessment_bloc.dart';
import 'package:unit2/bloc/passo/property_info/property_info_bloc.dart';
import 'package:unit2/bloc/passo/signatories/signatories_bloc.dart';
import 'package:unit2/bloc/passo/unit_construct/unit_construct_bloc.dart';
import 'package:unit2/bloc/user/user_bloc.dart';
import 'package:unit2/model/passo/property_info.dart';
import 'package:unit2/model/profile/basic_information/primary-information.dart';
import 'package:unit2/screens/passo/Building/add_building.dart';
import 'package:unit2/screens/passo/Test%20Envi/multi_dropdown.dart';
import 'package:unit2/screens/passo/Test%20Envi/speed_dial.dart';
import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/widgets/error_state.dart';
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
class PassoHome extends StatelessWidget {
const PassoHome({super.key});
@override
Widget build(BuildContext context) {
int? profileId;
String? token;
Profile profile;
return Scaffold(
appBar: AppBar(
backgroundColor: primary,
centerTitle: true,
title: const Text("FAAS LIST"),
),
body: ProgressHUD(
padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocBuilder<UserBloc, UserState>(builder: (context, state) {
if (state is UserLoggedIn) {
profileId = state.userData!.user!.login!.user!.profileId;
token = state.userData!.user!.login!.token!;
profile = state.userData!.employeeInfo!.profile!;
return BlocConsumer<PropertyInfoBloc, PropertyInfoState>(
listener: (
context,
state,
) {
if (state is PropertyInfoLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is PropertyInfoLoaded ||
state is PropertyInfoErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
},
builder: (context, state) {
if (state is PropertyInfoLoaded) {
List<PropertyInfo> propertyList = state.property_info;
return Container(
padding: const EdgeInsets.symmetric(
vertical: 12, horizontal: 12),
child: Expanded(
child: ListView.builder(
shrinkWrap: true,
itemCount: propertyList.length,
itemBuilder: (BuildContext context, int index) {
return _listCard(
propertyList[index], context, index);
},
),
),
);
}
// if(state is PropertyInfoErrorState){
// return SomethingWentWrong(
// message: onError,
// onpressed: () {
// BlocProvider.of<UserBloc>(
// NavigationService.navigatorKey.currentContext!)
// .add(GetApkVersion());
// return MaterialPageRoute(builder: (_) {
// return const UniT2Login();
// });
// },
// );
// }
return Container();
},
);
}
return Container();
})),
floatingActionButton: SpeedDial(
//provide here features of your parent FAB
icon: Icons.add,
backgroundColor: const Color(0xffd92828),
heroTag: null,
useRotationAnimation: true,
activeIcon: Icons.close,
animationCurve: Curves.elasticInOut,
children: [
SpeedDialChild(
child: const Icon(
Icons.maps_home_work_rounded,
color: Color(0xffd92828),
),
label: 'Building & Other Structure',
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (BuildContext context) {
return MultiBlocProvider(providers: [
BlocProvider(
create: (context) =>
ClassComponentsBloc()..add(LoadClassComponents()),
),
BlocProvider(
create: (context) =>
UnitConstructBloc()..add(LoadUnitConstruct()),
),
BlocProvider(
create: (context) =>
AdditionalItemBloc()..add(LoadAdditionalItems()),
),
BlocProvider(
create: (context) => PropertyAppraisalBloc()
..add(LoadPropertyAppraisal()),
),
BlocProvider(
create: (context) => PropertyAssessmentBloc()
..add(LoadPropertyAssessment())),
BlocProvider(
create: (context) =>
SignatoriesBloc()..add(LoadSignatories())),
], child: AddBuilding());
}));
}),
SpeedDialChild(
child: const Icon(
Icons.forest_rounded,
color: Color(0xffd92828),
),
label: 'Land/Other Improvements',
onTap: () {},
),
SpeedDialChild(
child: const Icon(
Icons.precision_manufacturing_rounded,
color: Color(0xffd92828),
),
label: 'Machinery',
onTap: () {},
),
SpeedDialChild(
child: const Icon(
Icons.report_problem_rounded,
color: Color(0xffd92828),
),
label: 'Testing Screen',
onTap: () {
Navigator.of(context)
.push(MaterialPageRoute(builder: (ctx) => Multi_Select()));
},
),
]),
);
}
}
Card _listCard(PropertyInfo property_info, context, index) {
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 {},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(width: 20),
Row(
children: [
Text(
'${property_info.owner}',
textAlign: TextAlign.start,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
),
),
],
),
const SizedBox(height: 5),
Text(
'${property_info.tdn}',
textAlign: TextAlign.start,
style: const TextStyle(
fontSize: 13,
),
),
],
),
Container(
alignment: Alignment.topCenter,
padding: const EdgeInsets.all(3.0),
decoration: BoxDecoration(
border: Border.all(color: Colors.red),
borderRadius: BorderRadius.all(Radius.circular(8.0))),
child: const Text(' BUILDING ',
style: TextStyle(
color: Colors.red,
fontSize: 10,
fontWeight: FontWeight.bold)),
),
IconButton(onPressed: () {}, icon: const Icon(Icons.chevron_right)),
],
),
),
),
);
}

View File

@ -12,7 +12,7 @@ import '../../../../bloc/docsms/docsms_bloc.dart';
class DashBoard extends StatelessWidget {
final List<Module> roles;
final int userId;
const DashBoard({super.key, required this.roles,required this.userId});
const DashBoard({super.key, required this.roles, required this.userId});
@override
Widget build(BuildContext context) {
List<String> finishRoles = [];
@ -25,7 +25,6 @@ class DashBoard extends StatelessWidget {
shrinkWrap: true,
itemCount: roles.length,
itemBuilder: (BuildContext context, int index) {
//// gridview.count
return roles[index].roles.isNotEmpty
? SizedBox(
@ -65,8 +64,14 @@ class DashBoard extends StatelessWidget {
.contains("read")) {
return CardLabel(
ontap: () {
PassCheckArguments passCheckArguments = PassCheckArguments(roleId: role.role.id!, userId: userId);
Navigator.pushNamed(context, '/pass-check',arguments: passCheckArguments);
PassCheckArguments
passCheckArguments =
PassCheckArguments(
roleId: role.role.id!,
userId: userId);
Navigator.pushNamed(
context, '/pass-check',
arguments: passCheckArguments);
},
icon: role.icon,
title: "Pass Check",
@ -96,7 +101,9 @@ class DashBoard extends StatelessWidget {
}
}
}
return Container(color: Colors.red,);
return Container(
color: Colors.red,
);
} else if (role.role.name!.toLowerCase() ==
'field surveyor') {
print("3 true");
@ -107,7 +114,10 @@ class DashBoard extends StatelessWidget {
element.operations!
.contains("read")) {
return CardLabel(
ontap: () {},
ontap: () {
Navigator.pushNamed(
context, '/passo-home');
},
icon: role.icon,
title: "Field Surveyor",
);
@ -131,12 +141,17 @@ class DashBoard extends StatelessWidget {
String? qrBarcode =
await qrScanner();
if (qrBarcode != null) {
Navigator.push(NavigationService.navigatorKey.currentContext!, MaterialPageRoute(builder:
Navigator.push(
NavigationService.navigatorKey
.currentContext!,
MaterialPageRoute(builder:
(BuildContext context) {
return BlocProvider(
create: (context) => DocsmsBloc()
create: (context) =>
DocsmsBloc()
..add(LoadDocument(
documentId: qrBarcode)),
documentId:
qrBarcode)),
child:
const AutoReceiveDocument(),
);
@ -172,7 +187,6 @@ class DashBoard extends StatelessWidget {
}
}
return Container();
} else if (role.role.name!.toLowerCase() ==
'establishment point-person' &&
!finishRoles.contains('superadmin')) {
@ -193,12 +207,9 @@ class DashBoard extends StatelessWidget {
}
}
return Container();
} else{
} else {
return Wrap();
}
}).toList()),
const SizedBox(
height: 8,
@ -212,7 +223,7 @@ class DashBoard extends StatelessWidget {
}
}
class PassCheckArguments{
class PassCheckArguments {
final int roleId;
final int userId;
const PassCheckArguments({required this.roleId, required this.userId});

View File

@ -0,0 +1,53 @@
import 'dart:convert';
import 'dart:developer';
import 'dart:io';
import 'package:unit2/model/passo/additional_items.dart';
import 'package:http/http.dart' as http;
class AdditionalItemsServices {
static final AdditionalItemsServices _instance = AdditionalItemsServices();
static AdditionalItemsServices get instance => _instance;
Future<List<AdditionalItems>> getAdditionalItems(tempID) async {
http.Response response = await http.get(Uri.parse(
'http://192.168.10.218:8000/api/rptass_app/additional_items/?bldgappr_details_id=$tempID'));
if (response.statusCode == 200) {
final List result = jsonDecode(response.body)['data'];
return result.map(((e) => AdditionalItems.fromJson(e))).toList();
} else {
throw Exception(response.reasonPhrase);
}
}
Future<http.Response?> postAdditionalItems(AdditionalItems items) async {
http.Response? response;
try {
response = await http.post(
Uri.parse(
"http://192.168.10.218:8000/api/rptass_app/additional_items/"),
headers: {
HttpHeaders.contentTypeHeader: "application/json",
},
body: jsonEncode(items.toJson()));
} catch (e) {
log(e.toString());
}
return response;
}
Future<http.Response> removeAdditionalItems(id) async {
http.Response response = await http.delete(
Uri.parse(
'http://192.168.10.218:8000/api/rptass_app/additional_items/?id=$id'),
);
print(id);
if (response.statusCode == 200) {
print(response.body);
return response;
} else {
throw Exception(response.reasonPhrase);
}
}
}

View File

@ -0,0 +1,27 @@
import 'dart:convert';
import 'dart:developer';
import 'dart:io';
import 'package:http/http.dart' as http;
import 'package:unit2/model/passo/bldg_loc.dart';
class LocationLandrefServices {
static final LocationLandrefServices _instance = LocationLandrefServices();
static LocationLandrefServices get instance => _instance;
Future<http.Response?> bldgLocPutInfo(BldgLoc data, id) async {
http.Response? response;
try {
response = await http.put(Uri.parse(
// ignore: unnecessary_brace_in_string_interps
"http://192.168.10.218:8000/api/rptass_app/bldgappr_location/?bldgappr_details_id=${id}"),
headers: {
HttpHeaders.contentTypeHeader: "application/json",
},
body: jsonEncode(data.toJson()));
} catch (e) {
log(e.toString());
}
return response;
}
}

View File

@ -0,0 +1,43 @@
import 'dart:convert';
import 'dart:developer';
import 'dart:io';
import 'package:unit2/model/passo/property_appraisal.dart';
import 'package:http/http.dart' as http;
class PropertyAppraisalServices {
static final PropertyAppraisalServices _instance =
PropertyAppraisalServices();
static PropertyAppraisalServices get instance => _instance;
Future<List<PropertyAppraisal>> getPropertyAppraisal(tempID) async {
http.Response response = await http.get(Uri.parse(
'http://192.168.10.218:8000/api/rptass_app/property_appraisal/?bldgappr_details_id=$tempID'));
print('Appraisal');
print(response.body);
if (response.statusCode == 200) {
final List result = jsonDecode(response.body)['data'];
return result.map(((e) => PropertyAppraisal.fromJson(e))).toList();
} else {
throw Exception(response.reasonPhrase);
}
}
Future<http.Response?> postPropertyAppraisal(
PropertyAppraisal appraisal) async {
http.Response? response;
try {
response = await http.post(
Uri.parse(
"http://192.168.10.218:8000/api/rptass_app/property_appraisal/"),
headers: {
HttpHeaders.contentTypeHeader: "application/json",
},
body: jsonEncode(appraisal.toJson()));
} catch (e) {
log(e.toString());
}
return response;
}
}

View File

@ -0,0 +1,61 @@
import 'dart:convert';
import 'dart:developer';
import 'dart:io';
import 'package:unit2/model/passo/property_assessment.dart';
import 'package:http/http.dart' as http;
class PropertyAssessmentServices {
static final PropertyAssessmentServices _instance =
PropertyAssessmentServices();
static PropertyAssessmentServices get instance => _instance;
Future<List<PropertyAssessment>> getPropertyAssessment(tempID) async {
http.Response response = await http.get(Uri.parse(
'http://192.168.10.218:8000/api/rptass_app/property_assessment/?bldgappr_details_id=$tempID'));
print('Assessment');
print(response.statusCode);
if (response.statusCode == 200) {
final List result = jsonDecode(response.body)['data'];
return result.map(((e) => PropertyAssessment.fromJson(e))).toList();
} else {
throw Exception(response.reasonPhrase);
}
}
Future<http.Response?> postPropertyAssessment(
PropertyAssessment assessment) async {
http.Response? response;
try {
response = await http.post(
Uri.parse(
"http://192.168.10.218:8000/api/rptass_app/property_assessment/"),
headers: {
HttpHeaders.contentTypeHeader: "application/json",
},
body: jsonEncode(assessment.toJson()));
} catch (e) {
log(e.toString());
}
return response;
}
Future<http.Response?> propertyAssessmentPutInfo(
PropertyAssessment assessment, id) async {
print(id);
http.Response? response;
try {
response = await http.put(Uri.parse(
// ignore: unnecessary_brace_in_string_interps
"http://192.168.10.218:8000/api/rptass_app/property_assessment/?bldgappr_details_id=${id}"),
headers: {
HttpHeaders.contentTypeHeader: "application/json",
},
body: jsonEncode(assessment.toJson()));
} catch (e) {
log(e.toString());
}
return response;
}
}

View File

@ -0,0 +1,74 @@
import 'dart:convert';
import 'dart:developer';
import 'dart:io';
import 'package:unit2/model/passo/bldg_loc.dart';
import 'package:unit2/model/passo/land_ref.dart';
import 'package:unit2/model/passo/property_info.dart';
import 'package:http/http.dart' as http;
class PropertyInfoService {
static final PropertyInfoService _instance = PropertyInfoService();
static PropertyInfoService get instance => _instance;
Future<List<PropertyInfo>> getpropertyInfo() async {
http.Response response = await http.get(Uri.parse(
'http://192.168.10.218:8000/api/rptass_app/bldgappr_details/'));
print(response.body);
if (response.statusCode == 200) {
final List result = jsonDecode(response.body)['data'];
return result.map(((e) => PropertyInfo.fromJson(e))).toList();
} else {
throw Exception(response.reasonPhrase);
}
}
Future<http.Response?> postPropertyInfo(PropertyInfo faas) async {
http.Response? response;
try {
response = await http.post(
Uri.parse(
"http://192.168.10.218:8000/api/rptass_app/bldgappr_details/"),
headers: {
HttpHeaders.contentTypeHeader: "application/json",
},
body: jsonEncode(faas.toJson()));
} catch (e) {
log(e.toString());
}
return response;
}
Future<http.Response?> bldgLocPutInfo(BldgLoc data, id) async {
http.Response? response;
try {
response = await http.put(Uri.parse(
// ignore: unnecessary_brace_in_string_interps
"http://192.168.10.218:8000/api/rptass_app/bldgappr_location/?bldgappr_details_id=${id}"),
headers: {
HttpHeaders.contentTypeHeader: "application/json",
},
body: jsonEncode(data.toJson()));
} catch (e) {
log(e.toString());
}
return response;
}
Future<http.Response?> landRefPutInfo(LandRef data, id) async {
http.Response? response;
try {
response = await http.put(Uri.parse(
// ignore: unnecessary_brace_in_string_interps
"http://192.168.10.218:8000/api/rptass_app/bldgappr_landref/?bldgappr_details_id=${id}"),
headers: {
HttpHeaders.contentTypeHeader: "application/json",
},
body: jsonEncode(data.toJson()));
} catch (e) {
log(e.toString());
}
return response;
}
}

View File

@ -0,0 +1,21 @@
import 'dart:convert';
import 'package:unit2/model/passo/class_components.dart';
import 'package:http/http.dart' as http;
class ClassComponentService {
static final ClassComponentService _instance = ClassComponentService();
static ClassComponentService get instance => _instance;
Future<List<ClassComponents>> getClassComponent() async {
http.Response response = await http.get(Uri.parse(
'http://192.168.10.218:8000/api/rptass_app/class_components/'));
if (response.statusCode == 200) {
final List result = jsonDecode(response.body)['data'];
return result.map(((e) => ClassComponents.fromJson(e))).toList();
} else {
throw Exception(response.reasonPhrase);
}
}
}

View File

@ -0,0 +1,24 @@
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:unit2/model/passo/signatories.dart';
class SignatoriesServices {
static final SignatoriesServices _instance = SignatoriesServices();
static SignatoriesServices get instance => _instance;
Future<List<Signatories>> getSignatories() async {
http.Response response = await http.get(
Uri.parse('http://192.168.10.218:8000/api/rptass_app/signatories/'));
print('Signatories');
print(response.statusCode);
if (response.statusCode == 200) {
final List result = jsonDecode(response.body)['data'];
return result.map(((e) => Signatories.fromJson(e))).toList();
} else {
print(response.reasonPhrase);
throw Exception(response.reasonPhrase);
}
}
}

View File

@ -0,0 +1,21 @@
import 'dart:convert';
import 'package:unit2/model/passo/unit_construct.dart';
import 'package:http/http.dart' as http;
class UnitConstructService {
static final UnitConstructService _instance = UnitConstructService();
static UnitConstructService get instance => _instance;
Future<List<UnitConstruct>> getUnitConstruct() async {
http.Response response = await http.get(Uri.parse(
'http://192.168.10.218:8000/api/rptass_app/unitconstruct_values/'));
if (response.statusCode == 200) {
final List result = jsonDecode(response.body)['data'];
return result.map(((e) => UnitConstruct.fromJson(e))).toList();
} else {
throw Exception(response.reasonPhrase);
}
}
}

View File

@ -3,6 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:unit2/bloc/profile/profile_bloc.dart';
import 'package:unit2/bloc/role/pass_check/pass_check_bloc.dart';
import 'package:unit2/bloc/sos/sos_bloc.dart';
import 'package:unit2/screens/passo/passo_home.dart';
import 'package:unit2/screens/sos/index.dart';
import 'package:unit2/screens/unit2/homepage.dart/components/dashboard.dart';
import 'package:unit2/screens/unit2/homepage.dart/components/menu.dart';
@ -55,13 +56,24 @@ class AppRouter {
);
});
case '/pass-check':
PassCheckArguments arguments = routeSettings.arguments as PassCheckArguments;
PassCheckArguments arguments =
routeSettings.arguments as PassCheckArguments;
return MaterialPageRoute(builder: (BuildContext context) {
return BlocProvider(
create: (context) => PassCheckBloc()..add(GetPassCheckAreas(roleId: arguments.roleId, userId: arguments.userId)),
child: QRCodeScannerSettings(roleId: arguments.roleId, userId: arguments.userId,),
create: (context) => PassCheckBloc()
..add(GetPassCheckAreas(
roleId: arguments.roleId, userId: arguments.userId)),
child: QRCodeScannerSettings(
roleId: arguments.roleId,
userId: arguments.userId,
),
);
});
case '/passo-home':
// BlocProvider.of<UserBloc>( NavigationService.navigatorKey.currentContext!).add(LoadLoggedInUser());
return MaterialPageRoute(builder: (_) {
return const PassoHome();
});
default:
return MaterialPageRoute(builder: (context) {
return Container();

View File

@ -5,10 +5,10 @@ class Url {
String host() {
// return '192.168.10.183:3000';
return 'agusandelnorte.gov.ph';
// return 'agusandelnorte.gov.ph';
// return "192.168.10.219:3000";
// return "192.168.10.241";
// return "192.168.10.221:3004";
return "192.168.10.221:3004";
// return "playweb.agusandelnorte.gov.ph";
// return 'devapi.agusandelnorte.gov.ph:3004';
}
@ -17,211 +17,231 @@ class Url {
return '/api/account/auth/login/';
}
String profileInformation(){
String profileInformation() {
return 'api/jobnet_app/profile/pds/';
}
String latestApk(){
String latestApk() {
return "/api/system_app/apk_version/latest";
}
////SOS paths
String sosRequest(){
String sosRequest() {
return "/api/sos_app/sos_request/";
}
//// DOCSMS paths
String getDocument(){
String getDocument() {
return "/api/web_app/public/document_viewer/";
}
////ELIGIBILITIES PATHS
String eligibilities(){
String eligibilities() {
return "/api/jobnet_app/eligibilities/";
}
}
String getEligibilities(){
String getEligibilities() {
return "/api/jobnet_app/profile/pds/eligibility/";
}
}
String addEligibility(){
String addEligibility() {
return "/api/jobnet_app/profile/pds/eligibility/";
}
String deleteEligibility(){
return "/api/jobnet_app/profile/pds/eligibility/";
}
}
String updateEligibility(){
String deleteEligibility() {
return "/api/jobnet_app/profile/pds/eligibility/";
}
}
String updateEligibility() {
return "/api/jobnet_app/profile/pds/eligibility/";
}
//// work history paths
String workhistory(){
String workhistory() {
return "/api/jobnet_app/profile/pds/work/";
}
String getPositions(){
}
String getPositions() {
return "/api/jobnet_app/positions/";
}
String getAgencies(){
}
String getAgencies() {
return "/api/jobnet_app/agencies/";
}
}
String getAgencyCategory(){
String getAgencyCategory() {
return "api/jobnet_app/agency_categories/";
}
}
String identifications(){
String identifications() {
return "/api/jobnet_app/profile/pds/basic/identification/";
}
}
////educational background paths
String educationalBackground(){
String educationalBackground() {
return "/api/jobnet_app/profile/pds/education/";
}
String getSchools(){
}
String getSchools() {
return "/api/jobnet_app/schools/";
}
String getPrograms(){
}
String getPrograms() {
return "api/jobnet_app/education_programs/";
}
String getHonors(){
}
String getHonors() {
return "/api/jobnet_app/honors";
}
}
//// learning and development paths
String learningAndDevelopments(){
String learningAndDevelopments() {
return "api/jobnet_app/profile/pds/learning_development/";
}
String conductedTrainings(){
}
String conductedTrainings() {
return "api/jobnet_app/conducted_trainings/";
}
String learningAndDevelopmentType(){
}
String learningAndDevelopmentType() {
return "api/jobnet_app/learning_development/";
}
String learningAndDevelopmentTopics(){
}
String learningAndDevelopmentTopics() {
return "api/jobnet_app/training_topics/";
}
}
//// references paths
String reference(){
String reference() {
return "/api/jobnet_app/profile/pds/personal_reference/";
}
}
////voluntary works
String getVoluntaryWorks(){
String getVoluntaryWorks() {
return "/api/jobnet_app/profile/pds/voluntary_work/";
}
}
//// skills hobbies
String skillsHobbies(){
String skillsHobbies() {
return "/api/jobnet_app/profile/pds/other/skill_hobby/";
}
String getAllSkillsHobbies(){
}
String getAllSkillsHobbies() {
return "/api/jobnet_app/skill_hobby/";
}
}
//// orgmemberships
String getOrgMemberShips(){
String getOrgMemberShips() {
return "/api/jobnet_app/profile/pds/other/org_membership/";
}
}
////non academic recognition
String getNonAcademicRecognition(){
String getNonAcademicRecognition() {
return "/api/jobnet_app/profile/pds/other/non_acad_recognition/";
}
}
////citizenship
String citizenship(){
String citizenship() {
return "/api/jobnet_app/profile/pds/basic/citizenship/";
}
}
////family paths
String getFamilies(){
String getFamilies() {
return "/api/jobnet_app/profile/pds/family/";
}
String addEmergency(){
return "/api/profile_app/person_emergency/";
}
String getRelationshipTypes(){
return "/api/jobnet_app/relationship_types";
}
String updatePersonalInfor(){
return "/api/jobnet_app/profile/pds/basic/personal/";
}
}
String addEmergency() {
return "/api/profile_app/person_emergency/";
}
String getRelationshipTypes() {
return "/api/jobnet_app/relationship_types";
}
String updatePersonalInfor() {
return "/api/jobnet_app/profile/pds/basic/personal/";
}
//// contacts path
String getServiceTypes(){
String getServiceTypes() {
return "/api/jobnet_app/comm_service_type/";
}
}
//// address path
String addressPath(){
String addressPath() {
return "/api/jobnet_app/profile/pds/basic/address/";
}
}
String contactPath(){
String contactPath() {
return "/api/jobnet_app/profile/pds/basic/contact/";
}
String getCommunicationProvider(){
}
String getCommunicationProvider() {
return "/api/jobnet_app/comm_services/";
}
String deleteContact (){
}
String deleteContact() {
return "/api/jobnet_app/profile/pds/basic/contact/";
}
}
////profile other info
String getReligions(){
String getReligions() {
return "/api/profile_app/religion/";
}
String getEthnicity(){
}
String getEthnicity() {
return "/api/profile_app/ethnicity/";
}
}
String getDisability(){
String getDisability() {
return "api/profile_app/disability/";
}
}
String getIndigency(){
String getIndigency() {
return "/api/profile_app/indigenous/";
}
}
String getGenders(){
String getGenders() {
return "/api/profile_app/gender/";
}
}
/////ROLES
// pass check
String getAssignAreas(){
String getAssignAreas() {
return "/api/account/auth/assigned_role_area/";
}
}
String getPasserInfo(){
String getPasserInfo() {
return "/api/profile_app/person_basicinfo/";
}
}
String postLogs(){
String postLogs() {
return "/api/unit2_app/monitoring/pass_check/";
}
}
//// location utils path
String getCounties(){
String getCounties() {
return "/api/jobnet_app/countries/";
}
String getRegions(){
String getRegions() {
return "/api/web_app/location/region/";
}
String getProvinces(){
String getProvinces() {
return "api/web_app/location/province/";
}
String getCities(){
String getCities() {
return "/api/web_app/location/citymun/";
}
String getBarangays(){
String getBarangays() {
return "/api/web_app/location/barangay/";
}
String getAddressCategory(){
String getAddressCategory() {
return "/api/jobnet_app/address_categories/";
}
}

View File

@ -0,0 +1,22 @@
import 'package:flutter/material.dart';
class CustomButton extends StatelessWidget {
final VoidCallback onPressed;
final Icon icon;
CustomButton({required this.onPressed, required this.icon});
@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: onPressed,
style: ElevatedButton.styleFrom(
shape: const CircleBorder(),
padding: const EdgeInsets.all(30),
backgroundColor: Colors.red,
foregroundColor: Colors.white,
),
child: icon,
);
}
}

View File

@ -0,0 +1,47 @@
import 'package:flutter/material.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:unit2/theme-data.dart/form-style.dart';
Widget customTextField(String labelText, String hintText, String keyText) {
return Container(
margin: const EdgeInsets.only(left: 0, top: 10, right: 0, bottom: 0),
child: FormBuilderTextField(
name: keyText,
decoration: normalTextFieldStyle(labelText, hintText),
validator: FormBuilderValidators.compose([]),
),
);
}
Widget customDropDownField(String labelText, String hintText, String keyText,
List<String> dropdownItems) {
return Container(
margin: const EdgeInsets.only(left: 0, top: 10, right: 0, bottom: 0),
child: FormBuilderDropdown<String?>(
name: keyText,
autofocus: false,
decoration: normalTextFieldStyle(labelText, hintText),
items: dropdownItems
.map((items) => DropdownMenuItem(
value: items,
child: Text(items),
))
.toList()),
);
}
Widget customDatTimePicker(String labelText, String hintText, String keyText) {
return Container(
margin: const EdgeInsets.only(left: 0, top: 10, right: 0, bottom: 0),
child: FormBuilderDateTimePicker(
name: keyText,
initialEntryMode: DatePickerEntryMode.calendarOnly,
initialValue: DateTime.now(),
inputType: InputType.date,
decoration: normalTextFieldStyle(labelText, hintText),
initialTime: const TimeOfDay(hour: 8, minute: 0),
// locale: const Locale.fromSubtags(languageCode: 'fr'),
),
);
}

View File

@ -555,6 +555,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.2"
flutter_speed_dial:
dependency: "direct main"
description:
name: flutter_speed_dial
sha256: "41d7ad0bc224248637b3a5e0b9083e912a75445bdb450cf82b8ed06d7af7c61d"
url: "https://pub.dev"
source: hosted
version: "6.2.0"
flutter_spinkit:
dependency: "direct main"
description:
@ -701,6 +709,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.0.2"
im_stepper:
dependency: "direct main"
description:
name: im_stepper
sha256: "84ca411f7c4666cb8762a6dd6eec0353c96c67f674124614263875d0570ca634"
url: "https://pub.dev"
source: hosted
version: "1.0.1+1"
image:
dependency: transitive
description:
@ -845,6 +861,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.9"
multi_select_flutter:
dependency: "direct main"
description:
name: multi_select_flutter
sha256: "503857b415d390d29159df8a9d92d83c6aac17aaf1c307fb7bcfc77d097d20ed"
url: "https://pub.dev"
source: hosted
version: "4.1.3"
multiselect:
dependency: "direct main"
description:
name: multiselect
sha256: "8d0c4a7b89bee6c5e5e4a25ecba68c796dafc1917492d5606f0caa3947d5905a"
url: "https://pub.dev"
source: hosted
version: "0.1.0"
navigation_builder:
dependency: transitive
description:
name: navigation_builder
sha256: "95e25150191d9cd4e4b86504f33cd9e786d1e6732edb2e3e635bbedc5ef0dea7"
url: "https://pub.dev"
source: hosted
version: "0.0.3"
nested:
dependency: transitive
description:
@ -1198,7 +1238,7 @@ packages:
source: hosted
version: "0.7.8"
shared_preferences:
dependency: transitive
dependency: "direct main"
description:
name: shared_preferences
sha256: "396f85b8afc6865182610c0a2fc470853d56499f75f7499e2a73a9f0539d23d0"
@ -1338,6 +1378,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.11.0"
states_rebuilder:
dependency: transitive
description:
name: states_rebuilder
sha256: bf1a5ab5c543acdefce35e60f482eb7ab592339484fe3266d147ee597f18dc92
url: "https://pub.dev"
source: hosted
version: "6.3.0"
stream_channel:
dependency: transitive
description:

View File

@ -82,7 +82,11 @@ dependencies:
searchable_paginated_dropdown: ^1.2.0
audioplayers: ^4.1.0
assets_audio_player: ^3.0.6
flutter_speed_dial: ^6.2.0
im_stepper: ^1.0.1+1
shared_preferences: ^2.0.20
multiselect: ^0.1.0
multi_select_flutter: ^4.1.3
dev_dependencies:
flutter_test: