diff --git a/android/app/build.gradle b/android/app/build.gradle index e896139..be52da5 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -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 diff --git a/lib/bloc/passo/additional_item/additional_item_bloc.dart b/lib/bloc/passo/additional_item/additional_item_bloc.dart new file mode 100644 index 0000000..ad9c4ca --- /dev/null +++ b/lib/bloc/passo/additional_item/additional_item_bloc.dart @@ -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 { + AdditionalItemBloc() : super(AdditionalItemsLoading()) { + List globalAdditionalItems = []; + on((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((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((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((event, emit) async { + emit(ShowAddItemsScreen()); + }); + } +} diff --git a/lib/bloc/passo/additional_item/additional_item_event.dart b/lib/bloc/passo/additional_item/additional_item_event.dart new file mode 100644 index 0000000..3922048 --- /dev/null +++ b/lib/bloc/passo/additional_item/additional_item_event.dart @@ -0,0 +1,37 @@ +part of 'additional_item_bloc.dart'; + +abstract class AdditionalItemEvent extends Equatable { + const AdditionalItemEvent(); + + @override + List get props => []; +} + +class LoadAdditionalItems extends AdditionalItemEvent { + final List items; + + const LoadAdditionalItems({this.items = const []}); + + @override + List get props => [items]; +} + +class AddAdditionalItems extends AdditionalItemEvent { + final AdditionalItems items; + + const AddAdditionalItems({required this.items}); + + @override + List get props => [items]; +} + +class DeleteAdditionalItems extends AdditionalItemEvent { + final int id; + + const DeleteAdditionalItems({required this.id}); + + @override + List get props => [id]; +} + +class ShowAdditionalItems extends AdditionalItemEvent {} diff --git a/lib/bloc/passo/additional_item/additional_item_state.dart b/lib/bloc/passo/additional_item/additional_item_state.dart new file mode 100644 index 0000000..d39fc65 --- /dev/null +++ b/lib/bloc/passo/additional_item/additional_item_state.dart @@ -0,0 +1,35 @@ +part of 'additional_item_bloc.dart'; + +abstract class AdditionalItemState extends Equatable { + const AdditionalItemState(); + + @override + List get props => []; +} + +class AdditionalItemsLoading extends AdditionalItemState {} + +class AdditionalItemsLoaded extends AdditionalItemState { + const AdditionalItemsLoaded(this.items); + final List items; + + @override + List get props => [items]; +} + +class ShowAddItemsScreen extends AdditionalItemState {} + +class AdditionalItemsErrorState extends AdditionalItemState { + const AdditionalItemsErrorState(this.error); + final String error; + + @override + List get props => [error]; +} + +class AdditionalItemsDeletedState extends AdditionalItemState { + final bool success; + const AdditionalItemsDeletedState({required this.success}); + @override + List get props => [success]; +} diff --git a/lib/bloc/passo/class_components/class_components_bloc.dart b/lib/bloc/passo/class_components/class_components_bloc.dart new file mode 100644 index 0000000..b3d9c52 --- /dev/null +++ b/lib/bloc/passo/class_components/class_components_bloc.dart @@ -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 { + ClassComponentsBloc() : super(ClassComponentLoading()) { + on((event, emit) async { + emit(ClassComponentLoading()); + try { + final classs = await ClassComponentService.instance.getClassComponent(); + emit(ClassComponentLoaded(classs)); + } catch (e) { + emit(ClassComponentErrorState(e.toString())); + } + }); + } +} diff --git a/lib/bloc/passo/class_components/class_components_event.dart b/lib/bloc/passo/class_components/class_components_event.dart new file mode 100644 index 0000000..5efdac8 --- /dev/null +++ b/lib/bloc/passo/class_components/class_components_event.dart @@ -0,0 +1,17 @@ +part of 'class_components_bloc.dart'; + +abstract class ClassComponentsEvent extends Equatable { + const ClassComponentsEvent(); + + @override + List get props => []; +} + +class LoadClassComponents extends ClassComponentsEvent { + final List classes; + + const LoadClassComponents({this.classes = const []}); + + @override + List get props => [classes]; +} diff --git a/lib/bloc/passo/class_components/class_components_state.dart b/lib/bloc/passo/class_components/class_components_state.dart new file mode 100644 index 0000000..99beb14 --- /dev/null +++ b/lib/bloc/passo/class_components/class_components_state.dart @@ -0,0 +1,26 @@ +part of 'class_components_bloc.dart'; + +abstract class ClassComponentsState extends Equatable { + const ClassComponentsState(); + + @override + List get props => []; +} + +class ClassComponentLoading extends ClassComponentsState {} + +class ClassComponentLoaded extends ClassComponentsState { + ClassComponentLoaded(this.classes); + final List classes; + + @override + List get props => [classes]; +} + +class ClassComponentErrorState extends ClassComponentsState { + ClassComponentErrorState(this.error); + final String error; + + @override + List get props => [error]; +} diff --git a/lib/bloc/passo/location/location_bloc.dart b/lib/bloc/passo/location/location_bloc.dart new file mode 100644 index 0000000..7bac921 --- /dev/null +++ b/lib/bloc/passo/location/location_bloc.dart @@ -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 { + LocationBloc() : super(LocationInitial()) { + on((event, emit) { + // TODO: implement event handler + }); + } +} diff --git a/lib/bloc/passo/location/location_event.dart b/lib/bloc/passo/location/location_event.dart new file mode 100644 index 0000000..44dfbee --- /dev/null +++ b/lib/bloc/passo/location/location_event.dart @@ -0,0 +1,8 @@ +part of 'location_bloc.dart'; + +abstract class LocationEvent extends Equatable { + const LocationEvent(); + + @override + List get props => []; +} diff --git a/lib/bloc/passo/location/location_state.dart b/lib/bloc/passo/location/location_state.dart new file mode 100644 index 0000000..64ea7b3 --- /dev/null +++ b/lib/bloc/passo/location/location_state.dart @@ -0,0 +1,10 @@ +part of 'location_bloc.dart'; + +abstract class LocationState extends Equatable { + const LocationState(); + + @override + List get props => []; +} + +class LocationInitial extends LocationState {} diff --git a/lib/bloc/passo/property_appraisal/property_appraisal_bloc.dart b/lib/bloc/passo/property_appraisal/property_appraisal_bloc.dart new file mode 100644 index 0000000..55c2d3d --- /dev/null +++ b/lib/bloc/passo/property_appraisal/property_appraisal_bloc.dart @@ -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 { + PropertyAppraisalBloc() : super(PropertyAppraisalInitial()) { + List globalPropertyAppraisal = []; + on((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((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)); + } + }); + } +} diff --git a/lib/bloc/passo/property_appraisal/property_appraisal_event.dart b/lib/bloc/passo/property_appraisal/property_appraisal_event.dart new file mode 100644 index 0000000..c37835d --- /dev/null +++ b/lib/bloc/passo/property_appraisal/property_appraisal_event.dart @@ -0,0 +1,26 @@ +part of 'property_appraisal_bloc.dart'; + +abstract class PropertyAppraisalEvent extends Equatable { + const PropertyAppraisalEvent(); + + @override + List get props => []; +} + +class LoadPropertyAppraisal extends PropertyAppraisalEvent { + final List appraisal; + + const LoadPropertyAppraisal({this.appraisal = const []}); + + @override + List get props => [appraisal]; +} + +class AddPropertyAppraisal extends PropertyAppraisalEvent { + final PropertyAppraisal appraisal; + + const AddPropertyAppraisal({required this.appraisal}); + + @override + List get props => [appraisal]; +} diff --git a/lib/bloc/passo/property_appraisal/property_appraisal_state.dart b/lib/bloc/passo/property_appraisal/property_appraisal_state.dart new file mode 100644 index 0000000..a2e3a77 --- /dev/null +++ b/lib/bloc/passo/property_appraisal/property_appraisal_state.dart @@ -0,0 +1,28 @@ +part of 'property_appraisal_bloc.dart'; + +abstract class PropertyAppraisalState extends Equatable { + const PropertyAppraisalState(); + + @override + List get props => []; +} + +class PropertyAppraisalInitial extends PropertyAppraisalState {} + +class PropertyAppraisalLoading extends PropertyAppraisalState {} + +class PropertyAppraisalLoaded extends PropertyAppraisalState { + PropertyAppraisalLoaded(this.appraisal); + final List appraisal; + + @override + List get props => [appraisal]; +} + +class PropertyAppraisalErrorState extends PropertyAppraisalState { + PropertyAppraisalErrorState(this.error); + final String error; + + @override + List get props => [error]; +} diff --git a/lib/bloc/passo/property_assessment/property_assessment_bloc.dart b/lib/bloc/passo/property_assessment/property_assessment_bloc.dart new file mode 100644 index 0000000..ee73086 --- /dev/null +++ b/lib/bloc/passo/property_assessment/property_assessment_bloc.dart @@ -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 { + PropertyAssessmentBloc() : super(PropertyAssessmentInitial()) { + List globalPropertyAssessment = []; + on((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((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((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)); + // } + }); + } +} diff --git a/lib/bloc/passo/property_assessment/property_assessment_event.dart b/lib/bloc/passo/property_assessment/property_assessment_event.dart new file mode 100644 index 0000000..3c7621c --- /dev/null +++ b/lib/bloc/passo/property_assessment/property_assessment_event.dart @@ -0,0 +1,38 @@ +part of 'property_assessment_bloc.dart'; + +abstract class PropertyAssessmentEvent extends Equatable { + const PropertyAssessmentEvent(); + + @override + List get props => []; +} + +class LoadPropertyAssessment extends PropertyAssessmentEvent { + final List assessments; + + const LoadPropertyAssessment( + {this.assessments = const []}); + + @override + List get props => [assessments]; +} + +class AddPropertyAssessment extends PropertyAssessmentEvent { + final PropertyAssessment assessments; + + const AddPropertyAssessment({required this.assessments}); + + @override + List 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 get props => [assessment]; +} diff --git a/lib/bloc/passo/property_assessment/property_assessment_state.dart b/lib/bloc/passo/property_assessment/property_assessment_state.dart new file mode 100644 index 0000000..6c88b75 --- /dev/null +++ b/lib/bloc/passo/property_assessment/property_assessment_state.dart @@ -0,0 +1,28 @@ +part of 'property_assessment_bloc.dart'; + +abstract class PropertyAssessmentState extends Equatable { + const PropertyAssessmentState(); + + @override + List get props => []; +} + +class PropertyAssessmentInitial extends PropertyAssessmentState {} + +class PropertyAssessmentLoading extends PropertyAssessmentState {} + +class PropertyAssessmentLoaded extends PropertyAssessmentState { + PropertyAssessmentLoaded(this.assessments); + final List assessments; + + @override + List get props => [assessments]; +} + +class PropertyAssessmentErrorState extends PropertyAssessmentState { + PropertyAssessmentErrorState(this.error); + final String error; + + @override + List get props => [error]; +} diff --git a/lib/bloc/passo/property_info/property_info_bloc.dart b/lib/bloc/passo/property_info/property_info_bloc.dart new file mode 100644 index 0000000..a808842 --- /dev/null +++ b/lib/bloc/passo/property_info/property_info_bloc.dart @@ -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 { + PropertyInfoBloc() : super(PropertyInfoLoading()) { + on((event, emit) async { + emit(PropertyInfoLoading()); + try { + final property_info = + await PropertyInfoService.instance.getpropertyInfo(); + emit(PropertyInfoLoaded(property_info)); + } catch (e) { + emit(PropertyInfoErrorState(e.toString())); + } + }); + on((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(((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( + (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); + }, + ); + } +} diff --git a/lib/bloc/passo/property_info/property_info_event.dart b/lib/bloc/passo/property_info/property_info_event.dart new file mode 100644 index 0000000..4356438 --- /dev/null +++ b/lib/bloc/passo/property_info/property_info_event.dart @@ -0,0 +1,55 @@ +part of 'property_info_bloc.dart'; + +abstract class PropertyInfoEvent extends Equatable { + const PropertyInfoEvent(); + + @override + List get props => []; +} + +class LoadPropertyInfo extends PropertyInfoEvent { + final List property_info; + + const LoadPropertyInfo({this.property_info = const []}); + + @override + List get props => [property_info]; +} + +class AddPropertyInfo extends PropertyInfoEvent { + final PropertyInfo property_info; + + const AddPropertyInfo({required this.property_info}); + + @override + List 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 get props => [bldg_loc]; +} + +class UpdateLandRef extends PropertyInfoEvent { + final LandRef land_ref; + + const UpdateLandRef({required this.land_ref}); + + @override + List get props => [land_ref]; +} + +// class UpdateGeneralDesc extends PropertyInfoEvent { +// final GeneralDesc gen_desc; + +// const UpdateGeneralDesc({required this.gen_desc}); + +// @override +// List get props => [gen_desc]; +// } \ No newline at end of file diff --git a/lib/bloc/passo/property_info/property_info_state.dart b/lib/bloc/passo/property_info/property_info_state.dart new file mode 100644 index 0000000..b325da5 --- /dev/null +++ b/lib/bloc/passo/property_info/property_info_state.dart @@ -0,0 +1,26 @@ +part of 'property_info_bloc.dart'; + +abstract class PropertyInfoState extends Equatable { + const PropertyInfoState(); + + @override + List get props => []; +} + +class PropertyInfoLoading extends PropertyInfoState {} + +class PropertyInfoLoaded extends PropertyInfoState { + const PropertyInfoLoaded(this.property_info); + final List property_info; + + @override + List get props => [property_info]; +} + +class PropertyInfoErrorState extends PropertyInfoState { + const PropertyInfoErrorState(this.error); + final String error; + + @override + List get props => [error]; +} diff --git a/lib/bloc/passo/signatories/signatories_bloc.dart b/lib/bloc/passo/signatories/signatories_bloc.dart new file mode 100644 index 0000000..9d6581c --- /dev/null +++ b/lib/bloc/passo/signatories/signatories_bloc.dart @@ -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 { + SignatoriesBloc() : super(SignatoriesInitial()) { + on((event, emit) async { + emit(SignatoriesLoading()); + try { + final signatories = await SignatoriesServices.instance.getSignatories(); + emit(SignatoriesLoaded(signatories)); + } catch (e) { + emit(SignatoriesErrorState(e.toString())); + } + }); + } +} diff --git a/lib/bloc/passo/signatories/signatories_event.dart b/lib/bloc/passo/signatories/signatories_event.dart new file mode 100644 index 0000000..a1949cd --- /dev/null +++ b/lib/bloc/passo/signatories/signatories_event.dart @@ -0,0 +1,17 @@ +part of 'signatories_bloc.dart'; + +abstract class SignatoriesEvent extends Equatable { + const SignatoriesEvent(); + + @override + List get props => []; +} + +class LoadSignatories extends SignatoriesEvent { + final List signatories; + + const LoadSignatories({this.signatories = const []}); + + @override + List get props => [signatories]; +} diff --git a/lib/bloc/passo/signatories/signatories_state.dart b/lib/bloc/passo/signatories/signatories_state.dart new file mode 100644 index 0000000..a914bc9 --- /dev/null +++ b/lib/bloc/passo/signatories/signatories_state.dart @@ -0,0 +1,28 @@ +part of 'signatories_bloc.dart'; + +abstract class SignatoriesState extends Equatable { + const SignatoriesState(); + + @override + List get props => []; +} + +class SignatoriesInitial extends SignatoriesState {} + +class SignatoriesLoading extends SignatoriesState {} + +class SignatoriesLoaded extends SignatoriesState { + SignatoriesLoaded(this.signatories); + final List signatories; + + @override + List get props => [signatories]; +} + +class SignatoriesErrorState extends SignatoriesState { + SignatoriesErrorState(this.error); + final String error; + + @override + List get props => [error]; +} diff --git a/lib/bloc/passo/unit_construct/unit_construct_bloc.dart b/lib/bloc/passo/unit_construct/unit_construct_bloc.dart new file mode 100644 index 0000000..8112eb3 --- /dev/null +++ b/lib/bloc/passo/unit_construct/unit_construct_bloc.dart @@ -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 { + UnitConstructBloc() : super(UnitConstructLoading()) { + on((event, emit) async { + emit(UnitConstructLoading()); + try { + final unit = await UnitConstructService.instance.getUnitConstruct(); + emit(UnitConstructLoaded(unit)); + } catch (e) { + emit(UnitConstructErrorState(e.toString())); + } + }); + } +} diff --git a/lib/bloc/passo/unit_construct/unit_construct_event.dart b/lib/bloc/passo/unit_construct/unit_construct_event.dart new file mode 100644 index 0000000..dfd9e83 --- /dev/null +++ b/lib/bloc/passo/unit_construct/unit_construct_event.dart @@ -0,0 +1,17 @@ +part of 'unit_construct_bloc.dart'; + +abstract class UnitConstructEvent extends Equatable { + const UnitConstructEvent(); + + @override + List get props => []; +} + +class LoadUnitConstruct extends UnitConstructEvent { + final List unit; + + const LoadUnitConstruct({this.unit = const []}); + + @override + List get props => [unit]; +} diff --git a/lib/bloc/passo/unit_construct/unit_construct_state.dart b/lib/bloc/passo/unit_construct/unit_construct_state.dart new file mode 100644 index 0000000..51adea0 --- /dev/null +++ b/lib/bloc/passo/unit_construct/unit_construct_state.dart @@ -0,0 +1,26 @@ +part of 'unit_construct_bloc.dart'; + +abstract class UnitConstructState extends Equatable { + const UnitConstructState(); + + @override + List get props => []; +} + +class UnitConstructLoading extends UnitConstructState {} + +class UnitConstructLoaded extends UnitConstructState { + UnitConstructLoaded(this.unit); + final List unit; + + @override + List get props => [unit]; +} + +class UnitConstructErrorState extends UnitConstructState { + UnitConstructErrorState(this.error); + final String error; + + @override + List get props => [error]; +} diff --git a/lib/main.dart b/lib/main.dart index 5144a73..b7f782d 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -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 { ); } } - diff --git a/lib/model/passo/additional_items.dart b/lib/model/passo/additional_items.dart new file mode 100644 index 0000000..9f89494 --- /dev/null +++ b/lib/model/passo/additional_items.dart @@ -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 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 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, + }; +} diff --git a/lib/model/passo/bldg_loc.dart b/lib/model/passo/bldg_loc.dart new file mode 100644 index 0000000..0e9e80d --- /dev/null +++ b/lib/model/passo/bldg_loc.dart @@ -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 json) => BldgLoc( + id: json["id"], + bldgapprDetailsId: json["bldgappr_details_id"], + street: json["street"], + barangay: json["barangay"], + municipality: json["municipality"], + province: json["province"], + ); + + Map toJson() => { + "id": id, + "bldgappr_details_id": bldgapprDetailsId, + "street": street, + "barangay": barangay, + "municipality": municipality, + "province": province, + }; +} diff --git a/lib/model/passo/class_components.dart b/lib/model/passo/class_components.dart new file mode 100644 index 0000000..b9ce05b --- /dev/null +++ b/lib/model/passo/class_components.dart @@ -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 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 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, + }; +} diff --git a/lib/model/passo/land_ref.dart b/lib/model/passo/land_ref.dart new file mode 100644 index 0000000..58de998 --- /dev/null +++ b/lib/model/passo/land_ref.dart @@ -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 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 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, + }; +} diff --git a/lib/model/passo/property_appraisal.dart b/lib/model/passo/property_appraisal.dart new file mode 100644 index 0000000..4244db8 --- /dev/null +++ b/lib/model/passo/property_appraisal.dart @@ -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 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 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, + }; +} diff --git a/lib/model/passo/property_assessment.dart b/lib/model/passo/property_assessment.dart new file mode 100644 index 0000000..fb91bff --- /dev/null +++ b/lib/model/passo/property_assessment.dart @@ -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 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 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, + }; +} diff --git a/lib/model/passo/property_info.dart b/lib/model/passo/property_info.dart new file mode 100644 index 0000000..89cd807 --- /dev/null +++ b/lib/model/passo/property_info.dart @@ -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 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 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, + }; +} diff --git a/lib/model/passo/signatories.dart b/lib/model/passo/signatories.dart new file mode 100644 index 0000000..641f491 --- /dev/null +++ b/lib/model/passo/signatories.dart @@ -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 json) => Signatories( + id: json["id"], + signatoryId: json["signatory_id"], + firstname: json["firstname"], + middlename: json["middlename"], + lastname: json["lastname"], + ); + + Map toJson() => { + "id": id, + "signatory_id": signatoryId, + "firstname": firstname, + "middlename": middlename, + "lastname": lastname, + }; +} diff --git a/lib/model/passo/unit_construct.dart b/lib/model/passo/unit_construct.dart new file mode 100644 index 0000000..bc97fa3 --- /dev/null +++ b/lib/model/passo/unit_construct.dart @@ -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 json) => UnitConstruct( + id: json["id"], + bldgType: json["bldg_type"], + building: json["building"], + unitValue: json["unit_value"], + ); + + Map toJson() => { + "id": id, + "bldg_type": bldgType, + "building": building, + "unit_value": unitValue, + }; +} diff --git a/lib/screens/passo/Building/add_building.dart b/lib/screens/passo/Building/add_building.dart new file mode 100644 index 0000000..30922cc --- /dev/null +++ b/lib/screens/passo/Building/add_building.dart @@ -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 formKey = GlobalKey(); + +class AddBuilding extends StatefulWidget { + @override + _AddBuilding createState() => _AddBuilding(); +} + +class _AddBuilding extends State { + 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() + .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() + ..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(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( + listener: (context, state) { + // TODO: implement listener + }, + builder: (context, state) { + if (state is UnitConstructLoaded) { + final unit = state.unit; + return BlocConsumer( + 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 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(); + } +} diff --git a/lib/screens/passo/Building/add_building_components/AddExtraItems.dart b/lib/screens/passo/Building/add_building_components/AddExtraItems.dart new file mode 100644 index 0000000..8e36686 --- /dev/null +++ b/lib/screens/passo/Building/add_building_components/AddExtraItems.dart @@ -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 unit; + final List options; + + AddExtraItems(this.unit, this.options); + + @override + _AddExtraItems createState() => _AddExtraItems(); +} + +class _AddExtraItems extends State { + GlobalKey formKey = GlobalKey(); + 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( + 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: [ + 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() + .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() + .add(LoadAdditionalItems()); + }, + style: ElevatedButton.styleFrom( + primary: Colors.black, + ), + child: const Text("Cancel"), + ), + ), + ], + ) + ], + ), + ), + ))); + } + return Container(); + }); + } +} diff --git a/lib/screens/passo/Building/add_building_components/ExtraItems.dart b/lib/screens/passo/Building/add_building_components/ExtraItems.dart new file mode 100644 index 0000000..90c6573 --- /dev/null +++ b/lib/screens/passo/Building/add_building_components/ExtraItems.dart @@ -0,0 +1,13 @@ +import 'package:flutter/material.dart'; + +class ExtraItemsPage extends StatefulWidget { + @override + _ExtraItemsPage createState() => _ExtraItemsPage(); +} + +class _ExtraItemsPage extends State { + @override + Widget build(BuildContext context) { + return Container(); + } +} diff --git a/lib/screens/passo/Building/add_building_components/additional_items.dart b/lib/screens/passo/Building/add_building_components/additional_items.dart new file mode 100644 index 0000000..d58bc5b --- /dev/null +++ b/lib/screens/passo/Building/add_building_components/additional_items.dart @@ -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 unit; + final List options; + AdditionalItemPage(this.unit, this.options); + + @override + _AdditionalItemPage createState() => _AdditionalItemPage(); +} + +class _AdditionalItemPage extends State { + void deleteItem(int itemId) { + context.read().add(DeleteAdditionalItems(id: itemId)); + } + + @override + Widget build(BuildContext context) { + return BlocConsumer( + listener: (context, state) { + // TODO: implement listener + }, + builder: (context, state) { + final state = context.watch().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() + .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() + .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() + .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, + ), + ], + ), + ), + ), + ], + ), + ); + }, + ); + } +} diff --git a/lib/screens/passo/Building/add_building_components/bldg_location_landref.dart b/lib/screens/passo/Building/add_building_components/bldg_location_landref.dart new file mode 100644 index 0000000..0d92c22 --- /dev/null +++ b/lib/screens/passo/Building/add_building_components/bldg_location_landref.dart @@ -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 { + @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: [ + 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: [ + 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: [ + 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: [ + 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: [ + 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: () { + {} + ; + }, + ) + ], + ) + ], + ), + ), + ); + } +} diff --git a/lib/screens/passo/Building/add_building_components/general_description.dart b/lib/screens/passo/Building/add_building_components/general_description.dart new file mode 100644 index 0000000..7fc58f0 --- /dev/null +++ b/lib/screens/passo/Building/add_building_components/general_description.dart @@ -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 unit; + GeneralDescriptionPage(this.unit); + + @override + _GeneralDescriptionPage createState() => _GeneralDescriptionPage(); +} + +class _GeneralDescriptionPage extends State { + 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: [ + 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: [ + 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: [ + 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: [ + 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: [ + 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: () { + {} + ; + }, + ) + ], + ) + ], + ), + ), + ); + } +} diff --git a/lib/screens/passo/Building/add_building_components/property_appraisal.dart b/lib/screens/passo/Building/add_building_components/property_appraisal.dart new file mode 100644 index 0000000..9b909e0 --- /dev/null +++ b/lib/screens/passo/Building/add_building_components/property_appraisal.dart @@ -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 { + double depRate = 0; + calculateAdditionalItems(List 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( + 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(); + }, + ); + } +} diff --git a/lib/screens/passo/Building/add_building_components/property_assessment.dart b/lib/screens/passo/Building/add_building_components/property_assessment.dart new file mode 100644 index 0000000..e93a223 --- /dev/null +++ b/lib/screens/passo/Building/add_building_components/property_assessment.dart @@ -0,0 +1,1206 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.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/property_appraisal/property_appraisal_bloc.dart'; +import 'package:unit2/bloc/passo/property_assessment/property_assessment_bloc.dart'; +import 'package:unit2/bloc/passo/signatories/signatories_bloc.dart'; +import 'package:unit2/model/passo/property_appraisal.dart'; +import 'package:unit2/model/passo/property_assessment.dart'; +import 'package:unit2/model/passo/signatories.dart'; +import 'package:unit2/screens/passo/Building/add_building.dart'; +import 'package:unit2/theme-data.dart/form-style.dart'; +import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart'; + +class PropertyAssessmentPage extends StatefulWidget { + Function function; + + PropertyAssessmentPage(this.function); + + @override + _PropertyAssessmentPage createState() => _PropertyAssessmentPage(); +} + +class _PropertyAssessmentPage extends State { + double assessment_level = 0; + bool isTaxable = false; + bool isExempt = false; + + String assessmentLevel(marketValue, property_class) { + switch (property_class) { + case 'Residential': + if (marketValue < 175000) { + // setState(() { + // assessment_level = 0; + // }); + return '0 '; + } else if (marketValue < 300000 && marketValue > 175000) { + // setState(() { + // assessment_level = 0.10; + // }); + return '10 '; + } else if (marketValue < 500000 && marketValue > 300000) { + // setState(() { + // assessment_level = 0.20; + // }); + return '20 '; + } else if (marketValue < 750000 && marketValue > 500000) { + // setState(() { + // assessment_level = 0.25; + // }); + return '25 '; + } else if (marketValue < 1000000 && marketValue > 750000) { + // setState(() { + // assessment_level = 0.30; + // }); + return '30 '; + } else if (marketValue < 2000000 && marketValue > 1000000) { + // setState(() { + // assessment_level = 0.35; + // }); + return '35 '; + } else if (marketValue < 5000000 && marketValue > 2000000) { + // setState(() { + // assessment_level = 0.40; + // }); + return '40 '; + } else if (marketValue < 10000000 && marketValue > 5000000) { + // setState(() { + // assessment_level = 0.50; + // }); + return '50 '; + } else if (marketValue > 10000000) { + // setState(() { + // assessment_level = 0.60; + // }); + return '60 '; + } + break; + case 'Agricultural': + if (marketValue < 300000) { + // setState(() { + // assessment_level = 0.45; + // }); + return '45 '; + } else if (marketValue < 500000 && marketValue > 300000) { + // setState(() { + // assessment_level = 0.50; + // }); + return '50 '; + } else if (marketValue < 750000 && marketValue > 5000000) { + // setState(() { + // assessment_level = 0.55; + // }); + return '55 '; + } else if (marketValue < 1000000 && marketValue > 750000) { + // setState(() { + // assessment_level = 0.60; + // }); + return '60 '; + } else if (marketValue < 2000000 && marketValue > 1000000) { + // setState(() { + // assessment_level = 0.65; + // }); + return '65 '; + } else if (marketValue > 2000000) { + // setState(() { + // assessment_level = 0.70; + // }); + return '70 '; + } + break; + case 'Commercial': + if (marketValue < 300000) { + // setState(() { + // assessment_level = 0.30; + // }); + return '30 '; + } else if (marketValue < 500000 && marketValue > 300000) { + // setState(() { + // assessment_level = 0.35; + // }); + return '35 '; + } else if (marketValue < 750000 && marketValue > 500000) { + // setState(() { + // assessment_level = 0.40; + // }); + return '40 '; + } else if (marketValue < 1000000 && marketValue > 750000) { + // setState(() { + // assessment_level = 0.50; + // }); + return '50 '; + } else if (marketValue < 2000000 && marketValue > 1000000) { + // setState(() { + // assessment_level = 0.60; + // }); + return '60 '; + } else if (marketValue < 5000000 && marketValue > 2000000) { + // setState(() { + // assessment_level = 0.70; + // }); + return '70 '; + } else if (marketValue < 10000000 && marketValue > 5000000) { + // setState(() { + // assessment_level = 0.75; + // }); + return '75 '; + } else if (marketValue > 10000000) { + // setState(() { + // assessment_level = 0.80; + // }); + } + break; + case 'Industrial': + if (marketValue < 300000) { + // setState(() { + // assessment_level = 0.30; + // }); + return '30 '; + } else if (marketValue < 500000 && marketValue > 300000) { + // setState(() { + // assessment_level = 0.35; + // }); + return '35 '; + } else if (marketValue < 750000 && marketValue > 500000) { + // setState(() { + // assessment_level = 0.40; + // }); + return '40 '; + } else if (marketValue < 1000000 && marketValue > 750000) { + // setState(() { + // assessment_level = 0.50; + // }); + return '50 '; + } else if (marketValue < 2000000 && marketValue > 1000000) { + // setState(() { + // assessment_level = 0.60; + // }); + return '60 '; + } else if (marketValue < 5000000 && marketValue > 2000000) { + // setState(() { + // assessment_level = 0.70; + // }); + return '70 '; + } else if (marketValue < 10000000 && marketValue > 5000000) { + // setState(() { + // assessment_level = 0.75; + // }); + return '75 '; + } else if (marketValue > 10000000) { + // setState(() { + // assessment_level = 0.80; + // }); + return '80 '; + } + break; + case 'Mineral': + break; + case 'Timberland': + if (marketValue < 300000) { + // setState(() { + // assessment_level = 0.45; + // }); + return '45 '; + } else if (marketValue < 500000 && marketValue > 300000) { + // setState(() { + // assessment_level = 0.50; + // }); + return '50 '; + } else if (marketValue < 750000 && marketValue > 500000) { + // setState(() { + // assessment_level = 0.55; + // }); + return '55 '; + } else if (marketValue < 1000000 && marketValue > 750000) { + // setState(() { + // assessment_level = 0.60; + // }); + return '60 '; + } else if (marketValue < 2000000 && marketValue > 1000000) { + // setState(() { + // assessment_level = 0.65; + // }); + return '65 '; + } else if (marketValue < 2000000) { + // setState(() { + // assessment_level = 0.70; + // }); + return '70 '; + } + break; + default: + } + return ''; + } + + double assessmentValue(marketValue, property_class, appraisal) { + switch (property_class) { + case 'Residential': + if (marketValue < 175000) { + // setState(() { + // assessment_level = 0; + // }); + return marketValue * 0; + } else if (marketValue < 300000 && marketValue > 175000) { + // setState(() { + // assessment_level = 0.10; + // }); + return marketValue * 0.10; + } else if (marketValue < 500000 && marketValue > 300000) { + // setState(() { + // assessment_level = 0.20; + // }); + return marketValue * 0.20; + } else if (marketValue < 750000 && marketValue > 500000) { + // setState(() { + // assessment_level = 0.25; + // }); + return marketValue * 0.25; + } else if (marketValue < 1000000 && marketValue > 750000) { + // setState(() { + // assessment_level = 0.30; + // }); + return marketValue * 0.30; + } else if (marketValue < 2000000 && marketValue > 1000000) { + // setState(() { + // assessment_level = 0.35; + // }); + return marketValue * 0.35; + } else if (marketValue < 5000000 && marketValue > 2000000) { + // setState(() { + // assessment_level = 0.40; + // }); + return marketValue * 0.40; + } else if (marketValue < 10000000 && marketValue > 5000000) { + // setState(() { + // assessment_level = 0.50; + // }); + return marketValue * 0.50; + } else if (marketValue > 10000000) { + // setState(() { + // assessment_level = 0.60; + // }); + return marketValue * 0.60; + } + break; + case 'Agricultural': + if (marketValue < 300000) { + // setState(() { + // assessment_level = 0.45; + // }); + return marketValue * 0.45; + } else if (marketValue < 500000 && marketValue > 300000) { + // setState(() { + // assessment_level = 0.50; + // }); + return marketValue * 0.50; + } else if (marketValue < 750000 && marketValue > 5000000) { + // setState(() { + // assessment_level = 0.55; + // }); + return marketValue * 0.55; + } else if (marketValue < 1000000 && marketValue > 750000) { + // setState(() { + // assessment_level = 0.60; + // }); + return marketValue * 0.60; + } else if (marketValue < 2000000 && marketValue > 1000000) { + // setState(() { + // assessment_level = 0.65; + // }); + return marketValue * 0.65; + } else if (marketValue > 2000000) { + // setState(() { + // assessment_level = 0.70; + // }); + return marketValue * 0.70; + } + break; + case 'Commercial': + if (marketValue < 300000) { + // setState(() { + // assessment_level = 0.30; + // }); + return marketValue * 0.30; + } else if (marketValue < 500000 && marketValue > 300000) { + // setState(() { + // assessment_level = 0.35; + // }); + return marketValue * 0.35; + } else if (marketValue < 750000 && marketValue > 500000) { + // setState(() { + // assessment_level = 0.40; + // }); + return marketValue * 0.40; + } else if (marketValue < 1000000 && marketValue > 750000) { + // setState(() { + // assessment_level = 0.50; + // }); + return marketValue * 0.50; + } else if (marketValue < 2000000 && marketValue > 1000000) { + // setState(() { + // assessment_level = 0.60; + // }); + return marketValue * 0.60; + } else if (marketValue < 5000000 && marketValue > 2000000) { + // setState(() { + // assessment_level = 0.70; + // }); + return marketValue * 0.70; + } else if (marketValue < 10000000 && marketValue > 5000000) { + // setState(() { + // assessment_level = 0.75; + // }); + return marketValue * 0.75; + } else if (marketValue > 10000000) { + // setState(() { + // assessment_level = 0.80; + // }); + } + break; + case 'Industrial': + if (marketValue < 300000) { + // setState(() { + // assessment_level = 0.30; + // }); + return marketValue * 0.30; + } else if (marketValue < 500000 && marketValue > 300000) { + // setState(() { + // assessment_level = 0.35; + // }); + return marketValue * 0.35; + } else if (marketValue < 750000 && marketValue > 500000) { + // setState(() { + // assessment_level = 0.40; + // }); + return marketValue * 0.40; + } else if (marketValue < 1000000 && marketValue > 750000) { + // setState(() { + // assessment_level = 0.50; + // }); + return marketValue * 0.50; + } else if (marketValue < 2000000 && marketValue > 1000000) { + // setState(() { + // assessment_level = 0.60; + // }); + return marketValue * 0.60; + } else if (marketValue < 5000000 && marketValue > 2000000) { + // setState(() { + // assessment_level = 0.70; + // }); + return marketValue * 0.70; + } else if (marketValue < 10000000 && marketValue > 5000000) { + // setState(() { + // assessment_level = 0.75; + // }); + return marketValue * 0.75; + } else if (marketValue > 10000000) { + // setState(() { + // assessment_level = 0.80; + // }); + return marketValue * 0.80; + } + break; + case 'Mineral': + break; + case 'Timberland': + if (marketValue < 300000) { + // setState(() { + // assessment_level = 0.45; + // }); + return marketValue * 0.45; + } else if (marketValue < 500000 && marketValue > 300000) { + // setState(() { + // assessment_level = 0.50; + // }); + return marketValue * 0.50; + } else if (marketValue < 750000 && marketValue > 500000) { + // setState(() { + // assessment_level = 0.55; + // }); + return marketValue * 0.55; + } else if (marketValue < 1000000 && marketValue > 750000) { + // setState(() { + // assessment_level = 0.60; + // }); + return marketValue * 0.60; + } else if (marketValue < 2000000 && marketValue > 1000000) { + // setState(() { + // assessment_level = 0.65; + // }); + return marketValue * 0.65; + } else if (marketValue < 2000000) { + // setState(() { + // assessment_level = 0.70; + // }); + return marketValue * 0.70; + } + break; + default: + } + return 0; + } + + @override + Widget build(BuildContext context) { + return BlocBuilder( + builder: (context, state) { + if (state is PropertyAssessmentLoaded) { + return BlocConsumer( + listener: (context, state) { + // TODO: implement listener + }, builder: (context, state) { + if (state is PropertyAppraisalLoaded) { + final appraisal = state.appraisal; + return BlocConsumer( + listener: (context, state) { + // TODO: implement listener + }, + builder: (context, state) { + if (state is SignatoriesLoaded) { + return Column( + children: [ + Expanded( + flex: 1, + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Container( + margin: const EdgeInsets.only( + left: 20.0, right: 20.0), + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Container( + margin: const EdgeInsets.only( + left: 0, + top: 20, + right: 0, + bottom: 20), + child: const Text( + 'PROPERTY ASSESSMENT', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 18), + textAlign: TextAlign.left), + ), + Column( + children: [ + Row( + children: [ + Container( + width: 100, + margin: const EdgeInsets.only( + top: 15, left: 15), + padding: + const EdgeInsets.all(5.0), + child: const Text( + 'Actual Use', + style: TextStyle( + fontWeight: + FontWeight.bold, + fontSize: 13, + ), + textAlign: TextAlign.center, + ), + ), + Container( + width: 100, + margin: const EdgeInsets.only( + top: 15, left: 15), + padding: + const EdgeInsets.all(5.0), + child: const Text( + 'Market Value', + style: TextStyle( + fontWeight: + FontWeight.bold, + fontSize: 13, + ), + textAlign: TextAlign.center, + ), + ), + Container( + width: 100, + margin: const EdgeInsets.only( + top: 15, left: 15), + padding: + const EdgeInsets.all(5.0), + child: const Text( + 'Ass. Level', + style: TextStyle( + fontWeight: + FontWeight.bold, + fontSize: 13, + ), + textAlign: TextAlign.center, + ), + ), + Container( + width: 100, + margin: const EdgeInsets.only( + top: 15, left: 15), + padding: + const EdgeInsets.all(5.0), + child: const Text( + 'Ass. Value', + style: TextStyle( + fontWeight: + FontWeight.bold, + fontSize: 13, + ), + textAlign: TextAlign.center, + ), + ), + ], + ), + SizedBox( + height: 59, + child: SingleChildScrollView( + scrollDirection: + Axis.horizontal, + child: Row( + children: List.generate( + appraisal.length, + (index) { + return Container( + height: 100, + child: Row( + children: [ + Container( + width: 100, + margin: + const EdgeInsets + .only( + top: 15, + left: 15), + padding: + const EdgeInsets + .all(5.0), + child: Text( + formKey.currentState! + .value[ + 'actual_use'], + style: + TextStyle( + fontWeight: + FontWeight + .bold, + fontSize: 13, + ), + textAlign: + TextAlign + .center, + ), + ), + Container( + width: 100, + margin: + const EdgeInsets + .only( + top: 15, + left: 15), + padding: + const EdgeInsets + .all(5.0), + child: Text( + NumberFormat + .currency( + locale: + 'en-PH', + symbol: "₱", + ).format(double + .parse(appraisal[ + index] + .marketValue)), + style: + TextStyle( + fontWeight: + FontWeight + .bold, + fontSize: 13, + ), + textAlign: + TextAlign + .center, + ), + ), + Container( + width: 100, + margin: + const EdgeInsets + .only( + top: 15, + left: 15), + padding: + const EdgeInsets + .all(5.0), + child: Text( + assessmentLevel( + double + .parse( + appraisal + .elementAt(index) + .marketValue, + ), + formKey + .currentState! + .value['actual_use'], + ) + + '%', + style: + TextStyle( + fontWeight: + FontWeight + .bold, + fontSize: 13, + ), + textAlign: + TextAlign + .center, + ), + ), + Container( + width: 100, + margin: + const EdgeInsets + .only( + top: 15, + left: 15), + padding: + const EdgeInsets + .all(5.0), + child: Text( + NumberFormat + .currency( + locale: + 'en-PH', + symbol: "₱", + ).format( + assessmentValue( + double.parse( + appraisal[index] + .marketValue), + formKey.currentState! + .value[ + 'actual_use'], + appraisal, + ), + ), + style: + TextStyle( + fontWeight: + FontWeight + .bold, + fontSize: 13, + ), + textAlign: + TextAlign + .center, + ), + ), + const SizedBox( + height: 80, + ), + ], + ), + ); + }, + ), + ), + ), + ) + ], + ), + ]))), + ), + Expanded( + flex: 3, + child: SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Column(children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceAround, + children: [ + Row( + children: [ + const Text('Taxable'), + Checkbox( + checkColor: Colors.white, + value: isTaxable, + onChanged: (bool? value) { + setState(() { + isTaxable = value!; + }); + }, + ) + ], + ), + Row( + children: [ + const Text('Exempt'), + Checkbox( + checkColor: Colors.white, + value: isExempt, + onChanged: (bool? value) { + setState(() { + isExempt = value!; + }); + }, + ) + ], + ), + ], + ), + Column( + children: [ + const SizedBox( + height: 20, + ), + const Text( + 'EFFECTIVITY OF ASSESSMENT / REASSESSMENT :', + style: + TextStyle(fontWeight: FontWeight.bold), + ), + const SizedBox( + height: 20, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceAround, + children: [ + const Text('Qtr.'), + SizedBox( + width: 70, + height: 25, + child: FormBuilderTextField( + name: 'qtr', + validator: + FormBuilderValidators.compose([]), + ), + ), + const SizedBox( + width: 20, + ), + const Text('Yr.'), + SizedBox( + width: 70, + height: 25, + child: FormBuilderTextField( + name: 'yr', + validator: + FormBuilderValidators.compose([]), + ), + ), + ], + ), + ], + ), + const SizedBox( + height: 30, + ), + Align( + alignment: Alignment.centerLeft, + child: Text( + 'APPRAISED/ASSESSED BY:', + style: TextStyle(fontWeight: FontWeight.bold), + textAlign: TextAlign.start, + ), + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceAround, + children: [ + Column( + children: [ + SizedBox( + width: 200, + child: FormBuilderDropdown( + name: 'appraised_by', + autofocus: false, + items: state.signatories + .map((signatories) => + DropdownMenuItem( + value: signatories, + child: Text(signatories + .firstname + + ' ' + + signatories + .middlename + + ' ' + + signatories.lastname), + )) + .toList()), + ), + Text('Name'), + ], + ), + SizedBox( + width: 15, + ), + Column( + children: [ + SizedBox( + width: 100, + child: customDatTimePicker( + "Date", "", 'app_date')), + Text('Date'), + ], + ), + ], + ), + SizedBox( + height: 30, + ), + Align( + alignment: Alignment.centerLeft, + child: Text( + 'RECOMMENDING APPROVAL:', + style: + TextStyle(fontWeight: FontWeight.bold), + )), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceAround, + children: [ + Column( + children: [ + SizedBox( + width: 200, + child: FormBuilderDropdown( + name: 'rec_approval', + autofocus: false, + items: state.signatories + .map((signatories) => + DropdownMenuItem( + value: signatories, + child: Text(signatories + .firstname + + ' ' + + signatories + .middlename + + ' ' + + signatories.lastname), + )) + .toList()), + ), + Text('Name'), + ], + ), + SizedBox( + width: 15, + ), + Column( + children: [ + SizedBox( + width: 100, + child: customDatTimePicker( + "Date", "", 'rec_date'), + ), + Text('Date'), + ], + ), + ], + ), + SizedBox( + height: 30, + ), + Align( + alignment: Alignment.centerLeft, + child: Text( + 'APPROVED BY:', + style: TextStyle( + fontWeight: FontWeight.bold, + ), + )), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Column( + children: [ + SizedBox( + width: 200, + child: FormBuilderDropdown( + name: 'apprvd_by', + autofocus: false, + items: state.signatories + .map((signatories) => + DropdownMenuItem( + value: signatories, + child: Text(signatories + .firstname + + ' ' + + signatories + .middlename + + ' ' + + signatories.lastname), + )) + .toList()), + ), + Text('Name'), + ], + ), + ], + ), + SizedBox( + height: 50, + ), + + Align( + alignment: Alignment.centerLeft, + child: Text( + 'MEMORANDA: ', + style: TextStyle( + fontWeight: FontWeight.bold, + ), + )), + SizedBox( + height: 30, + ), + SizedBox( + width: 500, + child: FormBuilderTextField( + name: 'memoranda', + decoration: + normalTextFieldStyle("Memoranda", ""), + minLines: + 6, // any number you need (It works as the rows for the textarea) + keyboardType: TextInputType.multiline, + maxLines: null, + ), + ), + SizedBox( + height: 30, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text('Sworn Statement No. :'), + SizedBox( + width: 150, + height: 20, + child: FormBuilderTextField( + name: 'sworn_statement', + decoration: InputDecoration(), + validator: + FormBuilderValidators.compose([]), + ), + ), + ], + ), + SizedBox( + height: 30, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text('Date Received:'), + SizedBox( + width: 150, + height: 20, + child: customDatTimePicker( + "Date Received", + "", + 'date_received')), + ], + ), + SizedBox( + height: 30, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text('Date of Entry in the Rec. of Ass. :'), + SizedBox( + width: 150, + height: 20, + child: customDatTimePicker( + 'Date of Entry in the Rec. of Ass. :', + '', + 'date_of_entry')), + ], + ), + SizedBox( + height: 30, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text('By:'), + SizedBox( + width: 150, + height: 20, + child: FormBuilderTextField( + name: 'by', + decoration: InputDecoration(), + validator: + FormBuilderValidators.compose([]), + ), + ), + ], + ), + SizedBox( + height: 30, + ), + ElevatedButton( + onPressed: () { + final List + propertyAssessments = []; + + appraisal.asMap().forEach( + (index, PropertyAppraisal appraisal) { + PropertyAssessment ass = PropertyAssessment( + id: 1, + bldgapprDetailsId: 440, + actualUse: formKey + .currentState!.value['actual_use'], + marketValue: appraisal.marketValue, + assessmentLevel: assessmentLevel( + double.parse( + appraisal.marketValue, + ), + formKey + .currentState!.value['actual_use'], + ), + assessedValue: assessmentValue( + double.parse(appraisal.marketValue), + formKey + .currentState!.value['actual_use'], + appraisal, + ).toString(), + taxable: isTaxable, + exempt: isExempt, + qtr: int.parse( + formKey.currentState!.value['qtr']), + yr: int.parse( + formKey.currentState!.value['yr']), + appraisedbyName: formKey.currentState! + .value['appraised_by'].firstname + + ' ' + + formKey + .currentState! + .value['appraised_by'] + .middlename + + ' ' + + formKey.currentState! + .value['appraised_by'].lastname, + appraisedbyDate: formKey + .currentState!.value['app_date'], + recommendapprName: formKey.currentState! + .value['rec_approval'].firstname + + ' ' + + formKey + .currentState! + .value['rec_approval'] + .middlename + + ' ' + + formKey.currentState! + .value['rec_approval'].lastname, + recommendapprDate: formKey + .currentState!.value['rec_date'], + approvedbyName: formKey.currentState! + .value['apprvd_by'].firstname + + ' ' + + formKey.currentState! + .value['apprvd_by'].middlename + + ' ' + + formKey.currentState! + .value['apprvd_by'].lastname, + memoranda: formKey + .currentState!.value['memoranda'], + swornstatementNo: formKey.currentState! + .value['sworn_statement'], + dateReceived: formKey + .currentState!.value['date_received'], + entryDateAssessment: formKey + .currentState!.value['date_of_entry'], + entryDateBy: + formKey.currentState!.value['by'], + ); + + propertyAssessments.add(ass); + }); + + context.read() + ..add(UpdatePropertyAssessment( + assessment: propertyAssessments[0])); + widget.function(); + }, + style: ElevatedButton.styleFrom( + backgroundColor: Colors.red, + foregroundColor: Colors.red), + child: SizedBox( + width: 200, + height: 50, + child: Align( + alignment: Alignment.center, + child: Text( + 'Save', + style: TextStyle( + color: Colors.white, + ), + textAlign: TextAlign.center, + ), + ), + ), + ), + SizedBox( + height: 30, + ), + // Row( + // mainAxisAlignment: + // MainAxisAlignment.spaceAround, + // children: [ + // ElevatedButton( + // onPressed: () { + // // Decrement activeStep, when the previous button is tapped. However, check for lower bound i.e., must be greater than 0. + // if (activeStep > 0) { + // setState(() { + // activeStep--; + // }); + // } + // }, + // style: ElevatedButton.styleFrom( + // shape: const CircleBorder(), + // padding: + // const EdgeInsets.all(30), + // backgroundColor: Colors.red, + // foregroundColor: Colors.red), + // child: const Icon( + // Icons.chevron_left, + // color: Colors.white)), + + // ], + // ) + ]), + ), + ) + ], + ); + } + return Container(); + }, + ); + } + if (state is PropertyAppraisalErrorState) { + return Text(state.error); + } + return Container(); + }); + } + if (state is PropertyAssessmentErrorState) { + return Text(state.error); + } + return Text('null'); + }, + ); + } +} diff --git a/lib/screens/passo/Building/add_building_components/property_info.dart b/lib/screens/passo/Building/add_building_components/property_info.dart new file mode 100644 index 0000000..86c49d9 --- /dev/null +++ b/lib/screens/passo/Building/add_building_components/property_info.dart @@ -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 { + int tempId = 0; + final transaction_codes = ['New', 'Revision']; + + Future _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: [ + 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: [ + 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: [ + 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: [ + 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(); + }, + ) + ]), + ), + ); + } +} diff --git a/lib/screens/passo/Building/add_building_components/structural_materials.dart b/lib/screens/passo/Building/add_building_components/structural_materials.dart new file mode 100644 index 0000000..31476be --- /dev/null +++ b/lib/screens/passo/Building/add_building_components/structural_materials.dart @@ -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 { + List foundation = []; + List column = []; + List beam = []; + List truss_framing = []; + List roof = []; + List flooring = []; + List walls = []; + + List columnOptions = [ + MaterialOption('steel', 'Steel'), + MaterialOption('concrete', 'Reinforced Concrete'), + MaterialOption('wood', 'Wood'), + ]; + + List 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 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 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 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 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 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 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 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', + ), + ), + ], + ), + ); + } +} diff --git a/lib/screens/passo/Test Envi/multi_dropdown.dart b/lib/screens/passo/Test Envi/multi_dropdown.dart new file mode 100644 index 0000000..61a88e4 --- /dev/null +++ b/lib/screens/passo/Test Envi/multi_dropdown.dart @@ -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 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 x) { + setState(() { + selected = x; + }); + }, + options: ['a', 'b', 'c', 'd'], + selectedValues: selected, + whenEmpty: 'Select Something', + ), + ), + )); + } +} diff --git a/lib/screens/passo/Test Envi/speed_dial.dart b/lib/screens/passo/Test Envi/speed_dial.dart new file mode 100644 index 0000000..7d4c1c9 --- /dev/null +++ b/lib/screens/passo/Test Envi/speed_dial.dart @@ -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 { + var theme = ValueNotifier(ThemeMode.dark); + + @override + Widget build(BuildContext context) { + const appTitle = 'Flutter Speed Dial Example'; + return ValueListenableBuilder( + 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 theme; + const MyHomePage({Key? key, required this.theme}) : super(key: key); + @override + _MyHomePageState createState() => _MyHomePageState(); +} + +class _MyHomePageState extends State 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(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( + 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((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( + 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((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( + 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( + 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]; +} diff --git a/lib/screens/passo/passo_home.dart b/lib/screens/passo/passo_home.dart new file mode 100644 index 0000000..dc6240d --- /dev/null +++ b/lib/screens/passo/passo_home.dart @@ -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(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( + 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 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( + // 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)), + ], + ), + ), + ), + ); +} diff --git a/lib/screens/unit2/homepage.dart/components/dashboard.dart b/lib/screens/unit2/homepage.dart/components/dashboard.dart index e1056ac..07e0d11 100644 --- a/lib/screens/unit2/homepage.dart/components/dashboard.dart +++ b/lib/screens/unit2/homepage.dart/components/dashboard.dart @@ -12,7 +12,7 @@ import '../../../../bloc/docsms/docsms_bloc.dart'; class DashBoard extends StatelessWidget { final List 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 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( @@ -55,18 +54,24 @@ class DashBoard extends StatelessWidget { if (role.role.name!.toLowerCase() == 'qr code scanner' && !finishRoles.contains("security")) { - print("1 true"); + print("1 true"); finishRoles.add('scanner'); for (var element in role.role.modules!) { if (element!.name!.toLowerCase() == 'unit2') { for (var element in element.objects!) { - if (element!.id == 9 && + if (element!.id == 9 && element.operations! .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", @@ -79,7 +84,7 @@ class DashBoard extends StatelessWidget { } else if (role.role.name!.toLowerCase() == 'security guard' && !finishRoles.contains('scanner')) { - print("2 true"); + print("2 true"); finishRoles.add('security'); for (var element in role.role.modules!) { if (element!.name!.toLowerCase() == 'unit2') { @@ -96,10 +101,12 @@ 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"); + print("3 true"); for (var element in role.role.modules!) { if (element!.name!.toLowerCase() == 'rpass') { for (var element in element.objects!) { @@ -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", ); @@ -118,7 +128,7 @@ class DashBoard extends StatelessWidget { return Container(); } else if (role.role.name!.toLowerCase() == 'process server') { - print("4 true"); + print("4 true"); for (var element in role.role.modules!) { if (element!.name!.toLowerCase() == 'document management') { @@ -131,12 +141,17 @@ class DashBoard extends StatelessWidget { String? qrBarcode = await qrScanner(); if (qrBarcode != null) { - Navigator.push(NavigationService.navigatorKey.currentContext!, MaterialPageRoute(builder: - (BuildContext context) { + Navigator.push( + NavigationService.navigatorKey + .currentContext!, + MaterialPageRoute(builder: + (BuildContext context) { return BlocProvider( - create: (context) => DocsmsBloc() - ..add(LoadDocument( - documentId: qrBarcode)), + create: (context) => + DocsmsBloc() + ..add(LoadDocument( + documentId: + qrBarcode)), child: const AutoReceiveDocument(), ); @@ -151,12 +166,12 @@ class DashBoard extends StatelessWidget { } } return Container(); - } else if (role.role.name!.toLowerCase() == + } else if (role.role.name!.toLowerCase() == 'establishment point-person' && !finishRoles.contains('superadmin')) { finishRoles.add('establishment point-person'); for (var element in role.role.modules!) { - print("5 true"); + print("5 true"); if (element!.name!.toLowerCase() == 'unit2') { for (var element in element.objects!) { if (element!.id == 7 && @@ -172,8 +187,7 @@ class DashBoard extends StatelessWidget { } } return Container(); - - } else if (role.role.name!.toLowerCase() == + } else if (role.role.name!.toLowerCase() == 'establishment point-person' && !finishRoles.contains('superadmin')) { finishRoles.add('establishment point-person'); @@ -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}); diff --git a/lib/sevices/passo/building/additional_items_services.dart b/lib/sevices/passo/building/additional_items_services.dart new file mode 100644 index 0000000..5215809 --- /dev/null +++ b/lib/sevices/passo/building/additional_items_services.dart @@ -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> 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 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 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); + } + } +} diff --git a/lib/sevices/passo/building/location_landref_services.dart b/lib/sevices/passo/building/location_landref_services.dart new file mode 100644 index 0000000..6098b76 --- /dev/null +++ b/lib/sevices/passo/building/location_landref_services.dart @@ -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 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; + } +} diff --git a/lib/sevices/passo/building/property_appraisal_services.dart b/lib/sevices/passo/building/property_appraisal_services.dart new file mode 100644 index 0000000..44774c7 --- /dev/null +++ b/lib/sevices/passo/building/property_appraisal_services.dart @@ -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> 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 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; + } +} diff --git a/lib/sevices/passo/building/property_assessment_services.dart b/lib/sevices/passo/building/property_assessment_services.dart new file mode 100644 index 0000000..ae98b46 --- /dev/null +++ b/lib/sevices/passo/building/property_assessment_services.dart @@ -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> 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 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 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; + } +} diff --git a/lib/sevices/passo/building/property_info_services.dart b/lib/sevices/passo/building/property_info_services.dart new file mode 100644 index 0000000..5503ad3 --- /dev/null +++ b/lib/sevices/passo/building/property_info_services.dart @@ -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> 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 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 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 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; + } +} diff --git a/lib/sevices/passo/class_components_services.dart b/lib/sevices/passo/class_components_services.dart new file mode 100644 index 0000000..2d3e786 --- /dev/null +++ b/lib/sevices/passo/class_components_services.dart @@ -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> 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); + } + } +} diff --git a/lib/sevices/passo/signatories_service.dart b/lib/sevices/passo/signatories_service.dart new file mode 100644 index 0000000..76eeba7 --- /dev/null +++ b/lib/sevices/passo/signatories_service.dart @@ -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> 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); + } + } +} diff --git a/lib/sevices/passo/unit_construct_services.dart b/lib/sevices/passo/unit_construct_services.dart new file mode 100644 index 0000000..7ef90d5 --- /dev/null +++ b/lib/sevices/passo/unit_construct_services.dart @@ -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> 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); + } + } +} diff --git a/lib/utils/app_router.dart b/lib/utils/app_router.dart index 3bf9c9b..9ea6064 100644 --- a/lib/utils/app_router.dart +++ b/lib/utils/app_router.dart @@ -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,), + return BlocProvider( + create: (context) => PassCheckBloc() + ..add(GetPassCheckAreas( + roleId: arguments.roleId, userId: arguments.userId)), + child: QRCodeScannerSettings( + roleId: arguments.roleId, + userId: arguments.userId, + ), ); }); + case '/passo-home': + // BlocProvider.of( NavigationService.navigatorKey.currentContext!).add(LoadLoggedInUser()); + return MaterialPageRoute(builder: (_) { + return const PassoHome(); + }); default: return MaterialPageRoute(builder: (context) { return Container(); diff --git a/lib/utils/urls.dart b/lib/utils/urls.dart index 5dea2f3..7c94dd6 100644 --- a/lib/utils/urls.dart +++ b/lib/utils/urls.dart @@ -4,11 +4,11 @@ class Url { static Url get instance => _instance; String host() { - // return '192.168.10.183:3000'; - return 'agusandelnorte.gov.ph'; + // return '192.168.10.183:3000'; + // 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(){ - return "/api/jobnet_app/eligibilities/"; -} + String eligibilities() { + return "/api/jobnet_app/eligibilities/"; + } -String getEligibilities(){ - return "/api/jobnet_app/profile/pds/eligibility/"; -} + String getEligibilities() { + return "/api/jobnet_app/profile/pds/eligibility/"; + } -String addEligibility(){ - return "/api/jobnet_app/profile/pds/eligibility/"; -} -String deleteEligibility(){ - return "/api/jobnet_app/profile/pds/eligibility/"; -} + String addEligibility() { + return "/api/jobnet_app/profile/pds/eligibility/"; + } + + String deleteEligibility() { + return "/api/jobnet_app/profile/pds/eligibility/"; + } + + String updateEligibility() { + return "/api/jobnet_app/profile/pds/eligibility/"; + } -String updateEligibility(){ - return "/api/jobnet_app/profile/pds/eligibility/"; -} //// work history paths -String workhistory(){ - return "/api/jobnet_app/profile/pds/work/"; -} -String getPositions(){ - return "/api/jobnet_app/positions/"; -} -String getAgencies(){ + String workhistory() { + return "/api/jobnet_app/profile/pds/work/"; + } + + String getPositions() { + return "/api/jobnet_app/positions/"; + } + + String getAgencies() { return "/api/jobnet_app/agencies/"; -} + } -String getAgencyCategory(){ - return "api/jobnet_app/agency_categories/"; -} - -String identifications(){ - return "/api/jobnet_app/profile/pds/basic/identification/"; -} + String getAgencyCategory() { + return "api/jobnet_app/agency_categories/"; + } + String identifications() { + return "/api/jobnet_app/profile/pds/basic/identification/"; + } ////educational background paths -String educationalBackground(){ - return "/api/jobnet_app/profile/pds/education/"; -} -String getSchools(){ - return "/api/jobnet_app/schools/"; -} -String getPrograms(){ - return "api/jobnet_app/education_programs/"; -} -String getHonors(){ - return "/api/jobnet_app/honors"; -} + String educationalBackground() { + return "/api/jobnet_app/profile/pds/education/"; + } + + String getSchools() { + return "/api/jobnet_app/schools/"; + } + + String getPrograms() { + return "api/jobnet_app/education_programs/"; + } + + String getHonors() { + return "/api/jobnet_app/honors"; + } //// learning and development paths -String learningAndDevelopments(){ - return "api/jobnet_app/profile/pds/learning_development/"; -} -String conductedTrainings(){ - return "api/jobnet_app/conducted_trainings/"; -} -String learningAndDevelopmentType(){ - return "api/jobnet_app/learning_development/"; -} -String learningAndDevelopmentTopics(){ - return "api/jobnet_app/training_topics/"; -} + String learningAndDevelopments() { + return "api/jobnet_app/profile/pds/learning_development/"; + } + + String conductedTrainings() { + return "api/jobnet_app/conducted_trainings/"; + } + + String learningAndDevelopmentType() { + return "api/jobnet_app/learning_development/"; + } + + String learningAndDevelopmentTopics() { + return "api/jobnet_app/training_topics/"; + } //// references paths -String reference(){ - return "/api/jobnet_app/profile/pds/personal_reference/"; -} - + String reference() { + return "/api/jobnet_app/profile/pds/personal_reference/"; + } ////voluntary works -String getVoluntaryWorks(){ - return "/api/jobnet_app/profile/pds/voluntary_work/"; -} + String getVoluntaryWorks() { + return "/api/jobnet_app/profile/pds/voluntary_work/"; + } //// skills hobbies -String skillsHobbies(){ - return "/api/jobnet_app/profile/pds/other/skill_hobby/"; -} -String getAllSkillsHobbies(){ - return "/api/jobnet_app/skill_hobby/"; -} + String skillsHobbies() { + return "/api/jobnet_app/profile/pds/other/skill_hobby/"; + } + + String getAllSkillsHobbies() { + return "/api/jobnet_app/skill_hobby/"; + } + //// orgmemberships -String getOrgMemberShips(){ - return "/api/jobnet_app/profile/pds/other/org_membership/"; -} + String getOrgMemberShips() { + return "/api/jobnet_app/profile/pds/other/org_membership/"; + } ////non academic recognition -String getNonAcademicRecognition(){ - return "/api/jobnet_app/profile/pds/other/non_acad_recognition/"; -} + String getNonAcademicRecognition() { + return "/api/jobnet_app/profile/pds/other/non_acad_recognition/"; + } ////citizenship -String citizenship(){ - return "/api/jobnet_app/profile/pds/basic/citizenship/"; -} + String citizenship() { + return "/api/jobnet_app/profile/pds/basic/citizenship/"; + } ////family paths -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 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/"; + } //// contacts path -String getServiceTypes(){ - return "/api/jobnet_app/comm_service_type/"; + String getServiceTypes() { + return "/api/jobnet_app/comm_service_type/"; + } -} //// address path -String addressPath(){ - return "/api/jobnet_app/profile/pds/basic/address/"; -} + String addressPath() { + return "/api/jobnet_app/profile/pds/basic/address/"; + } + + String contactPath() { + return "/api/jobnet_app/profile/pds/basic/contact/"; + } + + String getCommunicationProvider() { + return "/api/jobnet_app/comm_services/"; + } + + String deleteContact() { + return "/api/jobnet_app/profile/pds/basic/contact/"; + } -String contactPath(){ - return "/api/jobnet_app/profile/pds/basic/contact/"; -} -String getCommunicationProvider(){ - return "/api/jobnet_app/comm_services/"; -} -String deleteContact (){ - return "/api/jobnet_app/profile/pds/basic/contact/"; -} ////profile other info -String getReligions(){ - return "/api/profile_app/religion/"; -} -String getEthnicity(){ - return "/api/profile_app/ethnicity/"; -} + String getReligions() { + return "/api/profile_app/religion/"; + } -String getDisability(){ - return "api/profile_app/disability/"; -} + String getEthnicity() { + return "/api/profile_app/ethnicity/"; + } -String getIndigency(){ - return "/api/profile_app/indigenous/"; -} + String getDisability() { + return "api/profile_app/disability/"; + } -String getGenders(){ - return "/api/profile_app/gender/"; -} + String getIndigency() { + return "/api/profile_app/indigenous/"; + } + + String getGenders() { + return "/api/profile_app/gender/"; + } /////ROLES // pass check -String getAssignAreas(){ - return "/api/account/auth/assigned_role_area/"; -} + String getAssignAreas() { + return "/api/account/auth/assigned_role_area/"; + } -String getPasserInfo(){ - return "/api/profile_app/person_basicinfo/"; -} - -String postLogs(){ - return "/api/unit2_app/monitoring/pass_check/"; -} + String getPasserInfo() { + return "/api/profile_app/person_basicinfo/"; + } + 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/"; } -} \ No newline at end of file +} diff --git a/lib/widgets/passo/custom_button.dart b/lib/widgets/passo/custom_button.dart new file mode 100644 index 0000000..4823030 --- /dev/null +++ b/lib/widgets/passo/custom_button.dart @@ -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, + ); + } +} diff --git a/lib/widgets/passo/custom_formBuilder_fields.dart b/lib/widgets/passo/custom_formBuilder_fields.dart new file mode 100644 index 0000000..3dc7a25 --- /dev/null +++ b/lib/widgets/passo/custom_formBuilder_fields.dart @@ -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 dropdownItems) { + return Container( + margin: const EdgeInsets.only(left: 0, top: 10, right: 0, bottom: 0), + child: FormBuilderDropdown( + 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'), + ), + ); +} diff --git a/pubspec.lock b/pubspec.lock index 43d40ba..952f940 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -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: diff --git a/pubspec.yaml b/pubspec.yaml index 8bdae44..7ff1dce 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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: