From a8f7fc8d7cce2bf7713584ea37eb59a35a9f981f Mon Sep 17 00:00:00 2001 From: cyzoox Date: Thu, 21 Mar 2024 13:47:57 +0800 Subject: [PATCH] Fix minor bugs on transactional items; added building structure transactional; change ui of property assessment and property appraisal --- .../signatories/signatories_admin_bloc.dart | 14 +- .../signatories/signatories_admin_event.dart | 9 + .../unit_construction_admin_bloc.dart | 3 +- .../unit_construction_admin_event.dart | 9 +- .../additional_items_offline_bloc.dart | 3 +- .../additional_items_offline_event.dart | 5 +- .../bldg_appraisal_offline_bloc.dart | 35 +- .../bldg_appraisal_offline_event.dart | 7 +- .../bldg_assessment_offline_bloc.dart | 13 +- .../bldg_assessment_offline_event.dart | 17 +- .../general_description_bloc.dart | 3 +- .../general_description_event.dart | 7 +- .../landref/landref_location_bloc.dart | 7 +- .../landref/landref_location_event.dart | 7 +- .../building/location/location_bloc.dart | 18 +- .../building/location/location_event.dart | 7 +- .../building/owner_info_bloc/crud_bloc.dart | 8 +- .../building/owner_info_bloc/crud_event.dart | 22 +- .../structural_material_offline_bloc.dart | 26 +- .../structural_material_offline_event.dart | 7 +- lib/model/passo/additional_items.dart | 117 +- lib/model/passo/barangay.dart | 24 +- lib/model/passo/bldg_loc.dart | 61 +- lib/model/passo/building_and_structure.dart | 68 +- lib/model/passo/building_details.dart | 850 +++++++++++ lib/model/passo/city.dart | 28 +- .../passo/class_components _offline.dart | 7 + lib/model/passo/class_components.dart | 4 + lib/model/passo/general_description.dart | 170 +-- lib/model/passo/land_ext.dart | 24 + lib/model/passo/land_ref.dart | 57 +- lib/model/passo/memoranda.dart | 23 +- lib/model/passo/property_assessment.dart | 67 + lib/model/passo/property_info.dart | 77 +- lib/model/passo/signatories.dart | 45 +- lib/model/passo/structural_materials_ii.dart | 81 +- lib/model/passo/structureMaterial.dart | 19 +- lib/model/passo/unit_construct.dart | 16 +- .../offline/homepage/module_screen.dart | 1 - .../offline/passo/admin/class_components.dart | 67 +- .../offline/passo/admin/memoranda.dart | 28 +- .../offline/passo/admin/signatories.dart | 34 +- .../passo/admin/unit_construction.dart | 31 +- .../add/AddBuildingAndStructure..dart | 495 ++++--- .../building/add/AddExtraItemsOffline.dart | 1137 +++++++-------- .../passo/building/add/additional_items.dart | 46 +- .../building/add/building_and_structure.dart | 45 +- .../building/add/general_description.dart | 112 +- .../passo/building/add/landref_location.dart | 70 +- .../building/add/property_appraisal.dart | 247 ++-- .../building/add/property_assessment.dart | 906 ++++++------ .../building/add/property_owner_info.dart | 43 +- .../building/add/structural_material.dart | 104 +- .../building/edit/AddExtraItemsEdit.dart | 3 +- .../building/edit/AddExtraItemsOffline.dart | 743 ++++++++++ .../building/edit/additional_items_edit.dart | 81 +- .../building/edit/building_and_structure.dart | 336 +++++ .../passo/building/edit/edit_building.dart | 24 +- .../edit/property_appraisal_edit.dart | 1168 ++++++---------- .../edit/property_assessment_edit.dart | 1059 ++++++++------ .../edit/property_owner_info_edit.dart | 44 +- .../edit/structural_materials_edit.dart | 34 +- .../offline/passo/building_home_offline.dart | 303 +++- .../passo/land/add/land_appraisal.dart | 1 - .../passo/land/add/other_improvement.dart | 1 - lib/screens/passo/Building/add_building.dart | 301 ---- .../AddExtraItems.dart | 599 -------- .../additional_items.dart | 292 ---- .../bldg_location_landref.dart | 434 ------ .../general_description.dart | 235 ---- .../property_appraisal.dart | 1172 ---------------- .../property_assessment.dart | 631 --------- .../property_info.dart | 165 --- .../structural_materials.dart | 431 ------ lib/screens/passo/Building/edit_building.dart | 211 --- .../Building/edit_building/AddExtraItems.dart | 609 -------- .../edit_building/additional_items.dart | 329 ----- .../edit_building/bldgloc_landref.dart | 419 ------ .../edit_building/general_description.dart | 361 ----- .../edit_building/property_appraisal.dart | 1244 ----------------- .../property_assessement_edit.dart | 1176 ---------------- .../edit_building/property_owner_info.dart | 254 ---- .../edit_building/structural_materials.dart | 448 ------ .../structural_materials_edit.dart | 481 ------- .../property_owner_info.dart | 13 - lib/screens/passo/Land/add_land.dart | 120 -- .../passo/Land/add_land/AddLandAppraisal.dart | 448 ------ .../add_land/AddLandValueAdjustmentModal.dart | 527 ------- .../add_land/AddOtherImprovementModal.dart | 359 ----- .../add_land/AddPropertyAssessmentModal.dart | 352 ----- .../passo/Land/add_land/land_appraisal.dart | 282 ---- .../add_land/location_and_boundaries.dart | 143 -- .../Land/add_land/other_improvements.dart | 285 ---- .../Land/add_land/property_assessment.dart | 263 ---- .../add_land/property_assessment_cont.dart | 621 -------- .../Land/add_land/property_owner_info.dart | 170 --- .../Land/add_land/value_adjustments.dart | 260 ---- lib/screens/passo/Land/edit_land.dart | 117 -- .../Land/edit_land/AddLandAppraisalEdit.dart | 464 ------ .../AddOtherImprovementEditModal.dart | 358 ----- .../AddPropertyAssessmentEditModal.dart | 356 ----- .../passo/Land/edit_land/land_appraisal.dart | 292 ---- .../location_and_boundaries_edit.dart | 270 ---- .../edit_land/other_improvements_edit.dart | 313 ----- .../property_assessment_cont_edit.dart | 672 --------- .../edit_land/property_assessment_edit.dart | 287 ---- .../edit_land/property_owner_info_edit.dart | 223 --- .../edit_land/value_adjustments_edit.dart | 283 ---- .../passo/Test Envi/multi_dropdown.dart | 94 -- lib/screens/passo/Test Envi/speed_dial.dart | 529 ------- lib/screens/passo/building_home.dart | 450 ------ lib/screens/passo/land_home .dart | 443 ------ lib/screens/passo/passo_dashboard.dart | 61 - .../class_components_api_services.dart | 2 +- .../api_services/memoranda_api_services.dart | 2 +- .../admin/sql_services/sql_services.dart | 81 +- .../building/property_owner_info_service.dart | 5 +- lib/theme-data.dart/form-style.dart | 4 +- lib/utils/app_router.dart | 8 +- lib/utils/urls.dart | 13 +- pubspec.lock | 16 + pubspec.yaml | 2 + 122 files changed, 5963 insertions(+), 22145 deletions(-) create mode 100644 lib/model/passo/building_details.dart create mode 100644 lib/screens/offline/passo/building/edit/AddExtraItemsOffline.dart create mode 100644 lib/screens/offline/passo/building/edit/building_and_structure.dart delete mode 100644 lib/screens/passo/Building/add_building.dart delete mode 100644 lib/screens/passo/Building/add_building_components/AddExtraItems.dart delete mode 100644 lib/screens/passo/Building/add_building_components/additional_items.dart delete mode 100644 lib/screens/passo/Building/add_building_components/bldg_location_landref.dart delete mode 100644 lib/screens/passo/Building/add_building_components/general_description.dart delete mode 100644 lib/screens/passo/Building/add_building_components/property_appraisal.dart delete mode 100644 lib/screens/passo/Building/add_building_components/property_assessment.dart delete mode 100644 lib/screens/passo/Building/add_building_components/property_info.dart delete mode 100644 lib/screens/passo/Building/add_building_components/structural_materials.dart delete mode 100644 lib/screens/passo/Building/edit_building.dart delete mode 100644 lib/screens/passo/Building/edit_building/AddExtraItems.dart delete mode 100644 lib/screens/passo/Building/edit_building/additional_items.dart delete mode 100644 lib/screens/passo/Building/edit_building/bldgloc_landref.dart delete mode 100644 lib/screens/passo/Building/edit_building/general_description.dart delete mode 100644 lib/screens/passo/Building/edit_building/property_appraisal.dart delete mode 100644 lib/screens/passo/Building/edit_building/property_assessement_edit.dart delete mode 100644 lib/screens/passo/Building/edit_building/property_owner_info.dart delete mode 100644 lib/screens/passo/Building/edit_building/structural_materials.dart delete mode 100644 lib/screens/passo/Building/edit_building/structural_materials_edit.dart delete mode 100644 lib/screens/passo/Building/edit_building_new/property_owner_info.dart delete mode 100644 lib/screens/passo/Land/add_land.dart delete mode 100644 lib/screens/passo/Land/add_land/AddLandAppraisal.dart delete mode 100644 lib/screens/passo/Land/add_land/AddLandValueAdjustmentModal.dart delete mode 100644 lib/screens/passo/Land/add_land/AddOtherImprovementModal.dart delete mode 100644 lib/screens/passo/Land/add_land/AddPropertyAssessmentModal.dart delete mode 100644 lib/screens/passo/Land/add_land/land_appraisal.dart delete mode 100644 lib/screens/passo/Land/add_land/location_and_boundaries.dart delete mode 100644 lib/screens/passo/Land/add_land/other_improvements.dart delete mode 100644 lib/screens/passo/Land/add_land/property_assessment.dart delete mode 100644 lib/screens/passo/Land/add_land/property_assessment_cont.dart delete mode 100644 lib/screens/passo/Land/add_land/property_owner_info.dart delete mode 100644 lib/screens/passo/Land/add_land/value_adjustments.dart delete mode 100644 lib/screens/passo/Land/edit_land.dart delete mode 100644 lib/screens/passo/Land/edit_land/AddLandAppraisalEdit.dart delete mode 100644 lib/screens/passo/Land/edit_land/AddOtherImprovementEditModal.dart delete mode 100644 lib/screens/passo/Land/edit_land/AddPropertyAssessmentEditModal.dart delete mode 100644 lib/screens/passo/Land/edit_land/land_appraisal.dart delete mode 100644 lib/screens/passo/Land/edit_land/location_and_boundaries_edit.dart delete mode 100644 lib/screens/passo/Land/edit_land/other_improvements_edit.dart delete mode 100644 lib/screens/passo/Land/edit_land/property_assessment_cont_edit.dart delete mode 100644 lib/screens/passo/Land/edit_land/property_assessment_edit.dart delete mode 100644 lib/screens/passo/Land/edit_land/property_owner_info_edit.dart delete mode 100644 lib/screens/passo/Land/edit_land/value_adjustments_edit.dart delete mode 100644 lib/screens/passo/Test Envi/multi_dropdown.dart delete mode 100644 lib/screens/passo/Test Envi/speed_dial.dart delete mode 100644 lib/screens/passo/building_home.dart delete mode 100644 lib/screens/passo/land_home .dart delete mode 100644 lib/screens/passo/passo_dashboard.dart diff --git a/lib/bloc/offline/offline_passo/admin/signatories/signatories_admin_bloc.dart b/lib/bloc/offline/offline_passo/admin/signatories/signatories_admin_bloc.dart index 755c52b..42d52be 100644 --- a/lib/bloc/offline/offline_passo/admin/signatories/signatories_admin_bloc.dart +++ b/lib/bloc/offline/offline_passo/admin/signatories/signatories_admin_bloc.dart @@ -18,11 +18,15 @@ class SignatoriesAdminBloc }); on((event, emit) async { await SQLServices.instance.createSignatories(Signatories( - id: event.id, - signatoryId: event.signatoryId, - firstname: event.firstname, - middlename: event.middlename, - lastname: event.lastname)); + id: event.id, + signatoryId: event.signatoryId, + firstname: event.firstname, + middlename: event.middlename, + lastname: event.lastname, + designation: event.designation, + // status: event.status + // genCode: event.genCode + )); }); } } diff --git a/lib/bloc/offline/offline_passo/admin/signatories/signatories_admin_event.dart b/lib/bloc/offline/offline_passo/admin/signatories/signatories_admin_event.dart index 2f8bd20..134c4d6 100644 --- a/lib/bloc/offline/offline_passo/admin/signatories/signatories_admin_event.dart +++ b/lib/bloc/offline/offline_passo/admin/signatories/signatories_admin_event.dart @@ -13,6 +13,9 @@ class AddSignatories extends SignatoriesAdminEvent { final String firstname; final String middlename; final String lastname; + final String genCode; + final String designation; + // final String status; const AddSignatories({ required this.id, @@ -20,6 +23,9 @@ class AddSignatories extends SignatoriesAdminEvent { required this.firstname, required this.middlename, required this.lastname, + required this.genCode, + required this.designation, + // required this.status }); @override @@ -29,6 +35,9 @@ class AddSignatories extends SignatoriesAdminEvent { firstname, middlename, lastname, + genCode, + designation, + // status ]; } diff --git a/lib/bloc/offline/offline_passo/admin/unit_construction/unit_construction_admin_bloc.dart b/lib/bloc/offline/offline_passo/admin/unit_construction/unit_construction_admin_bloc.dart index 5455282..6c60e6c 100644 --- a/lib/bloc/offline/offline_passo/admin/unit_construction/unit_construction_admin_bloc.dart +++ b/lib/bloc/offline/offline_passo/admin/unit_construction/unit_construction_admin_bloc.dart @@ -22,7 +22,8 @@ class UnitConstructionAdminBloc id: event.id, bldgType: event.bldgType, building: event.building, - unitValue: event.unitValue), + unitValue: event.unitValue, + genCode: event.genCode), ); }); } diff --git a/lib/bloc/offline/offline_passo/admin/unit_construction/unit_construction_admin_event.dart b/lib/bloc/offline/offline_passo/admin/unit_construction/unit_construction_admin_event.dart index 141103a..7b52fcb 100644 --- a/lib/bloc/offline/offline_passo/admin/unit_construction/unit_construction_admin_event.dart +++ b/lib/bloc/offline/offline_passo/admin/unit_construction/unit_construction_admin_event.dart @@ -12,21 +12,18 @@ class AddUnitConstruct extends UnitConstructionAdminEvent { final String bldgType; final String building; final String unitValue; + final String genCode; const AddUnitConstruct({ required this.id, required this.bldgType, required this.building, required this.unitValue, + required this.genCode, }); @override - List get props => [ - id, - bldgType, - building, - unitValue, - ]; + List get props => [id, bldgType, building, unitValue, genCode]; } class LoadUnitConstruct extends UnitConstructionAdminEvent { diff --git a/lib/bloc/offline/offline_passo/building/additional_items_offline/additional_items_offline_bloc.dart b/lib/bloc/offline/offline_passo/building/additional_items_offline/additional_items_offline_bloc.dart index b154cc4..d38753e 100644 --- a/lib/bloc/offline/offline_passo/building/additional_items_offline/additional_items_offline_bloc.dart +++ b/lib/bloc/offline/offline_passo/building/additional_items_offline/additional_items_offline_bloc.dart @@ -55,7 +55,8 @@ class AdditionalItemsOfflineBloc secondhand: event.secondhand == true ? '1' : '0', paintedUnitval: event.paintedUnitval, secondhandUnitval: event.secondhandUnitval, - actualUse: event.actualUse)); + actualUse: event.actualUse, + genCode: event.genCode)); print(item.toJson()); diff --git a/lib/bloc/offline/offline_passo/building/additional_items_offline/additional_items_offline_event.dart b/lib/bloc/offline/offline_passo/building/additional_items_offline/additional_items_offline_event.dart index 75e9a6c..e0b5f90 100644 --- a/lib/bloc/offline/offline_passo/building/additional_items_offline/additional_items_offline_event.dart +++ b/lib/bloc/offline/offline_passo/building/additional_items_offline/additional_items_offline_event.dart @@ -48,6 +48,7 @@ class AddAdditionalItems extends AdditionalItemsOfflineEvent { final dynamic paintedUnitval; final dynamic secondhandUnitval; final String actualUse; + final String genCode; const AddAdditionalItems({ required this.id, @@ -71,6 +72,7 @@ class AddAdditionalItems extends AdditionalItemsOfflineEvent { required this.paintedUnitval, required this.secondhandUnitval, required this.actualUse, + required this.genCode, }); @override @@ -95,7 +97,8 @@ class AddAdditionalItems extends AdditionalItemsOfflineEvent { secondhand, paintedUnitval, secondhandUnitval, - actualUse + actualUse, + genCode ]; } diff --git a/lib/bloc/offline/offline_passo/building/appraisal_offline/bldg_appraisal_offline_bloc.dart b/lib/bloc/offline/offline_passo/building/appraisal_offline/bldg_appraisal_offline_bloc.dart index 076bca4..19fc2fb 100644 --- a/lib/bloc/offline/offline_passo/building/appraisal_offline/bldg_appraisal_offline_bloc.dart +++ b/lib/bloc/offline/offline_passo/building/appraisal_offline/bldg_appraisal_offline_bloc.dart @@ -13,23 +13,24 @@ class BldgAppraisalOfflineBloc List appraisal = []; on((event, emit) async { await SQLServices.instance.createBldgAppraisal(PropertyAppraisal( - id: event.id, - bldgapprDetailsId: event.bldgapprDetailsId, - assessedById: event.assessedById, - assessedByName: event.assessedByName, - dateCreated: event.dateCreated, - dateModified: event.dateModified, - unitconstructCost: event.unitconstructCost, - buildingCore: event.buildingCore, - unitconstructSubtotal: event.unitconstructSubtotal, - depreciationRate: event.depreciationRate, - depreciationCost: event.depreciationCost, - costAddItems: event.costAddItems, - addItemsSubtotal: event.addItemsSubtotal, - totalpercentDepreciation: event.totalpercentDepreciation, - marketValue: event.marketValue, - totalArea: event.totalArea, - actualUse: event.actualUse)); + id: event.id, + bldgapprDetailsId: event.bldgapprDetailsId, + assessedById: event.assessedById, + assessedByName: event.assessedByName, + dateCreated: event.dateCreated, + dateModified: event.dateModified, + unitconstructCost: event.unitconstructCost, + buildingCore: event.buildingCore, + unitconstructSubtotal: event.unitconstructSubtotal, + depreciationRate: event.depreciationRate, + depreciationCost: event.depreciationCost, + costAddItems: event.costAddItems, + addItemsSubtotal: event.addItemsSubtotal, + totalpercentDepreciation: event.totalpercentDepreciation, + marketValue: event.marketValue, + totalArea: event.totalArea, + actualUse: event.actualUse, + )); }); on((event, emit) async { List> result = diff --git a/lib/bloc/offline/offline_passo/building/appraisal_offline/bldg_appraisal_offline_event.dart b/lib/bloc/offline/offline_passo/building/appraisal_offline/bldg_appraisal_offline_event.dart index 9f4a1ae..75e8a31 100644 --- a/lib/bloc/offline/offline_passo/building/appraisal_offline/bldg_appraisal_offline_event.dart +++ b/lib/bloc/offline/offline_passo/building/appraisal_offline/bldg_appraisal_offline_event.dart @@ -25,6 +25,7 @@ class AddBldgAppraisal extends BldgAppraisalOfflineEvent { final String marketValue; final String totalArea; final String actualUse; + final String genCode; const AddBldgAppraisal( {required this.id, @@ -43,7 +44,8 @@ class AddBldgAppraisal extends BldgAppraisalOfflineEvent { required this.totalpercentDepreciation, required this.marketValue, required this.totalArea, - required this.actualUse}); + required this.actualUse, + required this.genCode}); @override List get props => [ @@ -63,7 +65,8 @@ class AddBldgAppraisal extends BldgAppraisalOfflineEvent { totalpercentDepreciation, marketValue, totalArea, - actualUse + actualUse, + genCode ]; } diff --git a/lib/bloc/offline/offline_passo/building/assessment_offline/bldg_assessment_offline_bloc.dart b/lib/bloc/offline/offline_passo/building/assessment_offline/bldg_assessment_offline_bloc.dart index 01af52e..b0b1347 100644 --- a/lib/bloc/offline/offline_passo/building/assessment_offline/bldg_assessment_offline_bloc.dart +++ b/lib/bloc/offline/offline_passo/building/assessment_offline/bldg_assessment_offline_bloc.dart @@ -15,13 +15,17 @@ class BldgAssessmentOfflineBloc await SQLServices.instance.createBldgAssessment(PropertyAssessment( id: event.id, bldgapprDetailsId: event.bldgapprDetailsId, + assessedById: event.assessedById, + assessedByName: event.assessedByName, + dateCreated: event.dateCreated, + dateModified: event.dateModified, actualUse: event.actualUse, marketValue: event.marketValue, assessmentLevel: event.assessmentLevel, assessedValue: event.assessedValue, taxable: event.taxable, exempt: event.exempt, - qtr: event.qtr.toString(), + qtr: event.qtr, yr: event.yr.toString(), appraisedbyName: event.appraisedbyName, appraisedbyDate: event.appraisedbyDate, @@ -32,7 +36,12 @@ class BldgAssessmentOfflineBloc swornstatementNo: event.swornstatementNo, dateReceived: event.dateReceived, entryDateAssessment: event.entryDateAssessment, - entryDateBy: event.entryDateBy)); + entryDateBy: event.entryDateBy, + note: event.note, + genCode: event.genCode, + appraisedbyDesignation: event.appraisedbyDesignation, + approvedbyDesignation: event.approvedbyDesignation, + recommendapprDesignation: event.recommendapprDesignation)); }); on((event, emit) async { List> result = diff --git a/lib/bloc/offline/offline_passo/building/assessment_offline/bldg_assessment_offline_event.dart b/lib/bloc/offline/offline_passo/building/assessment_offline/bldg_assessment_offline_event.dart index 35faeaf..357b893 100644 --- a/lib/bloc/offline/offline_passo/building/assessment_offline/bldg_assessment_offline_event.dart +++ b/lib/bloc/offline/offline_passo/building/assessment_offline/bldg_assessment_offline_event.dart @@ -20,7 +20,7 @@ class AddBldgAssessment extends BldgAssessmentOfflineEvent { final String assessedValue; final String taxable; final String exempt; - final int qtr; + final String qtr; final int yr; final String appraisedbyName; final String appraisedbyDate; @@ -32,6 +32,11 @@ class AddBldgAssessment extends BldgAssessmentOfflineEvent { final String dateReceived; final String entryDateAssessment; final String entryDateBy; + final String genCode; + final String note; + final String appraisedbyDesignation; + final String recommendapprDesignation; + final String approvedbyDesignation; const AddBldgAssessment({ required this.id, @@ -58,6 +63,11 @@ class AddBldgAssessment extends BldgAssessmentOfflineEvent { required this.dateReceived, required this.entryDateAssessment, required this.entryDateBy, + required this.genCode, + required this.note, + required this.appraisedbyDesignation, + required this.recommendapprDesignation, + required this.approvedbyDesignation, }); @override @@ -86,6 +96,11 @@ class AddBldgAssessment extends BldgAssessmentOfflineEvent { dateReceived, entryDateAssessment, entryDateBy, + genCode, + note, + appraisedbyDesignation, + recommendapprDesignation, + approvedbyDesignation, ]; } diff --git a/lib/bloc/offline/offline_passo/building/general_description/general_description_bloc.dart b/lib/bloc/offline/offline_passo/building/general_description/general_description_bloc.dart index 79d3947..cec53be 100644 --- a/lib/bloc/offline/offline_passo/building/general_description/general_description_bloc.dart +++ b/lib/bloc/offline/offline_passo/building/general_description/general_description_bloc.dart @@ -35,7 +35,8 @@ class GeneralDescriptionBloc totalFloorArea: event.totalFloorArea, floorSketch: event.floorSketch, actualUse: event.actualUse, - unitValue: event.unitValue)); + unitValue: event.unitValue, + genCode: event.genCode)); }); on((event, emit) async { List> result = diff --git a/lib/bloc/offline/offline_passo/building/general_description/general_description_event.dart b/lib/bloc/offline/offline_passo/building/general_description/general_description_event.dart index b35f5bc..84b853a 100644 --- a/lib/bloc/offline/offline_passo/building/general_description/general_description_event.dart +++ b/lib/bloc/offline/offline_passo/building/general_description/general_description_event.dart @@ -33,6 +33,7 @@ class AddGendesc extends GeneralDescriptionEvent { final dynamic floorSketch; final String actualUse; final String unitValue; + final String genCode; const AddGendesc( {required this.id, @@ -59,7 +60,8 @@ class AddGendesc extends GeneralDescriptionEvent { required this.totalFloorArea, required this.floorSketch, required this.actualUse, - required this.unitValue}); + required this.unitValue, + required this.genCode}); @override List get props => [ @@ -87,7 +89,8 @@ class AddGendesc extends GeneralDescriptionEvent { totalFloorArea, floorSketch, actualUse, - unitValue + unitValue, + genCode ]; } diff --git a/lib/bloc/offline/offline_passo/building/landref/landref_location_bloc.dart b/lib/bloc/offline/offline_passo/building/landref/landref_location_bloc.dart index b11f6d9..e17bfde 100644 --- a/lib/bloc/offline/offline_passo/building/landref/landref_location_bloc.dart +++ b/lib/bloc/offline/offline_passo/building/landref/landref_location_bloc.dart @@ -26,7 +26,8 @@ class LandrefLocationBloc tdn: event.tdn, area: event.area, surveyNo: event.surveyNo, - blkNo: event.blkNo), + blkNo: event.blkNo, + genCode: event.genCode), ); }); @@ -51,8 +52,8 @@ class LandrefLocationBloc bldgapprDetailsId: result[0]["bldgapprDetailsId"], assessedById: result[0]["assessedById"], assessedByName: result[0]["assessedByName"], - dateCreated: DateTime.now(), - dateModified: DateTime.now(), + dateCreated: DateTime.now().toString(), + dateModified: DateTime.now().toString(), owner: result[0]["owner"], cloaNo: result[0]["cloaNo"], lotNo: result[0]["lotNo"], diff --git a/lib/bloc/offline/offline_passo/building/landref/landref_location_event.dart b/lib/bloc/offline/offline_passo/building/landref/landref_location_event.dart index 6ded127..fa297fb 100644 --- a/lib/bloc/offline/offline_passo/building/landref/landref_location_event.dart +++ b/lib/bloc/offline/offline_passo/building/landref/landref_location_event.dart @@ -21,6 +21,7 @@ class AddLandRef extends LandrefLocationEvent { final dynamic blkNo; final String dateCreated; final String dateModified; + final String genCode; const AddLandRef( {required this.id, @@ -35,7 +36,8 @@ class AddLandRef extends LandrefLocationEvent { required this.surveyNo, required this.blkNo, required this.dateCreated, - required this.dateModified}); + required this.dateModified, + required this.genCode}); @override List get props => [ @@ -51,7 +53,8 @@ class AddLandRef extends LandrefLocationEvent { surveyNo, blkNo, dateCreated, - dateModified + dateModified, + genCode ]; } diff --git a/lib/bloc/offline/offline_passo/building/location/location_bloc.dart b/lib/bloc/offline/offline_passo/building/location/location_bloc.dart index bd334ac..6988f95 100644 --- a/lib/bloc/offline/offline_passo/building/location/location_bloc.dart +++ b/lib/bloc/offline/offline_passo/building/location/location_bloc.dart @@ -12,15 +12,15 @@ class LocationBloc extends Bloc { List todos = []; on((event, emit) async { await SQLServices.instance.createBldglocation(BldgLoc( - id: event.id, - bldgapprDetailsId: event.bldgapprDetailsId, - assessedById: event.assessedById, - assessedByName: event.assessedByName, - street: event.street, - barangay: event.barangay, - municipality: event.municipality, - province: event.province, - )); + id: event.id, + bldgapprDetailsId: event.bldgapprDetailsId, + assessedById: event.assessedById, + assessedByName: event.assessedByName, + street: event.street, + barangay: event.barangay, + municipality: event.municipality, + province: event.province, + genCode: event.genCode)); }); on((event, emit) async { List> result = diff --git a/lib/bloc/offline/offline_passo/building/location/location_event.dart b/lib/bloc/offline/offline_passo/building/location/location_event.dart index 54f788a..f504e2a 100644 --- a/lib/bloc/offline/offline_passo/building/location/location_event.dart +++ b/lib/bloc/offline/offline_passo/building/location/location_event.dart @@ -18,6 +18,7 @@ class AddLocation extends LocationEvent { final String province; final String dateCreated; final String dateModified; + final String genCode; const AddLocation( {required this.id, @@ -29,7 +30,8 @@ class AddLocation extends LocationEvent { required this.municipality, required this.province, required this.dateCreated, - required this.dateModified}); + required this.dateModified, + required this.genCode}); @override List get props => [ @@ -41,7 +43,8 @@ class AddLocation extends LocationEvent { municipality, province, dateCreated, - dateModified + dateModified, + genCode ]; } diff --git a/lib/bloc/offline/offline_passo/building/owner_info_bloc/crud_bloc.dart b/lib/bloc/offline/offline_passo/building/owner_info_bloc/crud_bloc.dart index 3d33930..5c4c37e 100644 --- a/lib/bloc/offline/offline_passo/building/owner_info_bloc/crud_bloc.dart +++ b/lib/bloc/offline/offline_passo/building/owner_info_bloc/crud_bloc.dart @@ -19,7 +19,10 @@ class CrudBloc extends Bloc { transCode: event.transCode, tdn: event.tdn, pin: event.pin, - owner: event.owner, + fname: event.fname, + mname: event.mname, + lname: event.lname, + bday: event.bday, address: event.address, telno: event.telno, tin: event.tin, @@ -31,7 +34,8 @@ class CrudBloc extends Bloc { assessedById: event.assessedById, assessedByName: event.assessedByName, dateCreated: event.dateCreated, - dateModified: event.dateModified), + dateModified: event.dateModified, + genCode: event.genCode), ); propertyOwner.add(ownerInfo); diff --git a/lib/bloc/offline/offline_passo/building/owner_info_bloc/crud_event.dart b/lib/bloc/offline/offline_passo/building/owner_info_bloc/crud_event.dart index c14ea95..15853c9 100644 --- a/lib/bloc/offline/offline_passo/building/owner_info_bloc/crud_event.dart +++ b/lib/bloc/offline/offline_passo/building/owner_info_bloc/crud_event.dart @@ -9,7 +9,10 @@ class AddTodo extends CrudEvent { final String transCode; final String tdn; final String pin; - final String owner; + final String fname; + final String mname; + final String lname; + final String bday; final String address; final String telno; final String tin; @@ -22,13 +25,17 @@ class AddTodo extends CrudEvent { final String assessedByName; final String dateCreated; final String dateModified; + final String genCode; const AddTodo( {required this.id, required this.transCode, required this.tdn, required this.pin, - required this.owner, + required this.fname, + required this.mname, + required this.lname, + required this.bday, required this.address, required this.telno, required this.tin, @@ -40,7 +47,8 @@ class AddTodo extends CrudEvent { required this.assessedById, required this.assessedByName, required this.dateCreated, - required this.dateModified}); + required this.dateModified, + required this.genCode}); @override List get props => [ @@ -48,7 +56,10 @@ class AddTodo extends CrudEvent { transCode, tdn, pin, - owner, + fname, + mname, + lname, + bday, address, telno, tin, @@ -60,7 +71,8 @@ class AddTodo extends CrudEvent { assessedById, assessedByName, dateCreated, - dateModified + dateModified, + genCode ]; } diff --git a/lib/bloc/offline/offline_passo/building/structural_materials_offline.dart/structural_material_offline_bloc.dart b/lib/bloc/offline/offline_passo/building/structural_materials_offline.dart/structural_material_offline_bloc.dart index 4d0785c..92e505e 100644 --- a/lib/bloc/offline/offline_passo/building/structural_materials_offline.dart/structural_material_offline_bloc.dart +++ b/lib/bloc/offline/offline_passo/building/structural_materials_offline.dart/structural_material_offline_bloc.dart @@ -14,17 +14,21 @@ class StructuralMaterialOfflineBloc extends Bloc materials = []; on((event, emit) async { await SQLServices.instance.createStructuralMaterials(StructureMaterialsII( - id: event.id, - bldgapprDetailsId: event.bldgapprDetailsId, - foundation: event.foundation!.join(', ').split(', '), - columns: event.columns!.join(', ').split(', '), - beams: event.beams!.join(', ').split(', '), - trussFraming: event.trussFraming!.join(', ').split(', '), - roof: event.roof!.join(', ').split(', '), - flooring: event.flooring!.join(', ').split(', '), - walls: event.walls!.join(', ').split(', '), - others: event.others!.join(', ').split(', '), - )); + id: event.id, + bldgapprDetailsId: event.bldgapprDetailsId, + foundation: event.foundation!.join(', ').split(', '), + columns: event.columns!.join(', ').split(', '), + beams: event.beams!.join(', ').split(', '), + trussFraming: event.trussFraming!.join(', ').split(', '), + roof: event.roof!.join(', ').split(', '), + flooring: event.flooring!.join(', ').split(', '), + walls: event.walls!.join(', ').split(', '), + others: event.others!.join(', ').split(', '), + genCode: event.genCode, + assessedById: event.assessedById, + assessedByName: event.assessedByName, + dateCreated: event.dateCreated, + dateModified: event.dateModified)); }); on((event, emit) async { List> result = diff --git a/lib/bloc/offline/offline_passo/building/structural_materials_offline.dart/structural_material_offline_event.dart b/lib/bloc/offline/offline_passo/building/structural_materials_offline.dart/structural_material_offline_event.dart index 9f3509f..507fc57 100644 --- a/lib/bloc/offline/offline_passo/building/structural_materials_offline.dart/structural_material_offline_event.dart +++ b/lib/bloc/offline/offline_passo/building/structural_materials_offline.dart/structural_material_offline_event.dart @@ -22,6 +22,7 @@ class AddStructuralMaterial extends StructuralMaterialOfflineEvent { final String assessedByName; final String dateCreated; final String dateModified; + final String genCode; const AddStructuralMaterial( {required this.id, @@ -37,7 +38,8 @@ class AddStructuralMaterial extends StructuralMaterialOfflineEvent { required this.assessedById, required this.assessedByName, required this.dateCreated, - required this.dateModified}); + required this.dateModified, + required this.genCode}); @override List get props => [ @@ -54,7 +56,8 @@ class AddStructuralMaterial extends StructuralMaterialOfflineEvent { assessedById, assessedByName, dateCreated, - dateModified + dateModified, + genCode ]; } diff --git a/lib/model/passo/additional_items.dart b/lib/model/passo/additional_items.dart index 43571bf..1c88447 100644 --- a/lib/model/passo/additional_items.dart +++ b/lib/model/passo/additional_items.dart @@ -29,46 +29,47 @@ class AdditionalItems { final dynamic paintedUnitval; final dynamic secondhandUnitval; final String actualUse; + final String genCode; - 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, - }); + 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, + required this.genCode}); - AdditionalItems copy({ - int? id, - int? bldgapprDetailsId, - int? classId, - String? className, - String? structType, - dynamic unitValue, - dynamic baseUnitValue, - dynamic area, - dynamic marketValue, - dynamic depreciationRate, - dynamic adjustedMarketVal, - dynamic amtDepreciation, - String? painted, - String? secondhand, - dynamic paintedUnitval, - dynamic secondhandUnitval, - String? actualUse, - }) { + AdditionalItems copy( + {int? id, + int? bldgapprDetailsId, + int? classId, + String? className, + String? structType, + dynamic unitValue, + dynamic baseUnitValue, + dynamic area, + dynamic marketValue, + dynamic depreciationRate, + dynamic adjustedMarketVal, + dynamic amtDepreciation, + String? painted, + String? secondhand, + dynamic paintedUnitval, + dynamic secondhandUnitval, + String? actualUse, + String? genCode}) { return AdditionalItems( id: id ?? this.id, bldgapprDetailsId: bldgapprDetailsId ?? this.bldgapprDetailsId, @@ -86,29 +87,30 @@ class AdditionalItems { secondhand: secondhand ?? this.secondhand, paintedUnitval: paintedUnitval ?? this.paintedUnitval, secondhandUnitval: secondhandUnitval ?? this.secondhandUnitval, - actualUse: actualUse ?? this.actualUse); + actualUse: actualUse ?? this.actualUse, + genCode: genCode ?? this.genCode); } factory AdditionalItems.fromJson(Map json) => AdditionalItems( - id: json["id"], - bldgapprDetailsId: json["bldgapprDetailsId"], - classId: json["classId"], - className: json["className"], - structType: json["structType"], - unitValue: json["unitValue"], - baseUnitValue: json["baseUnitValue"], - area: json["area"], - marketValue: json["marketValue"], - depreciationRate: json["depreciationRate"], - adjustedMarketVal: json["adjustedMarketVal"], - amtDepreciation: json["amtDepreciation"], - painted: json["painted"], - secondhand: json["secondhand"], - paintedUnitval: json["paintedUnitval"], - secondhandUnitval: json["secondhandUnitval"], - actualUse: json["actualUse"], - ); + id: json["id"], + bldgapprDetailsId: json["bldgapprDetailsId"], + classId: json["classId"], + className: json["className"], + structType: json["structType"], + unitValue: json["unitValue"], + baseUnitValue: json["baseUnitValue"], + area: json["area"], + marketValue: json["marketValue"], + depreciationRate: json["depreciationRate"], + adjustedMarketVal: json["adjustedMarketVal"], + amtDepreciation: json["amtDepreciation"], + painted: json["painted"], + secondhand: json["secondhand"], + paintedUnitval: json["paintedUnitval"], + secondhandUnitval: json["secondhandUnitval"], + actualUse: json["actualUse"], + genCode: json["gen_code"]); Map toJson() => { "id": id, @@ -128,5 +130,6 @@ class AdditionalItems { "painted_unitval": paintedUnitval, "secondhand_unitval": secondhandUnitval, "actual_use": actualUse, + "gen_code": genCode }; } diff --git a/lib/model/passo/barangay.dart b/lib/model/passo/barangay.dart index a60a06e..9b2e754 100644 --- a/lib/model/passo/barangay.dart +++ b/lib/model/passo/barangay.dart @@ -14,27 +14,30 @@ class Brgy { final String? barangayCode; final String? cityCode; final String? barangayDescription; + final String? genCode; - Brgy({ - this.id, - this.barangayId, - this.barangayCode, - this.cityCode, - this.barangayDescription, - }); + Brgy( + {this.id, + this.barangayId, + this.barangayCode, + this.cityCode, + this.barangayDescription, + this.genCode}); Brgy copy( {int? id, int? barangayId, String? barangayCode, String? cityCode, - String? barangayDescription}) { + String? barangayDescription, + String? genCode}) { return Brgy( id: id ?? this.id, barangayId: barangayId ?? this.barangayId, barangayCode: barangayCode ?? this.barangayCode, cityCode: cityCode ?? this.cityCode, - barangayDescription: barangayDescription ?? this.barangayDescription); + barangayDescription: barangayDescription ?? this.barangayDescription, + genCode: genCode ?? this.genCode); } factory Brgy.fromJson(Map json) => Brgy( @@ -43,6 +46,7 @@ class Brgy { barangayCode: json["barangay_code"], cityCode: json["city_code"], barangayDescription: json["barangay_description"], + genCode: json["gen_code"], ); factory Brgy.fromJson2(Map json) => Brgy( @@ -51,6 +55,7 @@ class Brgy { barangayCode: json["barangayCode"], cityCode: json["cityCode"], barangayDescription: json["barangayDescription"], + genCode: json["gen_code"], ); Map toJson() => { @@ -59,5 +64,6 @@ class Brgy { "barangay_code": barangayCode, "city_code": cityCode, "barangay_description": barangayDescription, + "gen_code": genCode, }; } diff --git a/lib/model/passo/bldg_loc.dart b/lib/model/passo/bldg_loc.dart index d5a575a..4911fff 100644 --- a/lib/model/passo/bldg_loc.dart +++ b/lib/model/passo/bldg_loc.dart @@ -13,12 +13,13 @@ class BldgLoc { final int? bldgapprDetailsId; final String? assessedById; final String? assessedByName; - final DateTime? dateCreated; - final DateTime? dateModified; + final String? dateCreated; + final String? dateModified; final dynamic street; final dynamic barangay; final dynamic municipality; final dynamic province; + final String? genCode; BldgLoc({ this.id, @@ -31,20 +32,21 @@ class BldgLoc { this.barangay, this.municipality, this.province, + this.genCode, }); - BldgLoc copy({ - int? id, - int? bldgapprDetailsId, - String? assessedById, - String? assessedByName, - DateTime? dateCreated, - DateTime? dateModified, - dynamic street, - dynamic barangay, - dynamic municipality, - dynamic province, - }) { + BldgLoc copy( + {int? id, + int? bldgapprDetailsId, + String? assessedById, + String? assessedByName, + String? dateCreated, + String? dateModified, + dynamic street, + dynamic barangay, + dynamic municipality, + dynamic province, + String? genCode}) { return BldgLoc( id: id ?? this.id, bldgapprDetailsId: bldgapprDetailsId ?? this.bldgapprDetailsId, @@ -55,7 +57,8 @@ class BldgLoc { street: street ?? this.street, barangay: barangay ?? this.barangay, municipality: municipality ?? this.municipality, - province: province ?? this.province); + province: province ?? this.province, + genCode: genCode ?? this.genCode); } factory BldgLoc.fromJson(Map json) => BldgLoc( @@ -63,16 +66,27 @@ class BldgLoc { bldgapprDetailsId: json["bldgappr_details_id"], assessedById: json["assessed_by_id"], assessedByName: json["assessed_by_name"], - dateCreated: json["date_created"] == null - ? null - : DateTime.parse(json["date_created"]), - dateModified: json["date_modified"] == null - ? null - : DateTime.parse(json["date_modified"]), + dateCreated: json["date_created"], + dateModified: json["date_modified"], street: json["street"], barangay: json["barangay"], municipality: json["municipality"], province: json["province"], + genCode: json["gen_code"], + ); + + factory BldgLoc.fromJson2(Map json) => BldgLoc( + id: json["id"], + bldgapprDetailsId: json["bldgapprDetailsId"], + assessedById: json["assessedById"], + assessedByName: json["assessedByName"], + dateCreated: json["dateCreated"], + dateModified: json["dateModified"], + street: json["street"], + barangay: json["barangay"], + municipality: json["municipality"], + province: json["province"], + genCode: json["gen_code"], ); Map toJson() => { @@ -80,11 +94,12 @@ class BldgLoc { "bldgappr_details_id": bldgapprDetailsId, "assessed_by_id": assessedById, "assessed_by_name": assessedByName, - "date_created": dateCreated?.toIso8601String(), - "date_modified": dateModified?.toIso8601String(), + "date_created": dateCreated, + "date_modified": dateModified, "street": street, "barangay": barangay, "municipality": municipality, "province": province, + "gen_code": genCode, }; } diff --git a/lib/model/passo/building_and_structure.dart b/lib/model/passo/building_and_structure.dart index 4c1df21..910e818 100644 --- a/lib/model/passo/building_and_structure.dart +++ b/lib/model/passo/building_and_structure.dart @@ -13,119 +13,107 @@ String bldgAndStructureToJson(BldgAndStructure data) => class BldgAndStructure { final int? id; final int? bldgapprDetailsId; - final String? assessedById; - final String? assessedByName; - final String? dateCreated; - final String? dateModified; final String? bldgType; - final String? strucType; + final String? structType; final String? description; final String? actualUse; final String? floorCount; final String? bldgArea; final String? unitValue; + final String? buccPercentage; final String? depRate; final String? marketValue; final String? depAmount; final String? adjustedMarketValue; + final String? genCode; BldgAndStructure({ this.id, this.bldgapprDetailsId, - this.assessedById, - this.assessedByName, - this.dateCreated, - this.dateModified, this.bldgType, - this.strucType, + this.structType, this.description, this.actualUse, this.floorCount, this.bldgArea, this.unitValue, + this.buccPercentage, this.depRate, this.marketValue, this.depAmount, this.adjustedMarketValue, + this.genCode, }); BldgAndStructure copy({ int? id, int? bldgapprDetailsId, - String? assessedById, - String? assessedByName, - String? dateCreated, - String? dateModified, String? bldgType, - String? strucType, + String? structType, String? description, String? actualUse, String? floorCount, String? bldgArea, String? unitValue, + String? buccPercentage, String? depRate, String? marketValue, String? depAmount, String? adjustedMarketValue, + String? genCode, }) => BldgAndStructure( id: id ?? this.id, bldgapprDetailsId: bldgapprDetailsId ?? this.bldgapprDetailsId, - assessedById: assessedById ?? this.assessedById, - assessedByName: assessedByName ?? this.assessedByName, - dateCreated: dateCreated ?? this.dateCreated, - dateModified: dateModified ?? this.dateModified, bldgType: bldgType ?? this.bldgType, - strucType: strucType ?? this.strucType, + structType: structType ?? this.structType, description: description ?? this.description, actualUse: actualUse ?? this.actualUse, floorCount: floorCount ?? this.floorCount, bldgArea: bldgArea ?? this.bldgArea, unitValue: unitValue ?? this.unitValue, + buccPercentage: buccPercentage ?? this.buccPercentage, depRate: depRate ?? this.depRate, marketValue: marketValue ?? this.marketValue, depAmount: depAmount ?? this.depAmount, adjustedMarketValue: adjustedMarketValue ?? this.adjustedMarketValue, + genCode: genCode ?? this.genCode, ); factory BldgAndStructure.fromJson(Map json) => BldgAndStructure( id: json["id"], bldgapprDetailsId: json["bldgapprDetailsId"], - assessedById: json["assessedById"], - assessedByName: json["assessedByName"], - dateCreated: json["dateCreated"], - dateModified: json["dateModified"], bldgType: json["bldgType"], - strucType: json["strucType"], + structType: json["structType"], description: json["description"], actualUse: json["actualUse"], floorCount: json["floorCount"], bldgArea: json["bldgArea"], unitValue: json["unitValue"], + buccPercentage: json["buccPercentage"], depRate: json["depRate"], marketValue: json["marketValue"], depAmount: json["depAmount"], adjustedMarketValue: json["adjustedMarketValue"], + genCode: json["gen_code"], ); Map toJson() => { "id": id, - "bldgapprDetailsId": bldgapprDetailsId, - "assessedById": assessedById, - "assessedByName": assessedByName, - "dateCreated": dateCreated, - "dateModified": dateModified, - "bldgType": bldgType, - "strucType": strucType, + "bldgappr_details_id": bldgapprDetailsId, + "bldg_type": bldgType, + "struct_type": structType, "description": description, - "actualUse": actualUse, - "floorCount": floorCount, - "bldgArea": bldgArea, - "unitValue": unitValue, - "depRate": depRate, - "marketValue": marketValue, - "depAmount": depAmount, - "adjustedMarketValue": adjustedMarketValue, + "actual_use": actualUse, + "floor_count": floorCount, + "bldg_area": bldgArea, + "unit_value": unitValue, + "bucc_percentage": buccPercentage, + "dep_rate": depRate, + "market_value": marketValue, + "dep_amount": depAmount, + "adjusted_market_value": adjustedMarketValue, + "gen_code": genCode, }; } diff --git a/lib/model/passo/building_details.dart b/lib/model/passo/building_details.dart new file mode 100644 index 0000000..b1f6e04 --- /dev/null +++ b/lib/model/passo/building_details.dart @@ -0,0 +1,850 @@ +// To parse this JSON data, do +// +// final buildingDetails = buildingDetailsFromJson(jsonString); + +import 'dart:convert'; + +BuildingDetails buildingDetailsFromJson(String str) => + BuildingDetails.fromJson(json.decode(str)); + +String buildingDetailsToJson(BuildingDetails data) => + json.encode(data.toJson()); + +class BuildingDetails { + final String? assessedById; + final String? assessedByName; + final String? dateCreated; + final String? 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; + final String? faasType; + final String? genCode; + final String? bldgapprLocationDateCreated; + final String? bldgapprLocationDateModified; + final dynamic bldgapprLocationStreet; + final dynamic bldgapprLocationBarangay; + final dynamic bldgapprLocationMunicipality; + final dynamic bldgapprLocationProvince; + final String? bldgapprLocationGenCode; + final String? bldgapprLandrefDateCreated; + final String? bldgapprLandrefDateModified; + final dynamic bldgapprLandrefOwner; + final dynamic bldgapprLandrefCloaNo; + final dynamic bldgapprLandrefLotNo; + final dynamic bldgapprLandrefTdn; + final dynamic bldgapprLandrefArea; + final dynamic bldgapprLandrefSurveyNo; + final dynamic bldgapprLandrefBlkNo; + final String? bldgapprLandrefGenCode; + final String? bldgapprGeneraldescDateCreated; + final String? bldgapprGeneraldescDateModified; + final dynamic bldgapprGeneraldescBldgKind; + final dynamic bldgapprGeneraldescStrucType; + final dynamic bldgapprGeneraldescBldgPermit; + final dynamic bldgapprGeneraldescDateIssued; + final dynamic bldgapprGeneraldescCct; + final dynamic bldgapprGeneraldescCertCompletionIssued; + final dynamic bldgapprGeneraldescCertOccupancyIssued; + final dynamic bldgapprGeneraldescDateCompleted; + final dynamic bldgapprGeneraldescDateOccupied; + final dynamic bldgapprGeneraldescBldgAge; + final dynamic bldgapprGeneraldescNoStoreys; + final dynamic bldgapprGeneraldescArea1Stfloor; + final dynamic bldgapprGeneraldescArea2Ndfloor; + final dynamic bldgapprGeneraldescArea3Rdfloor; + final dynamic bldgapprGeneraldescArea4Thfloor; + final dynamic bldgapprGeneraldescTotalFloorArea; + final dynamic bldgapprGeneraldescFloorSketch; + final dynamic bldgapprGeneraldescActualUse; + final dynamic bldgapprGeneraldescUnitValue; + final String? bldgapprGeneraldescGenCode; + final String? bldgapprStructMaterialsDateCreated; + final String? bldgapprStructMaterialsDateModified; + final dynamic bldgapprStructMaterialsFoundation; + final dynamic bldgapprStructMaterialsColumns; + final dynamic bldgapprStructMaterialsBeams; + final dynamic bldgapprStructMaterialsTrussFraming; + final dynamic bldgapprStructMaterialsRoof; + final dynamic bldgapprStructMaterialsFlooring; + final dynamic bldgapprStructMaterialsWalls; + final dynamic bldgapprStructMaterialsOthers; + final String? bldgapprStructMaterialsGenCode; + final String? bldgapprPropertyAssessmentDateCreated; + final String? bldgapprPropertyAssessmentDateModified; + final dynamic bldgapprPropertyAssessmentActualUse; + final dynamic bldgapprPropertyAssessmentMarketValue; + final dynamic bldgapprPropertyAssessmentAssessmentLevel; + final dynamic bldgapprPropertyAssessmentAssessedValue; + final dynamic bldgapprPropertyAssessmentTaxable; + final dynamic bldgapprPropertyAssessmentExempt; + final dynamic bldgapprPropertyAssessmentQtr; + final dynamic bldgapprPropertyAssessmentYr; + final dynamic bldgapprPropertyAssessmentAppraisedbyName; + final dynamic bldgapprPropertyAssessmentAppraisedbyDate; + final dynamic bldgapprPropertyAssessmentRecommendapprName; + final dynamic bldgapprPropertyAssessmentRecommendapprDate; + final dynamic bldgapprPropertyAssessmentApprovedbyName; + final dynamic bldgapprPropertyAssessmentApprovedbyDate; + final dynamic bldgapprPropertyAssessmentMemoranda; + final dynamic bldgapprPropertyAssessmentSwornstatementNo; + final dynamic bldgapprPropertyAssessmentDateReceived; + final dynamic bldgapprPropertyAssessmentEntryDateAssessment; + final dynamic bldgapprPropertyAssessmentEntryDateBy; + final String? bldgapprPropertyAssessmentGenCode; + final String? bldgapprRecSupersededassDateCreated; + final String? bldgapprRecSupersededassDateModified; + final dynamic bldgapprRecSupersededassPin; + final dynamic bldgapprRecSupersededassTdn; + final dynamic bldgapprRecSupersededassTotalAssval; + final dynamic bldgapprRecSupersededassOwner; + final dynamic bldgapprRecSupersededassEffectivityAss; + final dynamic bldgapprRecSupersededassPageNo; + final dynamic bldgapprRecSupersededassTotalMarketval; + final dynamic bldgapprRecSupersededassTotalArea; + final dynamic bldgapprRecSupersededassRecAssessment; + final dynamic bldgapprRecSupersededassRecTaxmapping; + final dynamic bldgapprRecSupersededassRecRecords; + final dynamic bldgapprRecSupersededassDate; + final String? bldgapprRecSupersededassGenCode; + + BuildingDetails({ + 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, + this.faasType, + this.genCode, + this.bldgapprLocationDateCreated, + this.bldgapprLocationDateModified, + this.bldgapprLocationStreet, + this.bldgapprLocationBarangay, + this.bldgapprLocationMunicipality, + this.bldgapprLocationProvince, + this.bldgapprLocationGenCode, + this.bldgapprLandrefDateCreated, + this.bldgapprLandrefDateModified, + this.bldgapprLandrefOwner, + this.bldgapprLandrefCloaNo, + this.bldgapprLandrefLotNo, + this.bldgapprLandrefTdn, + this.bldgapprLandrefArea, + this.bldgapprLandrefSurveyNo, + this.bldgapprLandrefBlkNo, + this.bldgapprLandrefGenCode, + this.bldgapprGeneraldescDateCreated, + this.bldgapprGeneraldescDateModified, + this.bldgapprGeneraldescBldgKind, + this.bldgapprGeneraldescStrucType, + this.bldgapprGeneraldescBldgPermit, + this.bldgapprGeneraldescDateIssued, + this.bldgapprGeneraldescCct, + this.bldgapprGeneraldescCertCompletionIssued, + this.bldgapprGeneraldescCertOccupancyIssued, + this.bldgapprGeneraldescDateCompleted, + this.bldgapprGeneraldescDateOccupied, + this.bldgapprGeneraldescBldgAge, + this.bldgapprGeneraldescNoStoreys, + this.bldgapprGeneraldescArea1Stfloor, + this.bldgapprGeneraldescArea2Ndfloor, + this.bldgapprGeneraldescArea3Rdfloor, + this.bldgapprGeneraldescArea4Thfloor, + this.bldgapprGeneraldescTotalFloorArea, + this.bldgapprGeneraldescFloorSketch, + this.bldgapprGeneraldescActualUse, + this.bldgapprGeneraldescUnitValue, + this.bldgapprGeneraldescGenCode, + this.bldgapprStructMaterialsDateCreated, + this.bldgapprStructMaterialsDateModified, + this.bldgapprStructMaterialsFoundation, + this.bldgapprStructMaterialsColumns, + this.bldgapprStructMaterialsBeams, + this.bldgapprStructMaterialsTrussFraming, + this.bldgapprStructMaterialsRoof, + this.bldgapprStructMaterialsFlooring, + this.bldgapprStructMaterialsWalls, + this.bldgapprStructMaterialsOthers, + this.bldgapprStructMaterialsGenCode, + this.bldgapprPropertyAssessmentDateCreated, + this.bldgapprPropertyAssessmentDateModified, + this.bldgapprPropertyAssessmentActualUse, + this.bldgapprPropertyAssessmentMarketValue, + this.bldgapprPropertyAssessmentAssessmentLevel, + this.bldgapprPropertyAssessmentAssessedValue, + this.bldgapprPropertyAssessmentTaxable, + this.bldgapprPropertyAssessmentExempt, + this.bldgapprPropertyAssessmentQtr, + this.bldgapprPropertyAssessmentYr, + this.bldgapprPropertyAssessmentAppraisedbyName, + this.bldgapprPropertyAssessmentAppraisedbyDate, + this.bldgapprPropertyAssessmentRecommendapprName, + this.bldgapprPropertyAssessmentRecommendapprDate, + this.bldgapprPropertyAssessmentApprovedbyName, + this.bldgapprPropertyAssessmentApprovedbyDate, + this.bldgapprPropertyAssessmentMemoranda, + this.bldgapprPropertyAssessmentSwornstatementNo, + this.bldgapprPropertyAssessmentDateReceived, + this.bldgapprPropertyAssessmentEntryDateAssessment, + this.bldgapprPropertyAssessmentEntryDateBy, + this.bldgapprPropertyAssessmentGenCode, + this.bldgapprRecSupersededassDateCreated, + this.bldgapprRecSupersededassDateModified, + this.bldgapprRecSupersededassPin, + this.bldgapprRecSupersededassTdn, + this.bldgapprRecSupersededassTotalAssval, + this.bldgapprRecSupersededassOwner, + this.bldgapprRecSupersededassEffectivityAss, + this.bldgapprRecSupersededassPageNo, + this.bldgapprRecSupersededassTotalMarketval, + this.bldgapprRecSupersededassTotalArea, + this.bldgapprRecSupersededassRecAssessment, + this.bldgapprRecSupersededassRecTaxmapping, + this.bldgapprRecSupersededassRecRecords, + this.bldgapprRecSupersededassDate, + this.bldgapprRecSupersededassGenCode, + }); + + BuildingDetails copyWith({ + String? assessedById, + String? assessedByName, + String? dateCreated, + String? dateModified, + String? transCode, + String? tdn, + String? pin, + String? owner, + String? address, + String? telno, + String? tin, + String? adminUser, + String? adminAddress, + String? adminTelno, + String? adminTin, + String? faasType, + String? genCode, + String? bldgapprLocationDateCreated, + String? bldgapprLocationDateModified, + dynamic bldgapprLocationStreet, + dynamic bldgapprLocationBarangay, + dynamic bldgapprLocationMunicipality, + dynamic bldgapprLocationProvince, + String? bldgapprLocationGenCode, + String? bldgapprLandrefDateCreated, + String? bldgapprLandrefDateModified, + dynamic bldgapprLandrefOwner, + dynamic bldgapprLandrefCloaNo, + dynamic bldgapprLandrefLotNo, + dynamic bldgapprLandrefTdn, + dynamic bldgapprLandrefArea, + dynamic bldgapprLandrefSurveyNo, + dynamic bldgapprLandrefBlkNo, + String? bldgapprLandrefGenCode, + String? bldgapprGeneraldescDateCreated, + String? bldgapprGeneraldescDateModified, + dynamic bldgapprGeneraldescBldgKind, + dynamic bldgapprGeneraldescStrucType, + dynamic bldgapprGeneraldescBldgPermit, + dynamic bldgapprGeneraldescDateIssued, + dynamic bldgapprGeneraldescCct, + dynamic bldgapprGeneraldescCertCompletionIssued, + dynamic bldgapprGeneraldescCertOccupancyIssued, + dynamic bldgapprGeneraldescDateCompleted, + dynamic bldgapprGeneraldescDateOccupied, + dynamic bldgapprGeneraldescBldgAge, + dynamic bldgapprGeneraldescNoStoreys, + dynamic bldgapprGeneraldescArea1Stfloor, + dynamic bldgapprGeneraldescArea2Ndfloor, + dynamic bldgapprGeneraldescArea3Rdfloor, + dynamic bldgapprGeneraldescArea4Thfloor, + dynamic bldgapprGeneraldescTotalFloorArea, + dynamic bldgapprGeneraldescFloorSketch, + dynamic bldgapprGeneraldescActualUse, + dynamic bldgapprGeneraldescUnitValue, + String? bldgapprGeneraldescGenCode, + String? bldgapprStructMaterialsDateCreated, + String? bldgapprStructMaterialsDateModified, + dynamic bldgapprStructMaterialsFoundation, + dynamic bldgapprStructMaterialsColumns, + dynamic bldgapprStructMaterialsBeams, + dynamic bldgapprStructMaterialsTrussFraming, + dynamic bldgapprStructMaterialsRoof, + dynamic bldgapprStructMaterialsFlooring, + dynamic bldgapprStructMaterialsWalls, + dynamic bldgapprStructMaterialsOthers, + String? bldgapprStructMaterialsGenCode, + String? bldgapprPropertyAssessmentDateCreated, + String? bldgapprPropertyAssessmentDateModified, + dynamic bldgapprPropertyAssessmentActualUse, + dynamic bldgapprPropertyAssessmentMarketValue, + dynamic bldgapprPropertyAssessmentAssessmentLevel, + dynamic bldgapprPropertyAssessmentAssessedValue, + dynamic bldgapprPropertyAssessmentTaxable, + dynamic bldgapprPropertyAssessmentExempt, + dynamic bldgapprPropertyAssessmentQtr, + dynamic bldgapprPropertyAssessmentYr, + dynamic bldgapprPropertyAssessmentAppraisedbyName, + dynamic bldgapprPropertyAssessmentAppraisedbyDate, + dynamic bldgapprPropertyAssessmentRecommendapprName, + dynamic bldgapprPropertyAssessmentRecommendapprDate, + dynamic bldgapprPropertyAssessmentApprovedbyName, + dynamic bldgapprPropertyAssessmentApprovedbyDate, + dynamic bldgapprPropertyAssessmentMemoranda, + dynamic bldgapprPropertyAssessmentSwornstatementNo, + dynamic bldgapprPropertyAssessmentDateReceived, + dynamic bldgapprPropertyAssessmentEntryDateAssessment, + dynamic bldgapprPropertyAssessmentEntryDateBy, + String? bldgapprPropertyAssessmentGenCode, + String? bldgapprRecSupersededassDateCreated, + String? bldgapprRecSupersededassDateModified, + dynamic bldgapprRecSupersededassPin, + dynamic bldgapprRecSupersededassTdn, + dynamic bldgapprRecSupersededassTotalAssval, + dynamic bldgapprRecSupersededassOwner, + dynamic bldgapprRecSupersededassEffectivityAss, + dynamic bldgapprRecSupersededassPageNo, + dynamic bldgapprRecSupersededassTotalMarketval, + dynamic bldgapprRecSupersededassTotalArea, + dynamic bldgapprRecSupersededassRecAssessment, + dynamic bldgapprRecSupersededassRecTaxmapping, + dynamic bldgapprRecSupersededassRecRecords, + dynamic bldgapprRecSupersededassDate, + String? bldgapprRecSupersededassGenCode, + }) => + BuildingDetails( + assessedById: assessedById ?? this.assessedById, + assessedByName: assessedByName ?? this.assessedByName, + dateCreated: dateCreated ?? this.dateCreated, + dateModified: dateModified ?? this.dateModified, + transCode: transCode ?? this.transCode, + tdn: tdn ?? this.tdn, + pin: pin ?? this.pin, + owner: owner ?? this.owner, + address: address ?? this.address, + telno: telno ?? this.telno, + tin: tin ?? this.tin, + adminUser: adminUser ?? this.adminUser, + adminAddress: adminAddress ?? this.adminAddress, + adminTelno: adminTelno ?? this.adminTelno, + adminTin: adminTin ?? this.adminTin, + faasType: faasType ?? this.faasType, + genCode: genCode ?? this.genCode, + bldgapprLocationDateCreated: + bldgapprLocationDateCreated ?? this.bldgapprLocationDateCreated, + bldgapprLocationDateModified: + bldgapprLocationDateModified ?? this.bldgapprLocationDateModified, + bldgapprLocationStreet: + bldgapprLocationStreet ?? this.bldgapprLocationStreet, + bldgapprLocationBarangay: + bldgapprLocationBarangay ?? this.bldgapprLocationBarangay, + bldgapprLocationMunicipality: + bldgapprLocationMunicipality ?? this.bldgapprLocationMunicipality, + bldgapprLocationProvince: + bldgapprLocationProvince ?? this.bldgapprLocationProvince, + bldgapprLocationGenCode: + bldgapprLocationGenCode ?? this.bldgapprLocationGenCode, + bldgapprLandrefDateCreated: + bldgapprLandrefDateCreated ?? this.bldgapprLandrefDateCreated, + bldgapprLandrefDateModified: + bldgapprLandrefDateModified ?? this.bldgapprLandrefDateModified, + bldgapprLandrefOwner: bldgapprLandrefOwner ?? this.bldgapprLandrefOwner, + bldgapprLandrefCloaNo: + bldgapprLandrefCloaNo ?? this.bldgapprLandrefCloaNo, + bldgapprLandrefLotNo: bldgapprLandrefLotNo ?? this.bldgapprLandrefLotNo, + bldgapprLandrefTdn: bldgapprLandrefTdn ?? this.bldgapprLandrefTdn, + bldgapprLandrefArea: bldgapprLandrefArea ?? this.bldgapprLandrefArea, + bldgapprLandrefSurveyNo: + bldgapprLandrefSurveyNo ?? this.bldgapprLandrefSurveyNo, + bldgapprLandrefBlkNo: bldgapprLandrefBlkNo ?? this.bldgapprLandrefBlkNo, + bldgapprLandrefGenCode: + bldgapprLandrefGenCode ?? this.bldgapprLandrefGenCode, + bldgapprGeneraldescDateCreated: bldgapprGeneraldescDateCreated ?? + this.bldgapprGeneraldescDateCreated, + bldgapprGeneraldescDateModified: bldgapprGeneraldescDateModified ?? + this.bldgapprGeneraldescDateModified, + bldgapprGeneraldescBldgKind: + bldgapprGeneraldescBldgKind ?? this.bldgapprGeneraldescBldgKind, + bldgapprGeneraldescStrucType: + bldgapprGeneraldescStrucType ?? this.bldgapprGeneraldescStrucType, + bldgapprGeneraldescBldgPermit: + bldgapprGeneraldescBldgPermit ?? this.bldgapprGeneraldescBldgPermit, + bldgapprGeneraldescDateIssued: + bldgapprGeneraldescDateIssued ?? this.bldgapprGeneraldescDateIssued, + bldgapprGeneraldescCct: + bldgapprGeneraldescCct ?? this.bldgapprGeneraldescCct, + bldgapprGeneraldescCertCompletionIssued: + bldgapprGeneraldescCertCompletionIssued ?? + this.bldgapprGeneraldescCertCompletionIssued, + bldgapprGeneraldescCertOccupancyIssued: + bldgapprGeneraldescCertOccupancyIssued ?? + this.bldgapprGeneraldescCertOccupancyIssued, + bldgapprGeneraldescDateCompleted: bldgapprGeneraldescDateCompleted ?? + this.bldgapprGeneraldescDateCompleted, + bldgapprGeneraldescDateOccupied: bldgapprGeneraldescDateOccupied ?? + this.bldgapprGeneraldescDateOccupied, + bldgapprGeneraldescBldgAge: + bldgapprGeneraldescBldgAge ?? this.bldgapprGeneraldescBldgAge, + bldgapprGeneraldescNoStoreys: + bldgapprGeneraldescNoStoreys ?? this.bldgapprGeneraldescNoStoreys, + bldgapprGeneraldescArea1Stfloor: bldgapprGeneraldescArea1Stfloor ?? + this.bldgapprGeneraldescArea1Stfloor, + bldgapprGeneraldescArea2Ndfloor: bldgapprGeneraldescArea2Ndfloor ?? + this.bldgapprGeneraldescArea2Ndfloor, + bldgapprGeneraldescArea3Rdfloor: bldgapprGeneraldescArea3Rdfloor ?? + this.bldgapprGeneraldescArea3Rdfloor, + bldgapprGeneraldescArea4Thfloor: bldgapprGeneraldescArea4Thfloor ?? + this.bldgapprGeneraldescArea4Thfloor, + bldgapprGeneraldescTotalFloorArea: bldgapprGeneraldescTotalFloorArea ?? + this.bldgapprGeneraldescTotalFloorArea, + bldgapprGeneraldescFloorSketch: bldgapprGeneraldescFloorSketch ?? + this.bldgapprGeneraldescFloorSketch, + bldgapprGeneraldescActualUse: + bldgapprGeneraldescActualUse ?? this.bldgapprGeneraldescActualUse, + bldgapprGeneraldescUnitValue: + bldgapprGeneraldescUnitValue ?? this.bldgapprGeneraldescUnitValue, + bldgapprGeneraldescGenCode: + bldgapprGeneraldescGenCode ?? this.bldgapprGeneraldescGenCode, + bldgapprStructMaterialsDateCreated: + bldgapprStructMaterialsDateCreated ?? + this.bldgapprStructMaterialsDateCreated, + bldgapprStructMaterialsDateModified: + bldgapprStructMaterialsDateModified ?? + this.bldgapprStructMaterialsDateModified, + bldgapprStructMaterialsFoundation: bldgapprStructMaterialsFoundation ?? + this.bldgapprStructMaterialsFoundation, + bldgapprStructMaterialsColumns: bldgapprStructMaterialsColumns ?? + this.bldgapprStructMaterialsColumns, + bldgapprStructMaterialsBeams: + bldgapprStructMaterialsBeams ?? this.bldgapprStructMaterialsBeams, + bldgapprStructMaterialsTrussFraming: + bldgapprStructMaterialsTrussFraming ?? + this.bldgapprStructMaterialsTrussFraming, + bldgapprStructMaterialsRoof: + bldgapprStructMaterialsRoof ?? this.bldgapprStructMaterialsRoof, + bldgapprStructMaterialsFlooring: bldgapprStructMaterialsFlooring ?? + this.bldgapprStructMaterialsFlooring, + bldgapprStructMaterialsWalls: + bldgapprStructMaterialsWalls ?? this.bldgapprStructMaterialsWalls, + bldgapprStructMaterialsOthers: + bldgapprStructMaterialsOthers ?? this.bldgapprStructMaterialsOthers, + bldgapprStructMaterialsGenCode: bldgapprStructMaterialsGenCode ?? + this.bldgapprStructMaterialsGenCode, + bldgapprPropertyAssessmentDateCreated: + bldgapprPropertyAssessmentDateCreated ?? + this.bldgapprPropertyAssessmentDateCreated, + bldgapprPropertyAssessmentDateModified: + bldgapprPropertyAssessmentDateModified ?? + this.bldgapprPropertyAssessmentDateModified, + bldgapprPropertyAssessmentActualUse: + bldgapprPropertyAssessmentActualUse ?? + this.bldgapprPropertyAssessmentActualUse, + bldgapprPropertyAssessmentMarketValue: + bldgapprPropertyAssessmentMarketValue ?? + this.bldgapprPropertyAssessmentMarketValue, + bldgapprPropertyAssessmentAssessmentLevel: + bldgapprPropertyAssessmentAssessmentLevel ?? + this.bldgapprPropertyAssessmentAssessmentLevel, + bldgapprPropertyAssessmentAssessedValue: + bldgapprPropertyAssessmentAssessedValue ?? + this.bldgapprPropertyAssessmentAssessedValue, + bldgapprPropertyAssessmentTaxable: bldgapprPropertyAssessmentTaxable ?? + this.bldgapprPropertyAssessmentTaxable, + bldgapprPropertyAssessmentExempt: bldgapprPropertyAssessmentExempt ?? + this.bldgapprPropertyAssessmentExempt, + bldgapprPropertyAssessmentQtr: + bldgapprPropertyAssessmentQtr ?? this.bldgapprPropertyAssessmentQtr, + bldgapprPropertyAssessmentYr: + bldgapprPropertyAssessmentYr ?? this.bldgapprPropertyAssessmentYr, + bldgapprPropertyAssessmentAppraisedbyName: + bldgapprPropertyAssessmentAppraisedbyName ?? + this.bldgapprPropertyAssessmentAppraisedbyName, + bldgapprPropertyAssessmentAppraisedbyDate: + bldgapprPropertyAssessmentAppraisedbyDate ?? + this.bldgapprPropertyAssessmentAppraisedbyDate, + bldgapprPropertyAssessmentRecommendapprName: + bldgapprPropertyAssessmentRecommendapprName ?? + this.bldgapprPropertyAssessmentRecommendapprName, + bldgapprPropertyAssessmentRecommendapprDate: + bldgapprPropertyAssessmentRecommendapprDate ?? + this.bldgapprPropertyAssessmentRecommendapprDate, + bldgapprPropertyAssessmentApprovedbyName: + bldgapprPropertyAssessmentApprovedbyName ?? + this.bldgapprPropertyAssessmentApprovedbyName, + bldgapprPropertyAssessmentApprovedbyDate: + bldgapprPropertyAssessmentApprovedbyDate ?? + this.bldgapprPropertyAssessmentApprovedbyDate, + bldgapprPropertyAssessmentMemoranda: + bldgapprPropertyAssessmentMemoranda ?? + this.bldgapprPropertyAssessmentMemoranda, + bldgapprPropertyAssessmentSwornstatementNo: + bldgapprPropertyAssessmentSwornstatementNo ?? + this.bldgapprPropertyAssessmentSwornstatementNo, + bldgapprPropertyAssessmentDateReceived: + bldgapprPropertyAssessmentDateReceived ?? + this.bldgapprPropertyAssessmentDateReceived, + bldgapprPropertyAssessmentEntryDateAssessment: + bldgapprPropertyAssessmentEntryDateAssessment ?? + this.bldgapprPropertyAssessmentEntryDateAssessment, + bldgapprPropertyAssessmentEntryDateBy: + bldgapprPropertyAssessmentEntryDateBy ?? + this.bldgapprPropertyAssessmentEntryDateBy, + bldgapprPropertyAssessmentGenCode: bldgapprPropertyAssessmentGenCode ?? + this.bldgapprPropertyAssessmentGenCode, + bldgapprRecSupersededassDateCreated: + bldgapprRecSupersededassDateCreated ?? + this.bldgapprRecSupersededassDateCreated, + bldgapprRecSupersededassDateModified: + bldgapprRecSupersededassDateModified ?? + this.bldgapprRecSupersededassDateModified, + bldgapprRecSupersededassPin: + bldgapprRecSupersededassPin ?? this.bldgapprRecSupersededassPin, + bldgapprRecSupersededassTdn: + bldgapprRecSupersededassTdn ?? this.bldgapprRecSupersededassTdn, + bldgapprRecSupersededassTotalAssval: + bldgapprRecSupersededassTotalAssval ?? + this.bldgapprRecSupersededassTotalAssval, + bldgapprRecSupersededassOwner: + bldgapprRecSupersededassOwner ?? this.bldgapprRecSupersededassOwner, + bldgapprRecSupersededassEffectivityAss: + bldgapprRecSupersededassEffectivityAss ?? + this.bldgapprRecSupersededassEffectivityAss, + bldgapprRecSupersededassPageNo: bldgapprRecSupersededassPageNo ?? + this.bldgapprRecSupersededassPageNo, + bldgapprRecSupersededassTotalMarketval: + bldgapprRecSupersededassTotalMarketval ?? + this.bldgapprRecSupersededassTotalMarketval, + bldgapprRecSupersededassTotalArea: bldgapprRecSupersededassTotalArea ?? + this.bldgapprRecSupersededassTotalArea, + bldgapprRecSupersededassRecAssessment: + bldgapprRecSupersededassRecAssessment ?? + this.bldgapprRecSupersededassRecAssessment, + bldgapprRecSupersededassRecTaxmapping: + bldgapprRecSupersededassRecTaxmapping ?? + this.bldgapprRecSupersededassRecTaxmapping, + bldgapprRecSupersededassRecRecords: + bldgapprRecSupersededassRecRecords ?? + this.bldgapprRecSupersededassRecRecords, + bldgapprRecSupersededassDate: + bldgapprRecSupersededassDate ?? this.bldgapprRecSupersededassDate, + bldgapprRecSupersededassGenCode: bldgapprRecSupersededassGenCode ?? + this.bldgapprRecSupersededassGenCode, + ); + + factory BuildingDetails.fromJson(Map json) => + BuildingDetails( + assessedById: json["assessed_by_id"], + assessedByName: json["assessed_by_name"], + dateCreated: json["date_created"], + dateModified: 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"], + faasType: json["faas_type"], + genCode: json["gen_code"], + bldgapprLocationDateCreated: json["bldgappr_location.date_created"], + bldgapprLocationDateModified: json["bldgappr_location.date_modified"], + bldgapprLocationStreet: json["bldgappr_location.street"], + bldgapprLocationBarangay: json["bldgappr_location.barangay"], + bldgapprLocationMunicipality: json["bldgappr_location.municipality"], + bldgapprLocationProvince: json["bldgappr_location.province"], + bldgapprLocationGenCode: json["bldgappr_location.gen_code"], + bldgapprLandrefDateCreated: json["bldgappr_landref.date_created"], + bldgapprLandrefDateModified: json["bldgappr_landref.date_modified"], + bldgapprLandrefOwner: json["bldgappr_landref.owner"], + bldgapprLandrefCloaNo: json["bldgappr_landref.cloa_no"], + bldgapprLandrefLotNo: json["bldgappr_landref.lot_no"], + bldgapprLandrefTdn: json["bldgappr_landref.tdn"], + bldgapprLandrefArea: json["bldgappr_landref.area"], + bldgapprLandrefSurveyNo: json["bldgappr_landref.survey_no"], + bldgapprLandrefBlkNo: json["bldgappr_landref.blk_no"], + bldgapprLandrefGenCode: json["bldgappr_landref.gen_code"], + bldgapprGeneraldescDateCreated: + json["bldgappr_generaldesc.date_created"], + bldgapprGeneraldescDateModified: + json["bldgappr_generaldesc.date_modified"], + bldgapprGeneraldescBldgKind: json["bldgappr_generaldesc.bldg_kind"], + bldgapprGeneraldescStrucType: json["bldgappr_generaldesc.struc_type"], + bldgapprGeneraldescBldgPermit: json["bldgappr_generaldesc.bldg_permit"], + bldgapprGeneraldescDateIssued: json["bldgappr_generaldesc.date_issued"], + bldgapprGeneraldescCct: json["bldgappr_generaldesc.cct"], + bldgapprGeneraldescCertCompletionIssued: + json["bldgappr_generaldesc.cert_completion_issued"], + bldgapprGeneraldescCertOccupancyIssued: + json["bldgappr_generaldesc.cert_occupancy_issued"], + bldgapprGeneraldescDateCompleted: + json["bldgappr_generaldesc.date_completed"], + bldgapprGeneraldescDateOccupied: + json["bldgappr_generaldesc.date_occupied"], + bldgapprGeneraldescBldgAge: json["bldgappr_generaldesc.bldg_age"], + bldgapprGeneraldescNoStoreys: json["bldgappr_generaldesc.no_storeys"], + bldgapprGeneraldescArea1Stfloor: + json["bldgappr_generaldesc.area_1stfloor"], + bldgapprGeneraldescArea2Ndfloor: + json["bldgappr_generaldesc.area_2ndfloor"], + bldgapprGeneraldescArea3Rdfloor: + json["bldgappr_generaldesc.area_3rdfloor"], + bldgapprGeneraldescArea4Thfloor: + json["bldgappr_generaldesc.area_4thfloor"], + bldgapprGeneraldescTotalFloorArea: + json["bldgappr_generaldesc.total_floor_area"], + bldgapprGeneraldescFloorSketch: + json["bldgappr_generaldesc.floor_sketch"], + bldgapprGeneraldescActualUse: json["bldgappr_generaldesc.actual_use"], + bldgapprGeneraldescUnitValue: json["bldgappr_generaldesc.unit_value"], + bldgapprGeneraldescGenCode: json["bldgappr_generaldesc.gen_code"], + bldgapprStructMaterialsDateCreated: + json["bldgappr_struct_materials.date_created"], + bldgapprStructMaterialsDateModified: + json["bldgappr_struct_materials.date_modified"], + bldgapprStructMaterialsFoundation: + json["bldgappr_struct_materials.foundation"], + bldgapprStructMaterialsColumns: + json["bldgappr_struct_materials.columns"], + bldgapprStructMaterialsBeams: json["bldgappr_struct_materials.beams"], + bldgapprStructMaterialsTrussFraming: + json["bldgappr_struct_materials.truss_framing"], + bldgapprStructMaterialsRoof: json["bldgappr_struct_materials.roof"], + bldgapprStructMaterialsFlooring: + json["bldgappr_struct_materials.flooring"], + bldgapprStructMaterialsWalls: json["bldgappr_struct_materials.walls"], + bldgapprStructMaterialsOthers: json["bldgappr_struct_materials.others"], + bldgapprStructMaterialsGenCode: + json["bldgappr_struct_materials.gen_code"], + bldgapprPropertyAssessmentDateCreated: + json["bldgappr_property_assessment.date_created"], + bldgapprPropertyAssessmentDateModified: + json["bldgappr_property_assessment.date_modified"], + bldgapprPropertyAssessmentActualUse: + json["bldgappr_property_assessment.actual_use"], + bldgapprPropertyAssessmentMarketValue: + json["bldgappr_property_assessment.market_value"], + bldgapprPropertyAssessmentAssessmentLevel: + json["bldgappr_property_assessment.assessment_level"], + bldgapprPropertyAssessmentAssessedValue: + json["bldgappr_property_assessment.assessed_value"], + bldgapprPropertyAssessmentTaxable: + json["bldgappr_property_assessment.taxable"], + bldgapprPropertyAssessmentExempt: + json["bldgappr_property_assessment.exempt"], + bldgapprPropertyAssessmentQtr: json["bldgappr_property_assessment.qtr"], + bldgapprPropertyAssessmentYr: json["bldgappr_property_assessment.yr"], + bldgapprPropertyAssessmentAppraisedbyName: + json["bldgappr_property_assessment.appraisedby_name"], + bldgapprPropertyAssessmentAppraisedbyDate: + json["bldgappr_property_assessment.appraisedby_date"], + bldgapprPropertyAssessmentRecommendapprName: + json["bldgappr_property_assessment.recommendappr_name"], + bldgapprPropertyAssessmentRecommendapprDate: + json["bldgappr_property_assessment.recommendappr_date"], + bldgapprPropertyAssessmentApprovedbyName: + json["bldgappr_property_assessment.approvedby_name"], + bldgapprPropertyAssessmentApprovedbyDate: + json["bldgappr_property_assessment.approvedby_date"], + bldgapprPropertyAssessmentMemoranda: + json["bldgappr_property_assessment.memoranda"], + bldgapprPropertyAssessmentSwornstatementNo: + json["bldgappr_property_assessment.swornstatement_no"], + bldgapprPropertyAssessmentDateReceived: + json["bldgappr_property_assessment.date_received"], + bldgapprPropertyAssessmentEntryDateAssessment: + json["bldgappr_property_assessment.entry_date_assessment"], + bldgapprPropertyAssessmentEntryDateBy: + json["bldgappr_property_assessment.entry_date_by"], + bldgapprPropertyAssessmentGenCode: + json["bldgappr_property_assessment.gen_code"], + bldgapprRecSupersededassDateCreated: + json["bldgappr_rec_supersededass.date_created"], + bldgapprRecSupersededassDateModified: + json["bldgappr_rec_supersededass.date_modified"], + bldgapprRecSupersededassPin: json["bldgappr_rec_supersededass.pin"], + bldgapprRecSupersededassTdn: json["bldgappr_rec_supersededass.tdn"], + bldgapprRecSupersededassTotalAssval: + json["bldgappr_rec_supersededass.total_assval"], + bldgapprRecSupersededassOwner: json["bldgappr_rec_supersededass.owner"], + bldgapprRecSupersededassEffectivityAss: + json["bldgappr_rec_supersededass.effectivity_ass"], + bldgapprRecSupersededassPageNo: + json["bldgappr_rec_supersededass.page_no"], + bldgapprRecSupersededassTotalMarketval: + json["bldgappr_rec_supersededass.total_marketval"], + bldgapprRecSupersededassTotalArea: + json["bldgappr_rec_supersededass.total_area"], + bldgapprRecSupersededassRecAssessment: + json["bldgappr_rec_supersededass.rec_assessment"], + bldgapprRecSupersededassRecTaxmapping: + json["bldgappr_rec_supersededass.rec_taxmapping"], + bldgapprRecSupersededassRecRecords: + json["bldgappr_rec_supersededass.rec_records"], + bldgapprRecSupersededassDate: json["bldgappr_rec_supersededass.date"], + bldgapprRecSupersededassGenCode: + json["bldgappr_rec_supersededass.gen_code"], + ); + + Map toJson() => { + "assessed_by_id": assessedById, + "assessed_by_name": assessedByName, + "date_created": dateCreated, + "date_modified": dateModified, + "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, + "faas_type": faasType, + "gen_code": genCode, + "bldgappr_location.date_created": bldgapprLocationDateCreated, + "bldgappr_location.date_modified": bldgapprLocationDateModified, + "bldgappr_location.street": bldgapprLocationStreet, + "bldgappr_location.barangay": bldgapprLocationBarangay, + "bldgappr_location.municipality": bldgapprLocationMunicipality, + "bldgappr_location.province": bldgapprLocationProvince, + "bldgappr_location.gen_code": bldgapprLocationGenCode, + "bldgappr_landref.date_created": bldgapprLandrefDateCreated, + "bldgappr_landref.date_modified": bldgapprLandrefDateModified, + "bldgappr_landref.owner": bldgapprLandrefOwner, + "bldgappr_landref.cloa_no": bldgapprLandrefCloaNo, + "bldgappr_landref.lot_no": bldgapprLandrefLotNo, + "bldgappr_landref.tdn": bldgapprLandrefTdn, + "bldgappr_landref.area": bldgapprLandrefArea, + "bldgappr_landref.survey_no": bldgapprLandrefSurveyNo, + "bldgappr_landref.blk_no": bldgapprLandrefBlkNo, + "bldgappr_landref.gen_code": bldgapprLandrefGenCode, + "bldgappr_generaldesc.date_created": bldgapprGeneraldescDateCreated, + "bldgappr_generaldesc.date_modified": bldgapprGeneraldescDateModified, + "bldgappr_generaldesc.bldg_kind": bldgapprGeneraldescBldgKind, + "bldgappr_generaldesc.struc_type": bldgapprGeneraldescStrucType, + "bldgappr_generaldesc.bldg_permit": bldgapprGeneraldescBldgPermit, + "bldgappr_generaldesc.date_issued": bldgapprGeneraldescDateIssued, + "bldgappr_generaldesc.cct": bldgapprGeneraldescCct, + "bldgappr_generaldesc.cert_completion_issued": + bldgapprGeneraldescCertCompletionIssued, + "bldgappr_generaldesc.cert_occupancy_issued": + bldgapprGeneraldescCertOccupancyIssued, + "bldgappr_generaldesc.date_completed": bldgapprGeneraldescDateCompleted, + "bldgappr_generaldesc.date_occupied": bldgapprGeneraldescDateOccupied, + "bldgappr_generaldesc.bldg_age": bldgapprGeneraldescBldgAge, + "bldgappr_generaldesc.no_storeys": bldgapprGeneraldescNoStoreys, + "bldgappr_generaldesc.area_1stfloor": bldgapprGeneraldescArea1Stfloor, + "bldgappr_generaldesc.area_2ndfloor": bldgapprGeneraldescArea2Ndfloor, + "bldgappr_generaldesc.area_3rdfloor": bldgapprGeneraldescArea3Rdfloor, + "bldgappr_generaldesc.area_4thfloor": bldgapprGeneraldescArea4Thfloor, + "bldgappr_generaldesc.total_floor_area": + bldgapprGeneraldescTotalFloorArea, + "bldgappr_generaldesc.floor_sketch": bldgapprGeneraldescFloorSketch, + "bldgappr_generaldesc.actual_use": bldgapprGeneraldescActualUse, + "bldgappr_generaldesc.unit_value": bldgapprGeneraldescUnitValue, + "bldgappr_generaldesc.gen_code": bldgapprGeneraldescGenCode, + "bldgappr_struct_materials.date_created": + bldgapprStructMaterialsDateCreated, + "bldgappr_struct_materials.date_modified": + bldgapprStructMaterialsDateModified, + "bldgappr_struct_materials.foundation": + bldgapprStructMaterialsFoundation, + "bldgappr_struct_materials.columns": bldgapprStructMaterialsColumns, + "bldgappr_struct_materials.beams": bldgapprStructMaterialsBeams, + "bldgappr_struct_materials.truss_framing": + bldgapprStructMaterialsTrussFraming, + "bldgappr_struct_materials.roof": bldgapprStructMaterialsRoof, + "bldgappr_struct_materials.flooring": bldgapprStructMaterialsFlooring, + "bldgappr_struct_materials.walls": bldgapprStructMaterialsWalls, + "bldgappr_struct_materials.others": bldgapprStructMaterialsOthers, + "bldgappr_struct_materials.gen_code": bldgapprStructMaterialsGenCode, + "bldgappr_property_assessment.date_created": + bldgapprPropertyAssessmentDateCreated, + "bldgappr_property_assessment.date_modified": + bldgapprPropertyAssessmentDateModified, + "bldgappr_property_assessment.actual_use": + bldgapprPropertyAssessmentActualUse, + "bldgappr_property_assessment.market_value": + bldgapprPropertyAssessmentMarketValue, + "bldgappr_property_assessment.assessment_level": + bldgapprPropertyAssessmentAssessmentLevel, + "bldgappr_property_assessment.assessed_value": + bldgapprPropertyAssessmentAssessedValue, + "bldgappr_property_assessment.taxable": + bldgapprPropertyAssessmentTaxable, + "bldgappr_property_assessment.exempt": bldgapprPropertyAssessmentExempt, + "bldgappr_property_assessment.qtr": bldgapprPropertyAssessmentQtr, + "bldgappr_property_assessment.yr": bldgapprPropertyAssessmentYr, + "bldgappr_property_assessment.appraisedby_name": + bldgapprPropertyAssessmentAppraisedbyName, + "bldgappr_property_assessment.appraisedby_date": + bldgapprPropertyAssessmentAppraisedbyDate, + "bldgappr_property_assessment.recommendappr_name": + bldgapprPropertyAssessmentRecommendapprName, + "bldgappr_property_assessment.recommendappr_date": + bldgapprPropertyAssessmentRecommendapprDate, + "bldgappr_property_assessment.approvedby_name": + bldgapprPropertyAssessmentApprovedbyName, + "bldgappr_property_assessment.approvedby_date": + bldgapprPropertyAssessmentApprovedbyDate, + "bldgappr_property_assessment.memoranda": + bldgapprPropertyAssessmentMemoranda, + "bldgappr_property_assessment.swornstatement_no": + bldgapprPropertyAssessmentSwornstatementNo, + "bldgappr_property_assessment.date_received": + bldgapprPropertyAssessmentDateReceived, + "bldgappr_property_assessment.entry_date_assessment": + bldgapprPropertyAssessmentEntryDateAssessment, + "bldgappr_property_assessment.entry_date_by": + bldgapprPropertyAssessmentEntryDateBy, + "bldgappr_property_assessment.gen_code": + bldgapprPropertyAssessmentGenCode, + "bldgappr_rec_supersededass.date_created": + bldgapprRecSupersededassDateCreated, + "bldgappr_rec_supersededass.date_modified": + bldgapprRecSupersededassDateModified, + "bldgappr_rec_supersededass.pin": bldgapprRecSupersededassPin, + "bldgappr_rec_supersededass.tdn": bldgapprRecSupersededassTdn, + "bldgappr_rec_supersededass.total_assval": + bldgapprRecSupersededassTotalAssval, + "bldgappr_rec_supersededass.owner": bldgapprRecSupersededassOwner, + "bldgappr_rec_supersededass.effectivity_ass": + bldgapprRecSupersededassEffectivityAss, + "bldgappr_rec_supersededass.page_no": bldgapprRecSupersededassPageNo, + "bldgappr_rec_supersededass.total_marketval": + bldgapprRecSupersededassTotalMarketval, + "bldgappr_rec_supersededass.total_area": + bldgapprRecSupersededassTotalArea, + "bldgappr_rec_supersededass.rec_assessment": + bldgapprRecSupersededassRecAssessment, + "bldgappr_rec_supersededass.rec_taxmapping": + bldgapprRecSupersededassRecTaxmapping, + "bldgappr_rec_supersededass.rec_records": + bldgapprRecSupersededassRecRecords, + "bldgappr_rec_supersededass.date": bldgapprRecSupersededassDate, + "bldgappr_rec_supersededass.gen_code": bldgapprRecSupersededassGenCode, + }; +} diff --git a/lib/model/passo/city.dart b/lib/model/passo/city.dart index 6d4eec0..fc0057f 100644 --- a/lib/model/passo/city.dart +++ b/lib/model/passo/city.dart @@ -12,35 +12,37 @@ class City { final int? id; final String? cityCode; final String? cityDescription; + final String? genCode; - City({ - this.id, - this.cityCode, - this.cityDescription, - }); + City({this.id, this.cityCode, this.cityDescription, this.genCode}); - City copy({int? id, String? cityCode, String? cityDescription}) { + City copy( + {int? id, String? cityCode, String? cityDescription, String? genCode}) { return City( - id: id ?? this.id, - cityCode: cityCode ?? this.cityCode, - cityDescription: cityDescription ?? this.cityDescription); + id: id ?? this.id, + cityCode: cityCode ?? this.cityCode, + cityDescription: cityDescription ?? this.cityDescription, + genCode: genCode ?? this.genCode, + ); } factory City.fromJson(Map json) => City( id: json["id"], cityCode: json["city_code"], cityDescription: json["city_description"], + genCode: json["gen_code"], ); factory City.fromJson2(Map json) => City( - id: json["id"], - cityCode: json["cityCode"], - cityDescription: json["cityDescription"], - ); + id: json["id"], + cityCode: json["cityCode"], + cityDescription: json["cityDescription"], + genCode: json["genCode"]); Map toJson() => { "id": id, "city_code": cityCode, "city_description": cityDescription, + "gen_code": genCode }; } diff --git a/lib/model/passo/class_components _offline.dart b/lib/model/passo/class_components _offline.dart index 71b777a..c2e9298 100644 --- a/lib/model/passo/class_components _offline.dart +++ b/lib/model/passo/class_components _offline.dart @@ -29,6 +29,7 @@ class ClassComponentsOffline { final String? roughFinish; final String? highFinish; final int? withoutBucc; + // final String? genCode; ClassComponentsOffline({ this.id, @@ -48,6 +49,7 @@ class ClassComponentsOffline { this.roughFinish, this.highFinish, this.withoutBucc, + // this.genCode }); ClassComponentsOffline copy({ @@ -68,6 +70,7 @@ class ClassComponentsOffline { String? roughFinish, String? highFinish, int? withoutBucc, + // String? genCode, }) { return ClassComponentsOffline( id: id ?? this.id, @@ -89,6 +92,7 @@ class ClassComponentsOffline { roughFinish: roughFinish ?? this.roughFinish, highFinish: highFinish ?? this.highFinish, withoutBucc: withoutBucc ?? this.withoutBucc, + // genCode: genCode ?? this.genCode, ); } @@ -111,6 +115,7 @@ class ClassComponentsOffline { roughFinish: json["rough_finish"], highFinish: json["high_finish"], withoutBucc: json["without_bucc"], + // genCode: json["gen_code"], ); factory ClassComponentsOffline.fromJson2(Map json) => @@ -132,6 +137,7 @@ class ClassComponentsOffline { roughFinish: json["roughFinish"], highFinish: json["highFinish"], withoutBucc: json["withoutBucc"], + // genCode: json["genCode"] ); Map toJson() => { @@ -152,5 +158,6 @@ class ClassComponentsOffline { "rough_finish": roughFinish, "high_finish": highFinish, "without_bucc": withoutBucc, + // "gen_code": genCode }; } diff --git a/lib/model/passo/class_components.dart b/lib/model/passo/class_components.dart index b9ce05b..0b111c0 100644 --- a/lib/model/passo/class_components.dart +++ b/lib/model/passo/class_components.dart @@ -29,6 +29,7 @@ class ClassComponents { final String roughFinish; final String highFinish; final bool withoutBucc; + // final String genCode; ClassComponents({ required this.id, @@ -48,6 +49,7 @@ class ClassComponents { required this.roughFinish, required this.highFinish, required this.withoutBucc, + // required this.genCode, }); factory ClassComponents.fromJson(Map json) => @@ -69,6 +71,7 @@ class ClassComponents { roughFinish: json["rough_finish"], highFinish: json["high_finish"], withoutBucc: json["without_bucc"], + // genCode: json["gen_code"] ); Map toJson() => { @@ -89,5 +92,6 @@ class ClassComponents { "rough_finish": roughFinish, "high_finish": highFinish, "without_bucc": withoutBucc, + // "gen_code": genCode, }; } diff --git a/lib/model/passo/general_description.dart b/lib/model/passo/general_description.dart index 19d4e80..19f5d62 100644 --- a/lib/model/passo/general_description.dart +++ b/lib/model/passo/general_description.dart @@ -35,86 +35,93 @@ class GeneralDesc { final dynamic floorSketch; final String? actualUse; final String? unitValue; + final String? genCode; - GeneralDesc( - {this.id, - this.bldgapprDetailsId, - this.assessedById, - this.assessedByName, - this.dateCreated, - this.dateModified, - this.bldgKind, - this.strucType, - this.bldgPermit, - this.dateIssued, - this.cct, - this.certCompletionIssued, - this.certOccupancyIssued, - this.dateCompleted, - this.dateOccupied, - this.bldgAge, - this.noStoreys, - this.area1Stfloor, - this.area2Ndfloor, - this.area3Rdfloor, - this.area4Thfloor, - this.totalFloorArea, - this.floorSketch, - this.actualUse, - this.unitValue}); + GeneralDesc({ + this.id, + this.bldgapprDetailsId, + this.assessedById, + this.assessedByName, + this.dateCreated, + this.dateModified, + this.bldgKind, + this.strucType, + this.bldgPermit, + this.dateIssued, + this.cct, + this.certCompletionIssued, + this.certOccupancyIssued, + this.dateCompleted, + this.dateOccupied, + this.bldgAge, + this.noStoreys, + this.area1Stfloor, + this.area2Ndfloor, + this.area3Rdfloor, + this.area4Thfloor, + this.totalFloorArea, + this.floorSketch, + this.actualUse, + this.unitValue, + this.genCode, + }); - GeneralDesc copy( - {int? id, - int? bldgapprDetailsId, - String? assessedById, - String? assessedByName, - String? dateCreated, - String? dateModified, - String? bldgKind, - String? strucType, - String? bldgPermit, - String? dateIssued, - String? cct, - String? certCompletionIssued, - String? certOccupancyIssued, - String? dateCompleted, - String? dateOccupied, - String? bldgAge, - String? noStoreys, - String? area1Stfloor, - String? area2Ndfloor, - String? area3Rdfloor, - String? area4Thfloor, - String? totalFloorArea, - dynamic floorSketch, - String? actualUse, - String? unitValue}) { + GeneralDesc copy({ + int? id, + int? bldgapprDetailsId, + String? assessedById, + String? assessedByName, + String? dateCreated, + String? dateModified, + String? bldgKind, + String? strucType, + String? bldgPermit, + String? dateIssued, + String? cct, + String? certCompletionIssued, + String? certOccupancyIssued, + String? dateCompleted, + String? dateOccupied, + String? bldgAge, + String? noStoreys, + String? area1Stfloor, + String? area2Ndfloor, + String? area3Rdfloor, + String? area4Thfloor, + String? totalFloorArea, + dynamic floorSketch, + String? actualUse, + String? unitValue, + String? genCode, + }) { return GeneralDesc( - id: id ?? this.id, - bldgapprDetailsId: bldgapprDetailsId ?? this.bldgapprDetailsId, - assessedById: assessedById ?? this.assessedById, - assessedByName: assessedByName ?? this.assessedByName, - dateCreated: dateCreated ?? this.dateCreated, - dateModified: dateModified ?? this.dateModified, - bldgKind: bldgKind ?? this.bldgKind, - strucType: strucType ?? this.strucType, - bldgPermit: bldgPermit ?? this.bldgPermit, - dateIssued: dateIssued ?? this.dateIssued, - cct: cct ?? this.cct, - certCompletionIssued: certCompletionIssued ?? this.certCompletionIssued, - certOccupancyIssued: certOccupancyIssued ?? this.certOccupancyIssued, - dateCompleted: dateCompleted ?? this.dateCompleted, - dateOccupied: dateOccupied ?? this.dateOccupied, - bldgAge: bldgAge ?? this.bldgAge, - noStoreys: noStoreys ?? this.noStoreys, - area1Stfloor: area1Stfloor ?? this.area1Stfloor, - area2Ndfloor: area2Ndfloor ?? this.area2Ndfloor, - area3Rdfloor: area3Rdfloor ?? this.area3Rdfloor, - area4Thfloor: area4Thfloor ?? this.area4Thfloor, - totalFloorArea: totalFloorArea ?? this.totalFloorArea, - floorSketch: floorSketch ?? this.floorSketch, - actualUse: actualUse ?? this.actualUse, - unitValue: unitValue ?? this.unitValue); + id: id ?? this.id, + bldgapprDetailsId: bldgapprDetailsId ?? this.bldgapprDetailsId, + assessedById: assessedById ?? this.assessedById, + assessedByName: assessedByName ?? this.assessedByName, + dateCreated: dateCreated ?? this.dateCreated, + dateModified: dateModified ?? this.dateModified, + bldgKind: bldgKind ?? this.bldgKind, + strucType: strucType ?? this.strucType, + bldgPermit: bldgPermit ?? this.bldgPermit, + dateIssued: dateIssued ?? this.dateIssued, + cct: cct ?? this.cct, + certCompletionIssued: certCompletionIssued ?? this.certCompletionIssued, + certOccupancyIssued: certOccupancyIssued ?? this.certOccupancyIssued, + dateCompleted: dateCompleted ?? this.dateCompleted, + dateOccupied: dateOccupied ?? this.dateOccupied, + bldgAge: bldgAge ?? this.bldgAge, + noStoreys: noStoreys ?? this.noStoreys, + area1Stfloor: area1Stfloor ?? this.area1Stfloor, + area2Ndfloor: area2Ndfloor ?? this.area2Ndfloor, + area3Rdfloor: area3Rdfloor ?? this.area3Rdfloor, + area4Thfloor: area4Thfloor ?? this.area4Thfloor, + totalFloorArea: totalFloorArea ?? this.totalFloorArea, + floorSketch: floorSketch ?? this.floorSketch, + actualUse: actualUse ?? this.actualUse, + unitValue: unitValue ?? this.unitValue, + genCode: genCode ?? this.genCode, + ); } factory GeneralDesc.fromJson(Map json) => GeneralDesc( @@ -142,7 +149,8 @@ class GeneralDesc { totalFloorArea: json["total_floor_area"], floorSketch: json["floor_sketch"], actualUse: json["actual_use"], - unitValue: json["unit_value"]); + unitValue: json["unit_value"], + genCode: json["gen_code"]); factory GeneralDesc.fromJson2(Map json) => GeneralDesc( id: json["id"], @@ -169,7 +177,8 @@ class GeneralDesc { totalFloorArea: json["totalFloorArea"], floorSketch: json["floorSketch"], actualUse: json["actualUse"], - unitValue: json["unitValue"]); + unitValue: json["unitValue"], + genCode: json["gen_code"]); Map toJson() => { "id": id, @@ -196,6 +205,7 @@ class GeneralDesc { "total_floor_area": totalFloorArea, "floor_sketch": floorSketch, "actual_use": actualUse, - "unit_value": unitValue + "unit_value": unitValue, + "gen_code": genCode, }; } diff --git a/lib/model/passo/land_ext.dart b/lib/model/passo/land_ext.dart index a4302f1..63ad8a3 100644 --- a/lib/model/passo/land_ext.dart +++ b/lib/model/passo/land_ext.dart @@ -30,6 +30,9 @@ class LandExt { final String? dateReceived; final String? entryDateAssessment; final String? entryDateBy; + final String? appraisedbyDesignation; + final String? recommendapprDesignation; + final String? approvedbyDesignation; LandExt({ this.id, @@ -53,6 +56,9 @@ class LandExt { this.dateReceived, this.entryDateAssessment, this.entryDateBy, + this.appraisedbyDesignation, + this.recommendapprDesignation, + this.approvedbyDesignation, }); LandExt copy({ @@ -77,6 +83,9 @@ class LandExt { final String? dateReceived, final String? entryDateAssessment, final String? entryDateBy, + final String? appraisedbyDesignation, + final String? recommendapprDesignation, + final String? approvedbyDesignation, }) { return LandExt( id: id ?? this.id, @@ -100,6 +109,12 @@ class LandExt { dateReceived: dateReceived ?? this.dateReceived, entryDateAssessment: entryDateAssessment ?? this.entryDateAssessment, entryDateBy: entryDateBy ?? this.entryDateBy, + appraisedbyDesignation: + appraisedbyDesignation ?? this.appraisedbyDesignation, + recommendapprDesignation: + recommendapprDesignation ?? this.recommendapprDesignation, + approvedbyDesignation: + approvedbyDesignation ?? this.approvedbyDesignation, ); } @@ -125,6 +140,9 @@ class LandExt { dateReceived: json["date_received"], entryDateAssessment: json["entry_date_assessment"], entryDateBy: json["entry_date_by"], + appraisedbyDesignation: json["appraisedby_designation"], + recommendapprDesignation: json["recommendappr_designation"], + approvedbyDesignation: json["approvedby_designation"], ); factory LandExt.fromJson2(Map json) => LandExt( @@ -149,6 +167,9 @@ class LandExt { dateReceived: json["dateReceived"], entryDateAssessment: json["entryDateAssessment"], entryDateBy: json["entryDateBy"], + appraisedbyDesignation: json["appraisedby_designation"], + recommendapprDesignation: json["recommendappr_designation"], + approvedbyDesignation: json["approvedby_designation"], ); Map toJson() => { @@ -173,5 +194,8 @@ class LandExt { "date_received": dateReceived, "entry_date_assessment": entryDateAssessment, "entry_date_by": entryDateBy, + "appraisedby_designation": appraisedbyDesignation, + "recommendappr_designation": recommendapprDesignation, + "approvedby_designation": approvedbyDesignation, }; } diff --git a/lib/model/passo/land_ref.dart b/lib/model/passo/land_ref.dart index f851337..72ff44e 100644 --- a/lib/model/passo/land_ref.dart +++ b/lib/model/passo/land_ref.dart @@ -13,8 +13,8 @@ class LandRef { final int? bldgapprDetailsId; final String? assessedById; final String? assessedByName; - final DateTime? dateCreated; - final DateTime? dateModified; + final String? dateCreated; + final String? dateModified; final dynamic owner; final dynamic cloaNo; final dynamic lotNo; @@ -22,6 +22,7 @@ class LandRef { final dynamic area; final dynamic surveyNo; final dynamic blkNo; + final String? genCode; LandRef({ this.id, @@ -37,6 +38,7 @@ class LandRef { this.area, this.surveyNo, this.blkNo, + this.genCode, }); LandRef copy({ @@ -44,8 +46,8 @@ class LandRef { int? bldgapprDetailsId, String? assessedById, String? assessedByName, - DateTime? dateCreated, - DateTime? dateModified, + String? dateCreated, + String? dateModified, String? owner, String? cloaNo, String? lotNo, @@ -53,6 +55,7 @@ class LandRef { String? area, String? surveyNo, String? blkNo, + String? genCode, }) { return LandRef( id: id ?? this.id, @@ -68,40 +71,32 @@ class LandRef { area: area ?? this.area, surveyNo: surveyNo ?? this.surveyNo, blkNo: blkNo ?? this.blkNo, + genCode: genCode ?? this.genCode, ); } factory LandRef.fromJson(Map json) => LandRef( - id: json["id"], - bldgapprDetailsId: json["bldgappr_details_id"], - assessedById: json["assessed_by_id"], - assessedByName: json["assessed_by_name"], - dateCreated: json["date_created"] == null - ? null - : DateTime.parse(json["date_created"]), - dateModified: json["date_modified"] == null - ? null - : DateTime.parse(json["date_modified"]), - owner: json["owner"], - cloaNo: json["cloa_no"], - lotNo: json["lot_no"], - tdn: json["tdn"], - area: json["area"], - surveyNo: json["survey_no"], - blkNo: json["blk_no"], - ); + id: json["id"], + bldgapprDetailsId: json["bldgappr_details_id"], + assessedById: json["assessed_by_id"], + assessedByName: json["assessed_by_name"], + dateCreated: json["date_created"], + 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"], + genCode: json["gen_code"]); factory LandRef.fromJson2(Map json) => LandRef( id: json["id"], bldgapprDetailsId: json["bldgapprDetailsId"], assessedById: json["assessedById"], assessedByName: json["assessedByName"], - dateCreated: json["dateCreated"] == null - ? null - : DateTime.parse(json["dateCreated"]), - dateModified: json["dateModified"] == null - ? null - : DateTime.parse(json["dateModified"]), + dateCreated: json["dateCreated"], + dateModified: json["dateModified"], owner: json["owner"], cloaNo: json["cloaNo"], lotNo: json["lotNo"], @@ -109,6 +104,7 @@ class LandRef { area: json["area"], surveyNo: json["surveyNo"], blkNo: json["blkNo"], + genCode: json["gen_code"], ); Map toJson() => { @@ -116,8 +112,8 @@ class LandRef { "bldgappr_details_id": bldgapprDetailsId, "assessed_by_id": assessedById, "assessed_by_name": assessedByName, - "date_created": dateCreated?.toIso8601String(), - "date_modified": dateModified?.toIso8601String(), + "date_created": dateCreated, + "date_modified": dateModified, "owner": owner, "cloa_no": cloaNo, "lot_no": lotNo, @@ -125,5 +121,6 @@ class LandRef { "area": area, "survey_no": surveyNo, "blk_no": blkNo, + "gen_code": genCode, }; } diff --git a/lib/model/passo/memoranda.dart b/lib/model/passo/memoranda.dart index 273cd35..bd6a676 100644 --- a/lib/model/passo/memoranda.dart +++ b/lib/model/passo/memoranda.dart @@ -12,39 +12,44 @@ class Memoranda { final int? id; final String? code; final String? memoranda; + final String? genCode; Memoranda({ this.id, this.code, this.memoranda, + this.genCode, }); Memoranda copy({ int? id, String? code, String? memoranda, + String? genCode, }) { return Memoranda( id: id ?? this.id, code: code ?? this.code, - memoranda: memoranda ?? this.memoranda); + memoranda: memoranda ?? this.memoranda, + genCode: genCode ?? this.genCode); } factory Memoranda.fromJson(Map json) => Memoranda( - id: json["id"], - code: json["code"], - memoranda: json["memoranda"], - ); + id: json["id"], + code: json["code"], + memoranda: json["memoranda"], + genCode: json["gen_code"]); factory Memoranda.fromJson2(Map json) => Memoranda( - id: json["id"], - code: json["code"], - memoranda: json["memoranda"], - ); + id: json["id"], + code: json["code"], + memoranda: json["memoranda"], + genCode: json["genCode"]); Map toJson() => { "id": id, "code": code, "memoranda": memoranda, + "gen_code": genCode, }; } diff --git a/lib/model/passo/property_assessment.dart b/lib/model/passo/property_assessment.dart index d1f525c..9ee1bd2 100644 --- a/lib/model/passo/property_assessment.dart +++ b/lib/model/passo/property_assessment.dart @@ -14,6 +14,10 @@ String propertyAssessmentToJson(PropertyAssessment data) => class PropertyAssessment { final int id; final int bldgapprDetailsId; + final String? assessedById; + final String? assessedByName; + final String? dateCreated; + final String? dateModified; final String actualUse; final String marketValue; final String assessmentLevel; @@ -32,10 +36,19 @@ class PropertyAssessment { final String dateReceived; final String entryDateAssessment; final String entryDateBy; + final String genCode; + final String note; + final String? appraisedbyDesignation; + final String? recommendapprDesignation; + final String? approvedbyDesignation; PropertyAssessment({ required this.id, required this.bldgapprDetailsId, + required this.assessedById, + required this.assessedByName, + required this.dateCreated, + required this.dateModified, required this.actualUse, required this.marketValue, required this.assessmentLevel, @@ -54,11 +67,21 @@ class PropertyAssessment { required this.dateReceived, required this.entryDateAssessment, required this.entryDateBy, + required this.genCode, + required this.note, + required this.appraisedbyDesignation, + required this.recommendapprDesignation, + required this.approvedbyDesignation, }); PropertyAssessment copy({ int? id, int? bldgapprDetailsId, + String? ass, + String? assessedById, + String? assessedByName, + String? dateCreated, + String? dateModified, String? actualUse, String? marketValue, String? assessmentLevel, @@ -77,10 +100,19 @@ class PropertyAssessment { String? dateReceived, String? entryDateAssessment, String? entryDateBy, + String? genCode, + String? note, + String? appraisedbyDesignation, + String? recommendapprDesignation, + String? approvedbyDesignation, }) => PropertyAssessment( id: id ?? this.id, bldgapprDetailsId: bldgapprDetailsId ?? this.bldgapprDetailsId, + assessedById: assessedById ?? this.assessedById, + assessedByName: assessedByName ?? this.assessedByName, + dateCreated: dateCreated ?? this.dateCreated, + dateModified: dateModified ?? this.dateModified, actualUse: actualUse ?? this.actualUse, marketValue: marketValue ?? this.marketValue, assessmentLevel: assessmentLevel ?? this.assessmentLevel, @@ -99,12 +131,24 @@ class PropertyAssessment { dateReceived: dateReceived ?? this.dateReceived, entryDateAssessment: entryDateAssessment ?? this.entryDateAssessment, entryDateBy: entryDateBy ?? this.entryDateBy, + genCode: genCode ?? this.genCode, + note: note ?? this.note, + appraisedbyDesignation: + appraisedbyDesignation ?? this.appraisedbyDesignation, + recommendapprDesignation: + recommendapprDesignation ?? this.recommendapprDesignation, + approvedbyDesignation: + approvedbyDesignation ?? this.approvedbyDesignation, ); factory PropertyAssessment.fromJson(Map json) => PropertyAssessment( id: json["id"], bldgapprDetailsId: json["bldgappr_details_id"], + assessedById: json["assessed_by_id"], + assessedByName: json["assessed_by_name"], + dateCreated: json["date_created"], + dateModified: json["date_modified"], actualUse: json["actual_use"], marketValue: json["market_value"], assessmentLevel: json["assessment_level"], @@ -123,12 +167,21 @@ class PropertyAssessment { dateReceived: json["date_received"], entryDateAssessment: json["entry_date_assessment"], entryDateBy: json["entry_date_by"], + genCode: json["gen_code"], + note: json["note"], + appraisedbyDesignation: json["appraisedby_designation"], + recommendapprDesignation: json["recommendappr_designation"], + approvedbyDesignation: json["approvedby_designation"], ); factory PropertyAssessment.fromJson2(Map json) => PropertyAssessment( id: json["id"], bldgapprDetailsId: json["bldgapprDetailsId"], + assessedById: json["assessedById"], + assessedByName: json["assessedByName"], + dateCreated: json["dateCreated"], + dateModified: json["dateModified"], actualUse: json["actualUse"], marketValue: json["marketValue"], assessmentLevel: json["assessmentLevel"], @@ -147,11 +200,20 @@ class PropertyAssessment { dateReceived: json["dateReceived"], entryDateAssessment: json["entryDateAssessment"], entryDateBy: json["entryDateBy"], + genCode: json["gen_code"], + note: json["note"], + appraisedbyDesignation: json["appraisedby_designation"], + recommendapprDesignation: json["recommendappr_designation"], + approvedbyDesignation: json["approvedby_designation"], ); Map toJson() => { "id": id, "bldgappr_details_id": bldgapprDetailsId, + "assessed_by_id": assessedById, + "assessed_by_name": assessedByName, + "date_created": dateCreated, + "date_modified": dateModified, "actual_use": actualUse, "market_value": marketValue, "assessment_level": assessmentLevel, @@ -169,5 +231,10 @@ class PropertyAssessment { "swornstatement_no": swornstatementNo, "date_received": dateReceived, "entry_date_by": entryDateBy, + "gen_code": genCode, + "note": note, + "appraisedby_designation": appraisedbyDesignation, + "recommendappr_designation": recommendapprDesignation, + "approvedby_designation": approvedbyDesignation, }; } diff --git a/lib/model/passo/property_info.dart b/lib/model/passo/property_info.dart index 29de6b3..0bfc470 100644 --- a/lib/model/passo/property_info.dart +++ b/lib/model/passo/property_info.dart @@ -18,7 +18,10 @@ class PropertyInfo { final String? transCode; final String? tdn; final String? pin; - final String? owner; + final String? fname; + final String? mname; + final String? lname; + final String? bday; final String? address; final String? telno; final String? tin; @@ -27,6 +30,7 @@ class PropertyInfo { final String? adminTelno; final String? adminTin; final String? faasType; + final String? genCode; PropertyInfo({ this.id, @@ -37,7 +41,10 @@ class PropertyInfo { this.transCode, this.tdn, this.pin, - this.owner, + this.fname, + this.mname, + this.lname, + this.bday, this.address, this.telno, this.tin, @@ -46,6 +53,7 @@ class PropertyInfo { this.adminTelno, this.adminTin, this.faasType, + this.genCode, }); PropertyInfo copy({ @@ -66,6 +74,7 @@ class PropertyInfo { String? adminTelno, String? adminTin, String? faasType, + String? genCode, }) => PropertyInfo( id: id ?? this.id, @@ -76,7 +85,10 @@ class PropertyInfo { transCode: transCode ?? this.transCode, tdn: tdn ?? this.tdn, pin: pin ?? this.pin, - owner: owner ?? this.owner, + fname: fname ?? this.fname, + mname: mname ?? this.mname, + lname: lname ?? this.lname, + bday: bday ?? this.bday, address: address ?? this.address, telno: telno ?? this.telno, tin: tin ?? this.tin, @@ -85,6 +97,7 @@ class PropertyInfo { adminTelno: adminTelno ?? this.adminTelno, adminTin: adminTin ?? this.adminTin, faasType: faasType ?? this.faasType, + genCode: genCode ?? this.genCode, ); factory PropertyInfo.fromJson(Map json) => PropertyInfo( @@ -100,7 +113,10 @@ class PropertyInfo { transCode: json["trans_code"], tdn: json["tdn"], pin: json["pin"], - owner: json["owner"], + fname: json["fname"], + mname: json["mname"], + lname: json["lname"], + bday: json["bday"], address: json["address"], telno: json["telno"], tin: json["tin"], @@ -109,6 +125,7 @@ class PropertyInfo { adminTelno: json["admin_telno"], adminTin: json["admin_tin"], faasType: json["faas_type"], + genCode: json["gen_code"], ); factory PropertyInfo.fromJson2(Map json) => PropertyInfo( @@ -124,8 +141,12 @@ class PropertyInfo { transCode: json["transCode"], tdn: json["tdn"], pin: json["pin"], - owner: json["owner"], + fname: json["fname"], + mname: json["mname"], + lname: json["lname"], + bday: json["bday"], address: json["address"], + telno: json["telno"], tin: json["tin"], adminUser: json["adminUser"], @@ -133,27 +154,31 @@ class PropertyInfo { adminTelno: json["adminTelno"], adminTin: json["adminTin"], faasType: json["faasType"], + genCode: json["genCode"], ); factory PropertyInfo.fromMap(Map map) => PropertyInfo( - id: map["id"], - assessedById: map["assessedById"], - assessedByName: map["assessedByName"], - dateCreated: map["dateCreated"], - dateModified: map["dateModified"], - transCode: map["transCode"], - tdn: map["tdn"], - pin: map["pin"], - owner: map["owner"], - address: map["address"], - telno: map["telno"], - tin: map["tin"], - adminUser: map["adminUser"], - adminAddress: map["adminUser"], - adminTelno: map["adminTelno"], - adminTin: map["adminTin"], - faasType: map["faasType"], - ); + id: map["id"], + assessedById: map["assessedById"], + assessedByName: map["assessedByName"], + dateCreated: map["dateCreated"], + dateModified: map["dateModified"], + transCode: map["transCode"], + tdn: map["tdn"], + pin: map["pin"], + fname: map["fname"], + mname: map["mname"], + lname: map["lname"], + bday: map["bday"], + address: map["address"], + telno: map["telno"], + tin: map["tin"], + adminUser: map["adminUser"], + adminAddress: map["adminUser"], + adminTelno: map["adminTelno"], + adminTin: map["adminTin"], + faasType: map["faasType"], + genCode: map["genCode"]); Map toJson() => { "id": id, @@ -164,7 +189,10 @@ class PropertyInfo { "trans_code": transCode, "tdn": tdn, "pin": pin, - "owner": owner, + "fname": fname, + "mname": mname, + "lname": lname, + "bday": bday, "address": address, "telno": telno, "tin": tin, @@ -173,5 +201,6 @@ class PropertyInfo { "admin_telno": adminTelno, "admin_tin": adminTin, "faas_type": faasType, + "gen_code": genCode, }; } diff --git a/lib/model/passo/signatories.dart b/lib/model/passo/signatories.dart index be09b44..cc7c79a 100644 --- a/lib/model/passo/signatories.dart +++ b/lib/model/passo/signatories.dart @@ -15,6 +15,9 @@ class Signatories { final String firstname; final String middlename; final String lastname; + final String designation; + // final String status; + // final String genCode; Signatories({ this.id, @@ -22,20 +25,31 @@ class Signatories { required this.firstname, required this.middlename, required this.lastname, + required this.designation, + // required this.status + // required this.genCode, }); - Signatories copy( - {int? id, - int? signatoryId, - String? firstname, - String? middlename, - String? lastname}) { + Signatories copy({ + int? id, + int? signatoryId, + String? firstname, + String? middlename, + String? lastname, + String? designation, + // String? status + // String? genCode + }) { return Signatories( - id: id ?? this.id, - signatoryId: signatoryId ?? this.signatoryId, - firstname: firstname ?? this.firstname, - middlename: middlename ?? this.middlename, - lastname: lastname ?? this.lastname); + id: id ?? this.id, + signatoryId: signatoryId ?? this.signatoryId, + firstname: firstname ?? this.firstname, + middlename: middlename ?? this.middlename, + lastname: lastname ?? this.lastname, + designation: designation ?? this.designation, + // status: status ?? this.status + // genCode: genCode ?? this.genCode + ); } factory Signatories.fromJson(Map json) => Signatories( @@ -44,6 +58,9 @@ class Signatories { firstname: json["firstname"], middlename: json["middlename"], lastname: json["lastname"], + designation: json["designation"], + // status: json["status"] + // genCode: json["gen_code"], ); factory Signatories.fromJson2(Map json) => Signatories( @@ -52,6 +69,9 @@ class Signatories { firstname: json["firstname"], middlename: json["middlename"], lastname: json["lastname"], + designation: json["designation"], + // status: json["status"] + // genCode: json["gen_code"], ); Map toJson() => { @@ -60,5 +80,8 @@ class Signatories { "firstname": firstname, "middlename": middlename, "lastname": lastname, + "designation": designation, + // "status": status + // "gen_code": genCode }; } diff --git a/lib/model/passo/structural_materials_ii.dart b/lib/model/passo/structural_materials_ii.dart index d73f283..df3f27e 100644 --- a/lib/model/passo/structural_materials_ii.dart +++ b/lib/model/passo/structural_materials_ii.dart @@ -22,6 +22,11 @@ class StructureMaterialsII { final List? flooring; final List? walls; final List? others; + final String? genCode; + final String? assessedById; + final String? assessedByName; + final String? dateCreated; + final String? dateModified; StructureMaterialsII( {this.id, @@ -33,7 +38,12 @@ class StructureMaterialsII { this.roof, this.flooring, this.walls, - this.others}); + this.others, + this.genCode, + this.assessedById, + this.assessedByName, + this.dateCreated, + this.dateModified}); factory StructureMaterialsII.fromJson(Map json) => StructureMaterialsII( @@ -47,6 +57,11 @@ class StructureMaterialsII { flooring: List.from(json["flooring"].map((x) => x)), walls: List.from(json["walls"].map((x) => x)), others: List.from(json["others"].map((x) => x)), + genCode: json["gen_code"], + assessedById: json["assessed_by_id"], + assessedByName: json["assessed_by_name"], + dateCreated: json["date_created"], + dateModified: json["date_modified"], ); factory StructureMaterialsII.fromJson2(Map json) => @@ -61,30 +76,47 @@ class StructureMaterialsII { flooring: List.from(json["flooring"].map((x) => x)), walls: List.from(json["walls"].map((x) => x)), others: List.from(json["others"].map((x) => x)), + genCode: json["genCode"], + assessedById: json["assessedById"], + assessedByName: json["assessedByName"], + dateCreated: json["dateCreated"], + dateModified: json["dateModified"], ); - StructureMaterialsII copy( - {int? id, - int? bldgapprDetailsId, - List? foundation, - List? columns, - List? beams, - List? trussFraming, - List? roof, - List? flooring, - List? walls, - List? others}) => + StructureMaterialsII copy({ + int? id, + int? bldgapprDetailsId, + List? foundation, + List? columns, + List? beams, + List? trussFraming, + List? roof, + List? flooring, + List? walls, + List? others, + String? genCode, + String? assessedById, + String? assessedByName, + String? dateCreated, + String? dateModified, + }) => StructureMaterialsII( - id: id ?? this.id, - bldgapprDetailsId: bldgapprDetailsId ?? this.bldgapprDetailsId, - foundation: foundation ?? this.foundation, - columns: columns ?? this.columns, - beams: beams ?? this.beams, - trussFraming: trussFraming ?? this.trussFraming, - roof: roof ?? this.roof, - flooring: flooring ?? this.flooring, - walls: walls ?? this.walls, - others: others ?? this.others); + id: id ?? this.id, + bldgapprDetailsId: bldgapprDetailsId ?? this.bldgapprDetailsId, + foundation: foundation ?? this.foundation, + columns: columns ?? this.columns, + beams: beams ?? this.beams, + trussFraming: trussFraming ?? this.trussFraming, + roof: roof ?? this.roof, + flooring: flooring ?? this.flooring, + walls: walls ?? this.walls, + others: others ?? this.others, + genCode: genCode ?? this.genCode, + assessedById: assessedById ?? this.assessedById, + assessedByName: assessedByName ?? this.assessedByName, + dateCreated: dateCreated ?? this.dateCreated, + dateModified: dateModified ?? this.dateModified, + ); Map toJson() => { "id": id, @@ -97,5 +129,10 @@ class StructureMaterialsII { "flooring": List.from(flooring!.map((x) => x)), "walls": List.from(walls!.map((x) => x)), "others": List.from(others!.map((x) => x)), + "gen_code": genCode, + "assessed_by_id": assessedById, + "assessed_by_name": assessedByName, + "date_created": dateCreated, + "date_modified": dateModified, }; } diff --git a/lib/model/passo/structureMaterial.dart b/lib/model/passo/structureMaterial.dart index efed05c..b8d7e74 100644 --- a/lib/model/passo/structureMaterial.dart +++ b/lib/model/passo/structureMaterial.dart @@ -22,6 +22,7 @@ class StructureMaterials { final String? flooring; final String? walls; final String? others; + final String? genCode; StructureMaterials( {this.id, @@ -33,7 +34,8 @@ class StructureMaterials { this.roof, this.flooring, this.walls, - this.others}); + this.others, + this.genCode}); StructureMaterials copy( {int? id, @@ -45,7 +47,8 @@ class StructureMaterials { String? roof, String? flooring, String? walls, - String? others}) => + String? others, + String? genCode}) => StructureMaterials( id: id ?? this.id, bldgapprDetailsId: bldgapprDetailsId ?? this.bldgapprDetailsId, @@ -56,7 +59,8 @@ class StructureMaterials { roof: roof ?? this.roof, flooring: flooring ?? this.flooring, walls: walls ?? this.walls, - others: others ?? this.others); + others: others ?? this.others, + genCode: genCode ?? this.genCode); factory StructureMaterials.fromJson(Map json) => StructureMaterials( @@ -69,7 +73,8 @@ class StructureMaterials { roof: json["roof"], flooring: json["flooring"], walls: json["walls"], - others: json["others"]); + others: json["others"], + genCode: json["gen_code"]); factory StructureMaterials.fromJson2(Map json) => StructureMaterials( @@ -82,7 +87,8 @@ class StructureMaterials { roof: json["roof"], flooring: json["flooring"], walls: json["walls"], - others: json["others"]); + others: json["others"], + genCode: json["gen_code"]); Map toJson() => { "id": id, @@ -94,6 +100,7 @@ class StructureMaterials { "roof": roof, "flooring": flooring, "walls": walls, - "others": others + "others": others, + "gen_code": genCode, }; } diff --git a/lib/model/passo/unit_construct.dart b/lib/model/passo/unit_construct.dart index bb88027..ff3fa45 100644 --- a/lib/model/passo/unit_construct.dart +++ b/lib/model/passo/unit_construct.dart @@ -14,12 +14,14 @@ class UnitConstruct { final String bldgType; final String building; final String unitValue; + final String genCode; UnitConstruct({ required this.id, required this.bldgType, required this.building, required this.unitValue, + required this.genCode, }); UnitConstruct copy({ @@ -27,12 +29,15 @@ class UnitConstruct { String? bldgType, String? building, String? unitValue, + String? genCode, }) { return UnitConstruct( - id: id ?? this.id, - bldgType: bldgType ?? this.bldgType, - building: building ?? this.building, - unitValue: unitValue ?? this.unitValue); + id: id ?? this.id, + bldgType: bldgType ?? this.bldgType, + building: building ?? this.building, + unitValue: unitValue ?? this.unitValue, + genCode: genCode ?? this.genCode, + ); } factory UnitConstruct.fromJson2(Map json) => UnitConstruct( @@ -40,6 +45,7 @@ class UnitConstruct { bldgType: json["bldgType"], building: json["building"], unitValue: json["unitValue"], + genCode: json["gen_code"], ); factory UnitConstruct.fromJson(Map json) => UnitConstruct( @@ -47,6 +53,7 @@ class UnitConstruct { bldgType: json["bldg_type"], building: json["building"], unitValue: json["unit_value"], + genCode: json["gen_code"], ); Map toJson() => { @@ -54,5 +61,6 @@ class UnitConstruct { "bldg_type": bldgType, "building": building, "unit_value": unitValue, + "gen_code": genCode, }; } diff --git a/lib/screens/offline/homepage/module_screen.dart b/lib/screens/offline/homepage/module_screen.dart index 8fbca6c..ef555c9 100644 --- a/lib/screens/offline/homepage/module_screen.dart +++ b/lib/screens/offline/homepage/module_screen.dart @@ -7,7 +7,6 @@ import 'package:fluttericon/font_awesome5_icons.dart'; import 'package:unit2/bloc/offline/offline_bloc/offline_bloc.dart'; import 'package:unit2/model/offline/offlane_modules.dart'; import 'package:unit2/screens/offline/passo/passo_offline_dashboard.dart'; -import 'package:unit2/screens/passo/passo_dashboard.dart'; import 'package:unit2/screens/unit2/homepage.dart/components/dashboard/shared_card_label.dart'; import 'package:unit2/theme-data.dart/colors.dart'; diff --git a/lib/screens/offline/passo/admin/class_components.dart b/lib/screens/offline/passo/admin/class_components.dart index 8a3b127..aee55b9 100644 --- a/lib/screens/offline/passo/admin/class_components.dart +++ b/lib/screens/offline/passo/admin/class_components.dart @@ -1,3 +1,5 @@ +import 'dart:convert'; + import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:unit2/bloc/offline/offline_passo/admin/class_components_admin.dart/class_components_admin_bloc.dart'; @@ -7,9 +9,10 @@ import 'package:unit2/model/passo/class_components.dart'; import 'package:unit2/sevices/offline/offline_passo/admin/api_services/class_components_api_services.dart'; import 'package:unit2/sevices/offline/offline_passo/admin/api_services/municipalities_api_services.dart'; import 'package:unit2/theme-data.dart/colors.dart'; - +import 'package:http/http.dart'; import '../../../../model/passo/city.dart'; import '../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart'; +import '../../../../utils/urls.dart'; class ClassComponentsAdminPage extends StatefulWidget { const ClassComponentsAdminPage(); @@ -34,35 +37,43 @@ class _ClassComponentsAdminPage extends State { ), onPressed: () async { try { - final result = - await ClassComponentAdminApiServices.instance.fetch(); + Response response = await get(Uri.parse( + 'http://${Url.instance.host()}/api/rptass_app/class_components/')); + + print(response.body); + if (response.statusCode == 200) { + final List result = jsonDecode(response.body)['data']; + + result.map(((e) => ClassComponents.fromJson(e))).toList(); + + final classes = result + .map((json) => ClassComponents.fromJson(json)) + .toList(); + + // Loop through the list of City objects and insert them into the local database. + for (ClassComponents classs in classes) { + await SQLServices.instance.createClassComponents( + ClassComponentsOffline( + componentName: classs.componentName, + minBaseUnitvalPercent: classs.minBaseUnitvalPercent, + maxBaseUnitvalPercent: classs.maxBaseUnitvalPercent, + minUnitvalSqrmtr: classs.minUnitvalSqrmtr, + maxUnitvalSqrmtr: classs.maxUnitvalSqrmtr, + minAddBaseunitval: classs.minAddBaseunitval, + maxAddBaseunitval: classs.maxAddBaseunitval, + minDeductBaserate: classs.minAddBaseunitval, + maxDeductBaserate: classs.maxDeductBaserate, + minLinearMeter: classs.minLinearMeter, + maxLinearMeter: classs.maxLinearMeter, + minSpacing: classs.minSpacing, + maxSpacing: classs.maxSpacing, + roughFinish: classs.roughFinish, + highFinish: classs.highFinish, + withoutBucc: classs.withoutBucc == true ? 1 : 0)); + } + } // Assuming result is a List of JSON objects, convert them to City objects. - final classes = result - .map((json) => ClassComponents.fromJson(json)) - .toList(); - - // Loop through the list of City objects and insert them into the local database. - for (ClassComponents classs in classes) { - await SQLServices.instance.createClassComponents( - ClassComponentsOffline( - componentName: classs.componentName, - minBaseUnitvalPercent: classs.minBaseUnitvalPercent, - maxBaseUnitvalPercent: classs.maxBaseUnitvalPercent, - minUnitvalSqrmtr: classs.minUnitvalSqrmtr, - maxUnitvalSqrmtr: classs.maxUnitvalSqrmtr, - minAddBaseunitval: classs.minAddBaseunitval, - maxAddBaseunitval: classs.maxAddBaseunitval, - minDeductBaserate: classs.minAddBaseunitval, - maxDeductBaserate: classs.maxDeductBaserate, - minLinearMeter: classs.minLinearMeter, - maxLinearMeter: classs.maxLinearMeter, - minSpacing: classs.minSpacing, - maxSpacing: classs.maxSpacing, - roughFinish: classs.roughFinish, - highFinish: classs.highFinish, - withoutBucc: classs.withoutBucc == true ? 1 : 0)); - } } catch (e) { // Handle any errors that might occur during the API call or database insertion. print("Error: $e"); diff --git a/lib/screens/offline/passo/admin/memoranda.dart b/lib/screens/offline/passo/admin/memoranda.dart index 428d523..d7955e3 100644 --- a/lib/screens/offline/passo/admin/memoranda.dart +++ b/lib/screens/offline/passo/admin/memoranda.dart @@ -1,3 +1,5 @@ +import 'dart:convert'; + import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:unit2/bloc/offline/offline_passo/admin/barangay_admin/barangay_admin_bloc.dart'; @@ -9,6 +11,8 @@ import 'package:unit2/sevices/offline/offline_passo/admin/api_services/memoranda import '../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart'; import '../../../../theme-data.dart/colors.dart'; +import '../../../../utils/urls.dart'; +import 'package:http/http.dart'; class MemorandaAdminPage extends StatefulWidget { const MemorandaAdminPage(); @@ -33,15 +37,27 @@ class _MemorandaAdminPage extends State { ), onPressed: () async { try { - final result = await MemorandaAdminApiServices.instance.fetch(); + // final result = await MemorandaAdminApiServices.instance.fetch(); - // Assuming result is a List of JSON objects, convert them to City objects. - final memos = - result.map((json) => Memoranda.fromJson(json)).toList(); + // // Assuming result is a List of JSON objects, convert them to City objects. + // final memos = + // result.map((json) => Memoranda.fromJson(json)).toList(); // Loop through the list of City objects and insert them into the local database. - for (Memoranda memo in memos) { - await SQLServices.instance.createMemoranda(memo); + Response response = await get(Uri.parse( + 'http://${Url.instance.host()}${Url.instance.getMemoranda()}')); + + print(response.body); + if (response.statusCode == 200) { + final List result = jsonDecode(response.body)['data']; + + result.map(((e) => Memoranda.fromJson(e))).toList(); + + final memos = + result.map((json) => Memoranda.fromJson(json)).toList(); + for (Memoranda memo in memos) { + await SQLServices.instance.createMemoranda(memo); + } } } catch (e) { // Handle any errors that might occur during the API call or database insertion. diff --git a/lib/screens/offline/passo/admin/signatories.dart b/lib/screens/offline/passo/admin/signatories.dart index afbe467..610e4cd 100644 --- a/lib/screens/offline/passo/admin/signatories.dart +++ b/lib/screens/offline/passo/admin/signatories.dart @@ -1,3 +1,5 @@ +import 'dart:convert'; + import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:unit2/bloc/offline/offline_passo/admin/barangay_admin/barangay_admin_bloc.dart'; @@ -9,6 +11,9 @@ import 'package:unit2/sevices/offline/offline_passo/admin/api_services/signatori import '../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart'; import '../../../../theme-data.dart/colors.dart'; +import 'package:http/http.dart'; + +import '../../../../utils/urls.dart'; class SignatoriesAdminPage extends StatefulWidget { const SignatoriesAdminPage(); @@ -33,16 +38,21 @@ class _SignatoriesAdminPage extends State { ), onPressed: () async { try { - final result = - await SignatoriesAdminApiServices.instance.fetch(); + Response response = await get(Uri.parse( + 'http://${Url.instance.host()}/api/rptass_app/signatories/')); - // Assuming result is a List of JSON objects, convert them to City objects. - final signatories = - result.map((json) => Signatories.fromJson(json)).toList(); + print(response.body); + if (response.statusCode == 200) { + final List result = jsonDecode(response.body)['data']; - // Loop through the list of City objects and insert them into the local database. - for (Signatories signatory in signatories) { - await SQLServices.instance.createSignatories(signatory); + result.map(((e) => Signatories.fromJson(e))).toList(); + + final signatories = + result.map((json) => Signatories.fromJson(json)).toList(); + // Loop through the list of City objects and insert them into the local database. + for (Signatories signatory in signatories) { + await SQLServices.instance.createSignatories(signatory); + } } } catch (e) { // Handle any errors that might occur during the API call or database insertion. @@ -83,6 +93,12 @@ class _SignatoriesAdminPage extends State { const DataColumn( label: Text('Last Name'), ), + const DataColumn( + label: Text('Designation'), + ), + // const DataColumn( + // label: Text('Status'), + // ), ], rows: state.signatories.map((dataRow) { return DataRow( @@ -93,6 +109,8 @@ class _SignatoriesAdminPage extends State { 'N/A')), // Use a default value if cityDescription is null DataCell(Text(dataRow.middlename ?? 'N/A')), DataCell(Text(dataRow.lastname ?? 'N/A')), + DataCell(Text(dataRow.designation ?? 'N/A')), + // DataCell(Text(dataRow.status ?? 'N/A')), ], ); }).toList(), diff --git a/lib/screens/offline/passo/admin/unit_construction.dart b/lib/screens/offline/passo/admin/unit_construction.dart index 2f86056..9ce7153 100644 --- a/lib/screens/offline/passo/admin/unit_construction.dart +++ b/lib/screens/offline/passo/admin/unit_construction.dart @@ -1,3 +1,5 @@ +import 'dart:convert'; + import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:unit2/bloc/offline/offline_passo/admin/barangay_admin/barangay_admin_bloc.dart'; @@ -9,6 +11,7 @@ import 'package:unit2/sevices/offline/offline_passo/admin/api_services/unit_cons import '../../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart'; import '../../../../theme-data.dart/colors.dart'; +import 'package:http/http.dart'; class UnitConstructionAdminPage extends StatefulWidget { const UnitConstructionAdminPage(); @@ -33,16 +36,30 @@ class _UnitConstructionAdminPage extends State { ), onPressed: () async { try { - final result = - await UnitConstructionAdminApiServices.instance.fetch(); + // final result = + // await UnitConstructionAdminApiServices.instance.fetch(); - // Assuming result is a List of JSON objects, convert them to City objects. - final units = - result.map((json) => UnitConstruct.fromJson(json)).toList(); + // // Assuming result is a List of JSON objects, convert them to City objects. + // final units = + // result.map((json) => UnitConstruct.fromJson(json)).toList(); // Loop through the list of City objects and insert them into the local database. - for (UnitConstruct unit in units) { - await SQLServices.instance.createUnitConstruction(unit); + Response response = await get(Uri.parse( + 'http://192.168.80.20:8000/api/rptass_app/unitconstruct_values/')); + + print(response.body); + if (response.statusCode == 200) { + final List result = jsonDecode(response.body)['data']; + + result.map(((e) => UnitConstruct.fromJson(e))).toList(); + + final units = result + .map((json) => UnitConstruct.fromJson(json)) + .toList(); + + for (UnitConstruct unit in units) { + await SQLServices.instance.createUnitConstruction(unit); + } } } catch (e) { // Handle any errors that might occur during the API call or database insertion. diff --git a/lib/screens/offline/passo/building/add/AddBuildingAndStructure..dart b/lib/screens/offline/passo/building/add/AddBuildingAndStructure..dart index fb2f391..9631926 100644 --- a/lib/screens/offline/passo/building/add/AddBuildingAndStructure..dart +++ b/lib/screens/offline/passo/building/add/AddBuildingAndStructure..dart @@ -84,275 +84,262 @@ class _AddBuildingAndStructureOffline formKey.currentState?.save(); }, autovalidateMode: AutovalidateMode.disabled, - child: Padding( - padding: const EdgeInsets.all(0.0), - child: Container( - height: 800, - child: SingleChildScrollView( - padding: const EdgeInsets.all(2.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: SizedBox( - height: 45, - child: SearchField( - itemHeight: 70, - suggestions: state.unit - .map((UnitConstruct unit) => - SearchFieldListItem( - '${unit.bldgType} - ${unit.building}', - item: unit, - child: ListTile( - title: Text( - '${unit.bldgType} - ${unit.building!.toUpperCase()}', - overflow: - TextOverflow.ellipsis, - ), - ))) - .toList(), + child: SingleChildScrollView( + padding: const EdgeInsets.all(2.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: SizedBox( + height: 45, + child: SearchField( + itemHeight: 70, + suggestions: state.unit + .map((UnitConstruct unit) => + SearchFieldListItem( + '${unit.bldgType} - ${unit.building}', + item: unit, + child: ListTile( + title: Text( + '${unit.bldgType} - ${unit.building!.toUpperCase()}', + overflow: TextOverflow.ellipsis, + ), + ))) + .toList(), - validator: FormBuilderValidators.required( - errorText: "This field is required"), + 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}'; + 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}'; - formKey.currentState!.patchValue( - {'unit_value': unit.item?.unitValue}); - }); - focus.unfocus(); - }, - ), - ), + formKey.currentState!.patchValue( + {'unit_value': unit.item?.unitValue}); + }); + focus.unfocus(); + }, ), - const SizedBox( - height: 10, - ), - customDropDownField( - "Actual Use", "", 'actual_use', actual_use), - const SizedBox( - height: 5, - ), - const SizedBox( - height: 10, - ), - Container( + ), + ), + const SizedBox( + height: 10, + ), + customDropDownField( + "Actual Use", "", 'actual_use', actual_use), + const SizedBox( + height: 5, + ), + const SizedBox( + height: 10, + ), + Container( + child: FormBuilderTextField( + name: 'unit_value', + decoration: normalTextFieldStyle("Unit Value", ""), + validator: FormBuilderValidators.compose([]), + onChanged: (value) { + // setState(() { + // _areaValue = int.parse(value!); + // }); + }, + ), + ), + SizedBox( + height: 10, + ), + Row( + children: [ + Expanded( child: FormBuilderTextField( - name: 'unit_value', - decoration: - normalTextFieldStyle("Unit Value", ""), + name: 'dep_rate', + decoration: normalTextFieldStyle( + "Depreciation Rate", ""), validator: FormBuilderValidators.compose([]), onChanged: (value) { - // setState(() { - // _areaValue = int.parse(value!); - // }); + setState(() { + _depRate = double.parse(value!); + }); }, ), ), - SizedBox( - height: 10, + const SizedBox( + width: 5, ), - Row( - children: [ - Expanded( - child: FormBuilderTextField( - name: 'dep_rate', - decoration: normalTextFieldStyle( - "Depreciation Rate", ""), - validator: - FormBuilderValidators.compose([]), - onChanged: (value) { - setState(() { - _depRate = double.parse(value!); - }); - }, - ), - ), - const SizedBox( - width: 5, - ), - Expanded( - child: FormBuilderTextField( - name: 'bldg_area', - decoration: - normalTextFieldStyle("Area", ""), - validator: - FormBuilderValidators.compose([]), - onChanged: (value) { - setState(() { - _areaValue = double.parse(value!); - }); - }, - ), - ), - ], - ), - const SizedBox(height: 10), - const Text('Market Value'), - const SizedBox(height: 5), - Container( - height: 45.0, - width: double.infinity, - decoration: BoxDecoration( - color: Colors.white, - border: Border.all( - color: Colors.grey, - width: 1.0, - ), - borderRadius: BorderRadius.circular(5.0), + Expanded( + child: FormBuilderTextField( + name: 'bldg_area', + decoration: normalTextFieldStyle("Area", ""), + validator: FormBuilderValidators.compose([]), + onChanged: (value) { + setState(() { + _areaValue = double.parse(value!); + }); + }, ), - child: Align( - alignment: Alignment.center, - child: Text(NumberFormat.currency( - locale: 'en-PH', symbol: "₱") - .format(_totalMarketValue( - _unitBase, _areaValue)))), ), - const SizedBox(height: 10), - const 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( - _unitBase, _areaValue, _depRate)))), - ), - const SizedBox(height: 10), - const Text('Adjusted 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(_adjustedMarketValue( - _unitBase, _areaValue, _depRate)))), - ), - const SizedBox(height: 10), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 120, - height: 60, - padding: const EdgeInsets.all(8.0), - child: ElevatedButton( - onPressed: () async { - try { - final tempID = await SharedPreferences - .getInstance(); - var bldgStructure = BldgAndStructure( - id: 1, - bldgapprDetailsId: tempID.getInt( - 'tempid')!, - assessedById: widget - .offlineProfile.id - .toString(), - assessedByName: widget - .offlineProfile.firstName, - dateCreated: formatter, - dateModified: 'none', - bldgType: _structureType, - strucType: _structureType, - description: 'None', - actualUse: formKey.currentState - ?.value['actual_use'], - floorCount: '1', - bldgArea: _areaValue.toString(), - unitValue: _unitBase.toString(), - depRate: _depRate.toString(), - marketValue: _totalMarketValue( - _unitBase, - _areaValue) - .toString(), - depAmount: _amountofDepreciation( - _unitBase, - _areaValue, - _depRate) - .toString(), - adjustedMarketValue: - _adjustedMarketValue(_unitBase, - _areaValue, _depRate) - .toString()); - context - .read() - .add(AddBuildingAndStructure( - bldgAndStructure: - bldgStructure)); - } catch (e) { - print(e); - } - }, - style: ElevatedButton.styleFrom( - primary: Colors.black, - ), - child: const Text("Submit"), - ), - ), - const SizedBox( - width: - 5), // Use SizedBox for horizontal spacing in a Row - Container( - width: 120, - height: 60, - padding: const EdgeInsets.all(8.0), - child: ElevatedButton( - onPressed: () { - context - .read() - .add( - const LoadBuildingAndStructure()); - }, - style: ElevatedButton.styleFrom( - primary: Colors.black, - ), - child: const Text("Cancel"), - ), - ), - ], - ) ], ), - ), + const SizedBox(height: 10), + const Text('Market Value'), + const SizedBox(height: 5), + Container( + height: 45.0, + width: double.infinity, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all( + color: Colors.grey, + width: 1.0, + ), + borderRadius: BorderRadius.circular(5.0), + ), + child: Align( + alignment: Alignment.center, + child: Text(NumberFormat.currency( + locale: 'en-PH', symbol: "₱") + .format(_totalMarketValue( + _unitBase, _areaValue)))), + ), + const SizedBox(height: 10), + const 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( + _unitBase, _areaValue, _depRate)))), + ), + const SizedBox(height: 10), + const Text('Adjusted 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(_adjustedMarketValue( + _unitBase, _areaValue, _depRate)))), + ), + const SizedBox(height: 10), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 120, + height: 60, + padding: const EdgeInsets.all(8.0), + child: ElevatedButton( + onPressed: () async { + try { + final tempID = + await SharedPreferences.getInstance(); + var bldgStructure = BldgAndStructure( + id: 1, + bldgapprDetailsId: tempID.getInt( + 'tempid')!, + // assessedById: widget + // .offlineProfile.id + // .toString(), + // assessedByName: widget + // .offlineProfile.firstName, + // dateCreated: formatter, + // dateModified: 'none', + bldgType: _structureType, + structType: _structureType, + description: 'None', + buccPercentage: '1', + actualUse: formKey.currentState?.value[ + 'actual_use'] ?? + "", + floorCount: '1', + bldgArea: _areaValue.toString(), + unitValue: _unitBase.toString(), + depRate: _depRate.toString(), + marketValue: _totalMarketValue( + _unitBase, _areaValue) + .toString(), + depAmount: _amountofDepreciation( + _unitBase, _areaValue, _depRate) + .toString(), + adjustedMarketValue: + _adjustedMarketValue(_unitBase, + _areaValue, _depRate) + .toString(), + genCode: "5TH"); + context + .read() + .add(AddBuildingAndStructure( + bldgAndStructure: bldgStructure)); + } catch (e) { + print(e); + } + }, + style: ElevatedButton.styleFrom( + primary: Colors.black, + ), + child: const Text("Submit"), + ), + ), + const SizedBox( + width: + 5), // Use SizedBox for horizontal spacing in a Row + Container( + width: 120, + height: 60, + padding: const EdgeInsets.all(8.0), + child: ElevatedButton( + onPressed: () { + context + .read() + .add(const LoadBuildingAndStructure()); + }, + style: ElevatedButton.styleFrom( + primary: Colors.black, + ), + child: const Text("Cancel"), + ), + ), + ], + ) + ], ), ), ); diff --git a/lib/screens/offline/passo/building/add/AddExtraItemsOffline.dart b/lib/screens/offline/passo/building/add/AddExtraItemsOffline.dart index 5373e01..51e39b6 100644 --- a/lib/screens/offline/passo/building/add/AddExtraItemsOffline.dart +++ b/lib/screens/offline/passo/building/add/AddExtraItemsOffline.dart @@ -103,623 +103,572 @@ class _AddExtraItemsOffline extends State { formKey.currentState?.save(); }, autovalidateMode: AutovalidateMode.disabled, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - height: 800, - child: SingleChildScrollView( - padding: const EdgeInsets.all(8.0), + child: SingleChildScrollView( + padding: const EdgeInsets.all(2.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: SizedBox( + height: 45, + width: 300, + child: FormBuilderDropdown( + name: 'extra_item', + autofocus: false, + decoration: normalTextFieldStyle( + "Additional Item", ""), + items: classes + .map((e) => DropdownMenuItem( + value: e, + child: Text(e.componentName!), + )) + .toList(), + onChanged: (value) { + if (value!.minBaseUnitvalPercent != + '0.00') { + setState(() { + _unitValue = double.parse( + value.minBaseUnitvalPercent!); + _className = value.componentName!; + _classId = value.id!; + _withoutBUCC = value.withoutBucc == 1 + ? true + : false; + }); + formKey.currentState!.patchValue({ + 'unitValue': + value.minBaseUnitvalPercent + }); + } + if (value.maxBaseUnitvalPercent != + '0.00') { + setState(() { + _unitValue = double.parse( + value.maxBaseUnitvalPercent!); + _className = value.componentName!; + _classId = value.id!; + _withoutBUCC = value.withoutBucc == 1 + ? true + : false; + }); + formKey.currentState!.patchValue({ + 'unitValue': + value.maxBaseUnitvalPercent + }); + } + if (value.minUnitvalSqrmtr != '0.00') { + setState(() { + _unitValue = double.parse( + value.minUnitvalSqrmtr!); + _className = value.componentName!; + _classId = value.id!; + _withoutBUCC = value.withoutBucc == 1 + ? true + : false; + }); + formKey.currentState!.patchValue({ + 'unitValue': value.minUnitvalSqrmtr + }); + } + if (value.maxUnitvalSqrmtr != '0.00') { + setState(() { + _unitValue = double.parse( + value.maxUnitvalSqrmtr!); + _className = value.componentName!; + _classId = value.id!; + _withoutBUCC = value.withoutBucc == 1 + ? true + : false; + }); + formKey.currentState!.patchValue({ + 'unitValue': value.maxUnitvalSqrmtr + }); + } + if (value.minAddBaseunitval != '0.00') { + setState(() { + _unitValue = double.parse( + value.minAddBaseunitval!); + _className = value.componentName!; + _classId = value.id!; + _withoutBUCC = value.withoutBucc == 1 + ? true + : false; + }); + formKey.currentState!.patchValue({ + 'unitValue': value.minAddBaseunitval + }); + } + if (value.maxAddBaseunitval != '0.00') { + setState(() { + _unitValue = double.parse( + value.maxAddBaseunitval!); + _className = value.componentName!; + _classId = value.id!; + _withoutBUCC = value.withoutBucc == 1 + ? true + : false; + }); + formKey.currentState!.patchValue({ + 'unitValue': value.maxAddBaseunitval + }); + } + if (value.minDeductBaserate != '0.00') { + setState(() { + _unitValue = double.parse( + value.minDeductBaserate!); + _className = value.componentName!; + _classId = value.id!; + _withoutBUCC = value.withoutBucc == 1 + ? true + : false; + }); + formKey.currentState!.patchValue({ + 'unitValue': value.minDeductBaserate + }); + } + if (value.maxDeductBaserate != '0.00') { + setState(() { + _unitValue = double.parse( + value.maxDeductBaserate!); + _className = value.componentName!; + _classId = value.id!; + _withoutBUCC = value.withoutBucc == 1 + ? true + : false; + }); + formKey.currentState!.patchValue({ + 'unitValue': value.maxDeductBaserate + }); + } + }, + ), + ), + ), + const SizedBox(height: 10), + Container( + margin: const EdgeInsets.only( + left: 0, top: 10, right: 0, bottom: 0), + child: SizedBox( + height: 45, + child: SearchField( + itemHeight: 70, + suggestions: state.unit + .map((UnitConstruct unit) => + SearchFieldListItem( + '${unit.bldgType} - ${unit.building}', + item: unit, + child: ListTile( + title: Text( + '${unit.bldgType} - ${unit.building!.toUpperCase()}', + overflow: + TextOverflow.ellipsis, + ), + ))) + .toList(), + + validator: FormBuilderValidators.required( + errorText: "This field is required"), + + searchInputDecoration: normalTextFieldStyle( + "Structure Type", "") + .copyWith( + suffixIcon: const Icon( + Icons.arrow_drop_down)), + ////agency suggestion tap + focusNode: focus, + suggestionState: Suggestion.expand, + onSuggestionTap: (unit) { + setState(() { + if (_withoutBUCC) { + _unitBase = double.parse( + unit.item!.unitValue); + _structureType = + '${unit.item!.bldgType} - ${unit.item!.building}'; + } else { + _unitBase = double.parse( + unit.item!.unitValue); + _structureType = + '${unit.item!.bldgType} - ${unit.item!.building}'; + formKey.currentState!.patchValue({ + 'unitValue': unit.item!.unitValue + }); + } + }); + 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 = double.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( - 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: classes - .map((e) => DropdownMenuItem( - value: e, - child: Text(e.componentName!), - )) - .toList(), - onChanged: (value) { - if (value!.minBaseUnitvalPercent != - '0.00') { - setState(() { - _unitValue = double.parse( - value.minBaseUnitvalPercent!); - _className = value.componentName!; - _classId = value.id!; - _withoutBUCC = - value.withoutBucc == 1 - ? true - : false; - }); - formKey.currentState!.patchValue({ - 'unitValue': - value.minBaseUnitvalPercent - }); - } - if (value.maxBaseUnitvalPercent != - '0.00') { - setState(() { - _unitValue = double.parse( - value.maxBaseUnitvalPercent!); - _className = value.componentName!; - _classId = value.id!; - _withoutBUCC = - value.withoutBucc == 1 - ? true - : false; - }); - formKey.currentState!.patchValue({ - 'unitValue': - value.maxBaseUnitvalPercent - }); - } - if (value.minUnitvalSqrmtr != - '0.00') { - setState(() { - _unitValue = double.parse( - value.minUnitvalSqrmtr!); - _className = value.componentName!; - _classId = value.id!; - _withoutBUCC = - value.withoutBucc == 1 - ? true - : false; - }); - formKey.currentState!.patchValue({ - 'unitValue': - value.minUnitvalSqrmtr - }); - } - if (value.maxUnitvalSqrmtr != - '0.00') { - setState(() { - _unitValue = double.parse( - value.maxUnitvalSqrmtr!); - _className = value.componentName!; - _classId = value.id!; - _withoutBUCC = - value.withoutBucc == 1 - ? true - : false; - }); - formKey.currentState!.patchValue({ - 'unitValue': - value.maxUnitvalSqrmtr - }); - } - if (value.minAddBaseunitval != - '0.00') { - setState(() { - _unitValue = double.parse( - value.minAddBaseunitval!); - _className = value.componentName!; - _classId = value.id!; - _withoutBUCC = - value.withoutBucc == 1 - ? true - : false; - }); - formKey.currentState!.patchValue({ - 'unitValue': - value.minAddBaseunitval - }); - } - if (value.maxAddBaseunitval != - '0.00') { - setState(() { - _unitValue = double.parse( - value.maxAddBaseunitval!); - _className = value.componentName!; - _classId = value.id!; - _withoutBUCC = - value.withoutBucc == 1 - ? true - : false; - }); - formKey.currentState!.patchValue({ - 'unitValue': - value.maxAddBaseunitval - }); - } - if (value.minDeductBaserate != - '0.00') { - setState(() { - _unitValue = double.parse( - value.minDeductBaserate!); - _className = value.componentName!; - _classId = value.id!; - _withoutBUCC = - value.withoutBucc == 1 - ? true - : false; - }); - formKey.currentState!.patchValue({ - 'unitValue': - value.minDeductBaserate - }); - } - if (value.maxDeductBaserate != - '0.00') { - setState(() { - _unitValue = double.parse( - value.maxDeductBaserate!); - _className = value.componentName!; - _classId = value.id!; - _withoutBUCC = - value.withoutBucc == 1 - ? true - : false; - }); - formKey.currentState!.patchValue({ - 'unitValue': - value.maxDeductBaserate - }); - } - }, - ), - ), + children: [ const SizedBox(height: 10), + const Text('Building is not painted?'), + const SizedBox(height: 5), Container( - margin: const EdgeInsets.only( - left: 0, - top: 10, - right: 0, - bottom: 0), - child: SizedBox( - height: 45, - child: SearchField( - itemHeight: 70, - suggestions: state.unit - .map((UnitConstruct unit) => - SearchFieldListItem( - '${unit.bldgType} - ${unit.building}', - item: unit, - child: ListTile( - title: Text( - '${unit.bldgType} - ${unit.building!.toUpperCase()}', - overflow: TextOverflow - .ellipsis, - ), - ))) - .toList(), - - validator: - FormBuilderValidators.required( - errorText: - "This field is required"), - - searchInputDecoration: - normalTextFieldStyle( - "Structure Type", "") - .copyWith( - suffixIcon: const Icon( - Icons - .arrow_drop_down)), - ////agency suggestion tap - focusNode: focus, - suggestionState: Suggestion.expand, - onSuggestionTap: (unit) { - setState(() { - if (_withoutBUCC) { - _unitBase = double.parse( - unit.item!.unitValue); - _structureType = - '${unit.item!.bldgType} - ${unit.item!.building}'; - } else { - _unitBase = double.parse( - unit.item!.unitValue); - _structureType = - '${unit.item!.bldgType} - ${unit.item!.building}'; - formKey.currentState! - .patchValue({ - 'unitValue': - unit.item!.unitValue - }); - } - }); - 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) { + child: Row( + children: [ + Checkbox( + value: isPainted, + onChanged: (bool? value) { setState(() { - _areaValue = - double.parse(value!); + isPainted = value!; + if (value == false) { + _notPaintedUnitVal = 0; + } else { + _notPaintedUnitVal = 10; + } }); }, ), - ), - ], - ), - // const SizedBox(height: 10), - // FormBuilderTextField( - // name: 'depRate', - // decoration: - // normalTextFieldStyle("Depreciation Rate", ""), - // validator: FormBuilderValidators.compose([]), - // onChanged: (value) { - // setState(() { - // _depValue = double.parse(value!); - // }); - // }, - // ), - // const SizedBox(height: 10), - // FormBuilderTextField( - // name: 'marketValue', - // decoration: normalTextFieldStyle( - // NumberFormat.currency( - // locale: 'en-PH', symbol: "₱") - // .format(_totalMarketValue(_unitValue, - // _unitBase, _areaValue, _depValue)), - // ""), - // validator: FormBuilderValidators.compose([]), - // onChanged: (value) { - // setState(() { - // _marketValue = double.parse(value!); - // }); - // }, - // ), - // const SizedBox(height: 10), - // Text('Amount of Depreciation'), - // const SizedBox(height: 5), - // Container( - // height: 45.0, - // width: double.infinity, - // decoration: BoxDecoration( - // color: Colors.white, - // border: Border.all( - // color: Colors.grey, - // width: 1.0, - // ), - // borderRadius: BorderRadius.circular(5.0), - // ), - // child: Align( - // alignment: Alignment.center, - // child: Text(NumberFormat.currency( - // locale: 'en-PH', symbol: "₱") - // .format(_amountofDepreciation(_unitValue, - // _unitBase, _areaValue, _depValue)))), - // ), - - Visibility( - visible: !_withoutBUCC, - child: Column( - children: [ - const SizedBox(height: 10), - const Text( - 'Building is not painted?'), - const SizedBox(height: 5), + const SizedBox(width: 10), Container( - child: Row( - children: [ - Checkbox( - value: isPainted, - onChanged: (bool? value) { - setState(() { - isPainted = value!; - if (value == false) { - _notPaintedUnitVal = 0; - } else { - _notPaintedUnitVal = 10; - } - }); - }, - ), - const SizedBox(width: 10), - Container( - height: 40.0, - width: 100, - decoration: BoxDecoration( - color: Colors.white, - border: Border.all( - color: Colors.grey, - width: 1.0, - ), - borderRadius: - BorderRadius.circular( - 5.0), - ), - child: Align( - alignment: - Alignment.center, - child: Text(' - ' + - _notPaintedUnitVal - .toString() + - '%')), - ), - ], - ), - ), - const SizedBox(height: 10), - const Text( - 'Uses second hand materials?'), - const SizedBox(height: 5), - Container( - child: Row( - children: [ - Checkbox( - value: isSecondHand, - onChanged: (bool? value) { - setState(() { - isSecondHand = value!; - if (isSecondHand == - false) { - _secondHandUnitVal = 0; - formKey.currentState! - .patchValue({ - 'secondHandMat': '0' - }); - } else { - _secondHandUnitVal = 5; - formKey.currentState! - .patchValue({ - 'secondHandMat': '5' - }); - } - }); - }, - ), - const SizedBox(width: 10), - Row( - children: [ - SizedBox( - height: 40, - width: 100, - child: - FormBuilderTextField( - enabled: isSecondHand, - name: 'secondHandMat', - textAlign: - TextAlign.center, - decoration: - normalTextFieldStyle( - "Unit Value", - ""), - validator: - FormBuilderValidators - .compose([]), - onChanged: (value) { - // Check if the value is not null before parsing to double - if (value != null && - value - .isNotEmpty) { - setState(() { - _secondHandUnitVal = - int.parse( - value); - }); - } else { - // Handle the case when the value is empty or null - // For example, set _secondHandUnitVal to a default value or show an error message. - } - }, - ), - ), - const SizedBox( - height: 40, - width: 40, - child: Center( - child: Text( - '%', - style: TextStyle( - fontSize: 18, - fontWeight: - FontWeight - .bold), - ), - ), - ) - ], - ), - ], + height: 40.0, + width: 100, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all( + color: Colors.grey, + width: 1.0, + ), + borderRadius: + BorderRadius.circular(5.0), ), + child: Align( + alignment: Alignment.center, + child: Text(' - ' + + _notPaintedUnitVal + .toString() + + '%')), ), ], ), ), - const SizedBox(height: 10), - const Text('Market Value'), + const Text('Uses second hand materials?'), 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: Row( + children: [ + Checkbox( + value: isSecondHand, + onChanged: (bool? value) { + setState(() { + isSecondHand = value!; + if (isSecondHand == false) { + _secondHandUnitVal = 0; + formKey.currentState! + .patchValue({ + 'secondHandMat': '0' + }); + } else { + _secondHandUnitVal = 5; + formKey.currentState! + .patchValue({ + 'secondHandMat': '5' + }); + } + }); + }, + ), + const SizedBox(width: 10), + Row( + children: [ + SizedBox( + height: 40, + width: 100, + child: FormBuilderTextField( + enabled: isSecondHand, + name: 'secondHandMat', + textAlign: TextAlign.center, + decoration: + normalTextFieldStyle( + "Unit Value", ""), + validator: + FormBuilderValidators + .compose([]), + onChanged: (value) { + // Check if the value is not null before parsing to double + if (value != null && + value.isNotEmpty) { + setState(() { + _secondHandUnitVal = + int.parse(value); + }); + } else { + // Handle the case when the value is empty or null + // For example, set _secondHandUnitVal to a default value or show an error message. + } + }, + ), + ), + const SizedBox( + height: 40, + width: 40, + child: Center( + child: Text( + '%', + style: TextStyle( + fontSize: 18, + fontWeight: + FontWeight.bold), + ), + ), + ) + ], + ), + ], ), - child: Align( - alignment: Alignment.center, - child: Text(NumberFormat.currency( - locale: 'en-PH', symbol: "₱") - .format(_totalMarketValue( - _unitValue, - _unitBase, - _areaValue, - _depValue, - _withoutBUCC, - _className, - isPainted, - isSecondHand, - _notPaintedUnitVal, - _secondHandUnitVal)))), ), - const SizedBox(height: 10), - Row( - children: [ - Container( - width: 120, - height: 60, - padding: const EdgeInsets.all(8.0), - child: ElevatedButton( - onPressed: () async { - try { - final tempID = - await SharedPreferences - .getInstance(); + ], + ), + ), - context.read().add( - AddAdditionalItems( - id: 1, - bldgapprDetailsId: tempID - .getInt('tempid')!, - classId: _classId, - assessedById: widget - .offlineProfile.id - .toString(), - assessedByName: widget - .offlineProfile - .firstName!, - dateCreated: formatter, - dateModified: 'None', - className: _className, - structType: - _structureType, - unitValue: - _withoutBUCC == true - ? 0 - : _unitValue, - baseUnitValue: - _unitBase, - area: _areaValue, - marketValue: - (_unitValue * - _unitBase) * - _areaValue, - depreciationRate: - _depValue, - adjustedMarketVal: - _totalMarketValue( - _unitValue, - _unitBase, - _areaValue, - _depValue, - _withoutBUCC, - _className, - isPainted, - isSecondHand, - _notPaintedUnitVal, - _secondHandUnitVal), - actualUse: 'Test', - amtDepreciation: - _amountofDepreciation( + const SizedBox(height: 10), + const Text('Market Value'), + const SizedBox(height: 5), + Container( + height: 45.0, + width: double.infinity, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all( + color: Colors.grey, + width: 1.0, + ), + borderRadius: BorderRadius.circular(5.0), + ), + child: Align( + alignment: Alignment.center, + child: Text(NumberFormat.currency( + locale: 'en-PH', symbol: "₱") + .format(_totalMarketValue( + _unitValue, + _unitBase, + _areaValue, + _depValue, + _withoutBUCC, + _className, + isPainted, + isSecondHand, + _notPaintedUnitVal, + _secondHandUnitVal)))), + ), + const SizedBox(height: 40), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + children: [ + Container( + width: 120, + height: 60, + padding: const EdgeInsets.all(8.0), + child: ElevatedButton( + onPressed: () async { + try { + final tempID = await SharedPreferences + .getInstance(); + + context + .read< + AdditionalItemsOfflineBloc>() + .add(AddAdditionalItems( + id: 1, + bldgapprDetailsId: tempID.getInt( + 'tempid')!, + classId: _classId, + assessedById: widget + .offlineProfile.id + .toString(), + assessedByName: + widget + .offlineProfile.firstName!, + dateCreated: formatter, + dateModified: 'None', + className: _className, + structType: _structureType, + unitValue: _withoutBUCC == + true + ? 0 + : _unitValue, + baseUnitValue: _unitBase, + area: _areaValue, + marketValue: (_unitValue * + _unitBase) * + _areaValue, + depreciationRate: _depValue, + adjustedMarketVal: + _totalMarketValue( _unitValue, _unitBase, _areaValue, _depValue, - ), - painted: true, - secondhand: true, - paintedUnitval: '1', - secondhandUnitval: - '1')); - } catch (e) { - Fluttertoast.showToast( - msg: - "Slow internet connection, please try again!", - ); - } - }, - style: ElevatedButton.styleFrom( - primary: Colors.black, - ), - child: const Text("Submit"), - ), - ), - const SizedBox( - width: - 5), // Use SizedBox for horizontal spacing in a Row - Container( - width: 120, - height: 60, - padding: const EdgeInsets.all(8.0), - child: ElevatedButton( - onPressed: () { - context - .read< - AdditionalItemsOfflineBloc>() - .add( - const LoadAdditionalItems()); - }, - style: ElevatedButton.styleFrom( - primary: Colors.black, - ), - child: const Text("Cancel"), - ), - ), - ], - ) - ], - ), - ), - ))); + _withoutBUCC, + _className, + isPainted, + isSecondHand, + _notPaintedUnitVal, + _secondHandUnitVal), + actualUse: 'Test', + amtDepreciation: + _amountofDepreciation( + _unitValue, + _unitBase, + _areaValue, + _depValue, + ), + painted: true, + secondhand: true, + paintedUnitval: '1', + secondhandUnitval: '1', + genCode: "5th")); + } catch (e) { + Fluttertoast.showToast( + msg: + "Slow internet connection, please try again!", + ); + } + }, + style: ElevatedButton.styleFrom( + primary: Colors.black, + ), + child: const Text("Submit"), + ), + ), + const SizedBox( + width: + 5), // Use SizedBox for horizontal spacing in a Row + Container( + width: 120, + height: 60, + padding: const EdgeInsets.all(8.0), + child: ElevatedButton( + onPressed: () { + context + .read() + .add(const LoadAdditionalItems()); + }, + style: ElevatedButton.styleFrom( + primary: Colors.black, + ), + child: const Text("Cancel"), + ), + ), + ], + ) + ], + ), + )); } return Container(); }, diff --git a/lib/screens/offline/passo/building/add/additional_items.dart b/lib/screens/offline/passo/building/add/additional_items.dart index 98f0c34..3b3bf1d 100644 --- a/lib/screens/offline/passo/building/add/additional_items.dart +++ b/lib/screens/offline/passo/building/add/additional_items.dart @@ -150,6 +150,9 @@ class _AdditionalItemOfflinePage extends State { const DataColumn( label: Text('Unit Value'), ), + const DataColumn( + label: Text('Area'), + ), const DataColumn( label: Text('% of BUCC'), ), @@ -168,6 +171,7 @@ class _AdditionalItemOfflinePage extends State { locale: 'en-PH', symbol: "₱", ).format(dataRow.baseUnitValue).toString())), + DataCell(Text(dataRow.area.toString())), DataCell(Text(dataRow.unitValue.toString())), DataCell(Text(NumberFormat.currency( locale: 'en-PH', @@ -276,29 +280,31 @@ class _AdditionalItemOfflinePage extends State { } } if (state is ShowAddItemsScreen) { - return ConstrainedBox( - constraints: BoxConstraints(maxHeight: 1000.0), - child: AlertDialog( - insetPadding: const EdgeInsets.symmetric( - horizontal: 20.0, - vertical: 10.0, - ), - title: const Text( - 'ADD EXTRA ITEMS', - textAlign: TextAlign.center, - ), - content: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded(child: AddExtraItemsOffline(widget.offlineProfile)) - ], - ), - ), - ); + return showDialog(context); } return Container(); }, )); } + + Widget showDialog(BuildContext context) { + return AlertDialog( + insetPadding: const EdgeInsets.symmetric( + horizontal: 10.0, + vertical: 20.0, + ), + title: const Text( + 'ADD ADDITIONAL ITEMS', + textAlign: TextAlign.center, + ), + content: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + AddExtraItemsOffline(widget.offlineProfile), + ], + ), + ), + ); + } } diff --git a/lib/screens/offline/passo/building/add/building_and_structure.dart b/lib/screens/offline/passo/building/add/building_and_structure.dart index 1a20ffc..f08b1bf 100644 --- a/lib/screens/offline/passo/building/add/building_and_structure.dart +++ b/lib/screens/offline/passo/building/add/building_and_structure.dart @@ -306,31 +306,32 @@ class _BuildingAndStructureOfflinePage } } if (state is ShowBldgAndStructuresScreen) { - return ConstrainedBox( - constraints: BoxConstraints(maxHeight: 1000.0), - child: AlertDialog( - insetPadding: const EdgeInsets.symmetric( - horizontal: 10.0, - vertical: 10.0, - ), - title: const Text( - 'ADD NEW BLDG & STRUCTURE', - textAlign: TextAlign.center, - ), - content: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: - AddBuildingAndStructureOffline(widget.offlineProfile)) - ], - ), - ), - ); + return showDialog( + context); // Placeholder return; replace with your desired widget } return Container(); }, )); } + + Widget showDialog(BuildContext context) { + return AlertDialog( + insetPadding: const EdgeInsets.symmetric( + horizontal: 10.0, + vertical: 20.0, + ), + title: const Text( + 'ADD NEW BLDG & STRUCTURE', + textAlign: TextAlign.center, + ), + content: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + AddBuildingAndStructureOffline(widget.offlineProfile), + ], + ), + ), + ); + } } diff --git a/lib/screens/offline/passo/building/add/general_description.dart b/lib/screens/offline/passo/building/add/general_description.dart index 5288e95..92066e3 100644 --- a/lib/screens/offline/passo/building/add/general_description.dart +++ b/lib/screens/offline/passo/building/add/general_description.dart @@ -3,14 +3,16 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:fluttertoast/fluttertoast.dart'; +import 'package:form_builder_validators/form_builder_validators.dart'; +import 'package:searchfield/searchfield.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:unit2/bloc/offline/offline_passo/admin/unit_construction/unit_construction_admin_bloc.dart'; import 'package:unit2/bloc/offline/offline_passo/building/general_description/general_description_bloc.dart'; import 'package:unit2/model/offline/offline_profile.dart'; import 'package:unit2/screens/offline/passo/building/add/add_building.dart'; -import 'package:unit2/screens/passo/Building/add_building_components/general_description.dart'; import '../../../../../model/passo/general_description.dart'; +import '../../../../../model/passo/unit_construct.dart'; import '../../../../../theme-data.dart/form-style.dart'; import '../../../../../widgets/passo/custom_button.dart'; import '../../../../../widgets/passo/custom_formBuilder_fields.dart'; @@ -31,6 +33,8 @@ class GeneralDescriptionOfflinePage extends StatefulWidget { class _GeneralDescriptionOfflinePage extends State { + final focus = FocusNode(); + final actual_use = [ "Residential", "Agricultural", @@ -47,6 +51,10 @@ class _GeneralDescriptionOfflinePage : now = DateTime.now(), formatter = DateFormat.yMMMMd('en_US').format(DateTime.now()); + late String bldgType; + late String bldgKind; + late String unitValue; + @override Widget build(BuildContext context) { return BlocConsumer( @@ -71,16 +79,46 @@ class _GeneralDescriptionOfflinePage Container( margin: const EdgeInsets.only( left: 0, top: 10, right: 0, bottom: 0), - child: FormBuilderDropdown( - name: 'bldg_type', - autofocus: false, - decoration: normalTextFieldStyle("Kind of Building", ""), - items: state.unit - .map((e) => DropdownMenuItem( - value: e, - child: Text('${e.bldgType}-${e.building}'), - )) - .toList(), + child: SizedBox( + height: 45, + child: SearchField( + itemHeight: 70, + suggestions: state.unit + .map((UnitConstruct unit) => SearchFieldListItem( + '${unit.bldgType} - ${unit.building}', + item: unit, + child: ListTile( + title: Text( + '${unit.bldgType} - ${unit.building!.toUpperCase()}', + overflow: TextOverflow.ellipsis, + ), + ))) + .toList(), + + validator: FormBuilderValidators.required( + errorText: "This field is required"), + + searchInputDecoration: + normalTextFieldStyle("Structure Type", "").copyWith( + suffixIcon: const Icon(Icons.arrow_drop_down)), + ////agency suggestion tap + focusNode: focus, + suggestionState: Suggestion.expand, + onSuggestionTap: (unit) { + setState(() { + bldgKind = + '${unit.item!.bldgType} - ${unit.item!.building}'; + bldgType = + '${unit.item!.bldgType} - ${unit.item!.building}'; + + unitValue = unit.item!.unitValue; + + offlineBldgKey.currentState! + .patchValue({'bldg_type': unit.item}); + }); + focus.unfocus(); + }, + ), ), ), customDropDownField( @@ -221,37 +259,37 @@ class _GeneralDescriptionOfflinePage widget.offlineProfile.firstName!, dateCreated: formatter, dateModified: 'None', - bldgKind: offlineBldgKey - .currentState?.value['bldg_type'].building, - strucType: offlineBldgKey - .currentState?.value['bldg_type'].bldgType, + bldgKind: bldgKind ?? "", + strucType: bldgType ?? "", bldgPermit: offlineBldgKey - .currentState?.value['bldg_permit'], - dateIssued: offlineBldgKey.currentState!.value['coc_issued'] - .toString(), + .currentState?.value['bldg_permit'] ?? + "", + dateIssued: offlineBldgKey + .currentState!.value['date_issued'] + .toString() ?? + "", cct: 'None', certCompletionIssued: offlineBldgKey - .currentState!.value['coc_issued'] - .toString(), + .currentState!.value['coc_issued'] + .toString() ?? + "", certOccupancyIssued: offlineBldgKey - .currentState!.value['coo_issued'] - .toString(), - dateCompleted: offlineBldgKey - .currentState!.value['date_cnstructed'] - .toString(), - dateOccupied: offlineBldgKey - .currentState!.value['date_occupied'] - .toString(), - bldgAge: offlineBldgKey.currentState!.value['bldg_age'], - noStoreys: offlineBldgKey.currentState!.value['no_of_storeys'], - area1Stfloor: '0', - area2Ndfloor: '0', - area3Rdfloor: '0', - area4Thfloor: '0', - totalFloorArea: offlineBldgKey.currentState?.value['total_area'], + .currentState!.value['coo_issued'] + .toString() ?? + "", + dateCompleted: offlineBldgKey.currentState!.value['date_cnstructed'].toString() ?? "", + dateOccupied: offlineBldgKey.currentState!.value['date_occupied'].toString() ?? "", + bldgAge: offlineBldgKey.currentState!.value['bldg_age'] ?? "", + noStoreys: offlineBldgKey.currentState!.value['no_of_storeys'] ?? "", + area1Stfloor: offlineBldgKey.currentState!.value['area_of_1stFl'] ?? "", + area2Ndfloor: offlineBldgKey.currentState!.value['area_of_2ndFl'] ?? "", + area3Rdfloor: offlineBldgKey.currentState!.value['area_of_3rdFl'] ?? "", + area4Thfloor: offlineBldgKey.currentState!.value['area_of_4thFl'] ?? "", + totalFloorArea: offlineBldgKey.currentState?.value['total_area'] ?? "", floorSketch: null, - actualUse: offlineBldgKey.currentState?.value['actual_use'], - unitValue: offlineBldgKey.currentState?.value['bldg_type'].unitValue)); + actualUse: offlineBldgKey.currentState?.value['actual_use'] ?? "", + unitValue: unitValue ?? "", + genCode: '5th')); widget.onPutGeneralDescription(); } ; diff --git a/lib/screens/offline/passo/building/add/landref_location.dart b/lib/screens/offline/passo/building/add/landref_location.dart index 0c14349..548e158 100644 --- a/lib/screens/offline/passo/building/add/landref_location.dart +++ b/lib/screens/offline/passo/building/add/landref_location.dart @@ -288,42 +288,46 @@ class _LandRefLocationOfflinePage extends State { dateCreated: 'None', dateModified: 'NOne', street: offlineBldgKey - .currentState?.value['street'], + .currentState?.value['street'] ?? + "", barangay: offlineBldgKey - .currentState?.value['brgy'], + .currentState?.value['brgy'] ?? + "", municipality: offlineBldgKey - .currentState - ?.value['municipality'] - .cityDescription, - province: "Agusan Del Norte")); + .currentState + ?.value['municipality'] + .cityDescription ?? + "", + province: "Agusan Del Norte", + genCode: "5th")); - context - .read() - .add(AddLandRef( - id: 1, - bldgapprDetailsId: - tempID.getInt('tempid')!, - assessedById: - widget.offlineProfile.id.toString(), - assessedByName: - widget.offlineProfile.firstName!, - dateCreated: 'None', - dateModified: 'None', - owner: offlineBldgKey - .currentState?.value['l_owner'], - cloaNo: offlineBldgKey.currentState - ?.value['oct_tct_cloa'], - lotNo: offlineBldgKey - .currentState?.value['lot_no'], - tdn: offlineBldgKey - .currentState?.value['l_td_arp'], - area: offlineBldgKey - .currentState?.value['area'], - surveyNo: offlineBldgKey - .currentState?.value['survey_no'], - blkNo: offlineBldgKey - .currentState?.value['blk_no'], - )); + context.read().add(AddLandRef( + id: 1, + bldgapprDetailsId: + tempID.getInt('tempid')!, + assessedById: + widget.offlineProfile.id.toString(), + assessedByName: + widget.offlineProfile.firstName!, + dateCreated: 'None', + dateModified: 'None', + owner: offlineBldgKey + .currentState?.value['l_owner'] ?? + "", + cloaNo: offlineBldgKey.currentState + ?.value['oct_tct_cloa'] ?? + "", + lotNo: offlineBldgKey + .currentState?.value['lot_no'] ?? + "", + tdn: offlineBldgKey.currentState + ?.value['l_td_arp'] ?? + "", + area: + offlineBldgKey.currentState?.value['area'] ?? "", + surveyNo: offlineBldgKey.currentState?.value['survey_no'] ?? "", + blkNo: offlineBldgKey.currentState?.value['blk_no'] ?? "", + genCode: '5th')); widget.NextBtn(); }, diff --git a/lib/screens/offline/passo/building/add/property_appraisal.dart b/lib/screens/offline/passo/building/add/property_appraisal.dart index e03b752..6af0937 100644 --- a/lib/screens/offline/passo/building/add/property_appraisal.dart +++ b/lib/screens/offline/passo/building/add/property_appraisal.dart @@ -549,12 +549,14 @@ class _PropertyAppraisalOfflinePage textAlign: TextAlign.left), ), Row( + mainAxisSize: MainAxisSize.min, children: [ Expanded( flex: 1, child: SingleChildScrollView( scrollDirection: Axis.horizontal, child: Column( + mainAxisSize: MainAxisSize.min, children: [ Container( margin: const EdgeInsets.only( @@ -569,6 +571,8 @@ class _PropertyAppraisalOfflinePage textAlign: TextAlign.left), ), DataTable( + columnSpacing: + MediaQuery.of(context).size.width / 3, columns: [ const DataColumn( label: Text('Building Core'), @@ -643,60 +647,68 @@ class _PropertyAppraisalOfflinePage fontSize: 15), textAlign: TextAlign.left), ), - DataTable(columns: [ - const DataColumn( - label: Text('Additional Item'), - ), - const DataColumn( - label: Text(''), - ), - const DataColumn( - label: Text('Market Value'), - ), - ], rows: [ - ...addItem.map((dataRow) { - return DataRow(cells: [ - DataCell(Text(dataRow.className!)), - DataCell(Text('')), - DataCell(Text( - NumberFormat.currency( - locale: 'en-PH', - symbol: "₱") - .format(double.parse(dataRow - .marketValue - .toString()!)) - .toString(), - )) - ]); - }).toList(), - DataRow( - // color: MaterialStateColor.resolveWith( - // (states) { - // // Use a color for the DataRow, for example, Colors.blue - // return Colors.redAccent; - // }), - cells: [ - DataCell(Text('Total', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 15, - color: Colors.red))), - DataCell(Text('')), - DataCell( - Text( - NumberFormat.currency( - locale: 'en-PH', - symbol: "₱", - ).format(_totalMarketValue( - addItem)), - style: TextStyle( - fontWeight: - FontWeight.bold, - fontSize: 15, - color: Colors.red)), - ) - ]), - ]), + DataTable( + columnSpacing: + MediaQuery.of(context).size.width / + 3, + columns: [ + const DataColumn( + label: Text('Additional Item'), + ), + const DataColumn( + label: Text(''), + ), + const DataColumn( + label: Text('Market Value'), + ), + ], + rows: [ + ...addItem.map((dataRow) { + return DataRow(cells: [ + DataCell( + Text(dataRow.className!)), + DataCell(Text('')), + DataCell(Text( + NumberFormat.currency( + locale: 'en-PH', + symbol: "₱") + .format(double.parse(dataRow + .marketValue + .toString()!)) + .toString(), + )) + ]); + }).toList(), + DataRow( + // color: MaterialStateColor.resolveWith( + // (states) { + // // Use a color for the DataRow, for example, Colors.blue + // return Colors.redAccent; + // }), + cells: [ + DataCell(Text('Total', + style: TextStyle( + fontWeight: + FontWeight.bold, + fontSize: 15, + color: Colors.red))), + DataCell(Text('')), + DataCell( + Text( + NumberFormat.currency( + locale: 'en-PH', + symbol: "₱", + ).format( + _totalMarketValue( + addItem)), + style: TextStyle( + fontWeight: + FontWeight.bold, + fontSize: 15, + color: Colors.red)), + ) + ]), + ]), ], )), ), @@ -722,65 +734,78 @@ class _PropertyAppraisalOfflinePage fontSize: 15), textAlign: TextAlign.left), ), - DataTable(columns: const [ - DataColumn( - label: Text('Actual Use'), - ), - DataColumn( - label: Text('Market Value'), - ), - DataColumn( - label: Text('Ass. Level'), - ), - DataColumn( - label: Text('Ass. Value'), - ), - ], rows: [ - DataRow( - cells: [ - DataCell(Text(offlineBldgKey - .currentState - ?.value['actual_use'])), - DataCell(Text(NumberFormat.currency( - locale: 'en-PH', symbol: "₱") - .format(_calculateMarketValue( - addItem, - state.bldgAndStructure)))), - DataCell( - Text( - assessmentLevel( - _calculateMarketValue(addItem, - state.bldgAndStructure), - offlineBldgKey.currentState - ?.value['actual_use']), - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 13, - ), - textAlign: TextAlign.center, - ), + DataTable( + columnSpacing: + MediaQuery.of(context).size.width / + 6, + columns: const [ + DataColumn( + label: Text('Actual Use'), + ), + DataColumn( + label: Text('Market Value'), + ), + DataColumn( + label: Text('Ass. Level'), + ), + DataColumn( + label: Text('Ass. Value'), ), - DataCell(Text( - NumberFormat.currency( - locale: 'en-PH', - symbol: "₱") - .format(double.parse( - assessmentValue( - _calculateMarketValue( - addItem, - state - .bldgAndStructure), - offlineBldgKey - .currentState - ?.value[ - 'actual_use']) - .toString(), - )) - .toString(), - )), ], - ), - ]) + rows: [ + DataRow( + cells: [ + DataCell(Text(offlineBldgKey + .currentState + ?.value['actual_use'] ?? + "")), + DataCell(Text(NumberFormat + .currency( + locale: 'en-PH', + symbol: "₱") + .format(_calculateMarketValue( + addItem, + state + .bldgAndStructure)))), + DataCell( + Text( + assessmentLevel( + _calculateMarketValue( + addItem, + state + .bldgAndStructure), + offlineBldgKey + .currentState + ?.value[ + 'actual_use']), + style: const TextStyle( + fontWeight: FontWeight.bold, + fontSize: 13, + ), + textAlign: TextAlign.center, + ), + ), + DataCell(Text( + NumberFormat.currency( + locale: 'en-PH', + symbol: "₱") + .format(double.parse( + assessmentValue( + _calculateMarketValue( + addItem, + state + .bldgAndStructure), + offlineBldgKey + .currentState + ?.value[ + 'actual_use']) + .toString(), + )) + .toString(), + )), + ], + ), + ]) ], )), ), diff --git a/lib/screens/offline/passo/building/add/property_assessment.dart b/lib/screens/offline/passo/building/add/property_assessment.dart index 7b60fa9..ff6ec84 100644 --- a/lib/screens/offline/passo/building/add/property_assessment.dart +++ b/lib/screens/offline/passo/building/add/property_assessment.dart @@ -10,6 +10,7 @@ import 'package:unit2/model/offline/offline_profile.dart'; import 'package:unit2/screens/offline/passo/building/add/add_building.dart'; import 'package:accordion/accordion.dart'; import 'package:accordion/controllers.dart'; +import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart'; import '../../../../../bloc/offline/offline_passo/building/assessment_offline/bldg_assessment_offline_bloc.dart'; import '../../../../../model/passo/memoranda.dart'; @@ -36,18 +37,26 @@ class _PropertyAssessmentOfflinePage bool isExempt = false; String _memoranda = ""; String _notes = ""; - + String appraised_by = ""; + String rec_by = ""; + String approved_by = ""; + String appraised_by_designation = ""; + String rec_by_designation = ""; + String approved_by_designation = ""; final focus = FocusNode(); final focuss = FocusNode(); final appraisedByFocus = FocusNode(); final recByFocus = FocusNode(); final apprvdByFocus = FocusNode(); + final quarter = ['1st', '2nd', '3rd', '4th']; + TextEditingController memorandaController = TextEditingController(); TextEditingController noteController = TextEditingController(); @override Widget build(BuildContext context) { + var width = MediaQuery.of(context).size.width; return BlocConsumer( listener: (context, state) { // TODO: implement listener @@ -124,7 +133,7 @@ class _PropertyAssessmentOfflinePage height: 20, ), const Text( - 'EFFECTIVITY OF ASSESSMENT / REASSESSMENT :', + 'EFFECTIVITY OF ASSESSMENT / REASSESSMENT / SWORN STATEMENT:', style: TextStyle(fontWeight: FontWeight.bold), ), const SizedBox( @@ -134,29 +143,23 @@ class _PropertyAssessmentOfflinePage 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.'), + width: width / 3 - 20, + height: 50, + child: customDropDownField( + 'Qtr', '', 'qtr', quarter)), SizedBox( - width: 70, - height: 25, - child: FormBuilderTextField( - name: 'yr', - validator: - FormBuilderValidators.compose([]), - ), - ), + width: width / 3 - 20, + height: 50, + child: customTextField( + 'Sworn Statement No.', + '', + 'sworn_statement')), + SizedBox( + width: width / 3 - 20, + height: 50, + child: + customTextField('Year', '', 'yr')), ], ), ], @@ -164,6 +167,41 @@ class _PropertyAssessmentOfflinePage const SizedBox( height: 30, ), + const Divider( + thickness: 2, + ), + SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Expanded( + child: Row( + children: [ + const SizedBox( + width: 10, + ), + SizedBox( + width: width / 2 - 100, + height: 50, + child: customDatTimePicker( + 'Date Received', + '', + 'date_received')), + const SizedBox( + width: 20, + ), + SizedBox( + width: width / 2 - 100, + height: 50, + child: customDatTimePicker( + 'Date of Entry', + '', + 'date_of_entry')) + ], + ), + ), + ), + const SizedBox( + height: 30, + ), const Align( alignment: Alignment.centerLeft, child: Text( @@ -175,125 +213,117 @@ class _PropertyAssessmentOfflinePage const SizedBox( height: 15, ), + SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row(children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text('Name'), + Container( + padding: EdgeInsets.fromLTRB(20, 0, 0, 0), + margin: const EdgeInsets.fromLTRB( + 0, 10, 0, 0), + width: 250, + decoration: BoxDecoration( + border: Border.all( + color: Colors + .grey, // You can set the color here + width: + 0.9, // You can set the width here + ), + borderRadius: BorderRadius.circular( + 5), // Set the border radius here + ), + child: SearchField( + itemHeight: 65, - Column( - children: [ - SearchField( - itemHeight: 70, - suggestions: state.signatories - .map((Signatories signatories) => - SearchFieldListItem( - '${signatories.firstname} ${signatories.lastname}', - item: signatories, - child: ListTile( - title: Text( - '${signatories.firstname} ${signatories.lastname!}', - overflow: - TextOverflow.ellipsis, - textAlign: TextAlign.center, - ), - ))) - .toList(), + suggestions: state.signatories + .map((Signatories signatories) => + SearchFieldListItem( + '${signatories.firstname} ${signatories.middlename} ${signatories.lastname}', + item: signatories, + child: ListTile( + title: Text( + '${signatories.firstname} ${signatories.middlename} ${signatories.lastname!}', + overflow: TextOverflow + .ellipsis, + textAlign: + TextAlign.center, + ), + ))) + .toList(), - validator: FormBuilderValidators.required( - errorText: "This field is required"), + validator: + FormBuilderValidators.required( + errorText: + "This field is required"), + searchStyle: TextStyle(), - // searchInputDecoration: - // normalTextFieldStyle("Appraised by", "") - // .copyWith( - // suffixIcon: const Icon( - // Icons.arrow_drop_down)), - ////agency suggestion tap - focusNode: appraisedByFocus, - suggestionState: Suggestion.expand, - onSuggestionTap: (unit) { - setState(() {}); - appraisedByFocus.unfocus(); - }, + ////agency suggestion tap + focusNode: appraisedByFocus, + suggestionState: Suggestion.expand, + onSuggestionTap: (appraised) { + setState(() { + appraised_by = + "${appraised.item?.firstname} ${appraised.item?.middlename} ${appraised.item?.lastname}"; + appraised_by_designation = + appraised.item!.designation; + }); + appraisedByFocus.unfocus(); + }, + ), + ), + ], ), - Text( - 'Name', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 14), - ) - ], - ), - const SizedBox( - height: 15, - ), - Column( - children: [ - SizedBox( - width: 200, - child: FormBuilderDateTimePicker( - name: 'app_date', - initialEntryMode: - DatePickerEntryMode.calendarOnly, - initialValue: DateTime.now(), - inputType: InputType.date, - format: DateFormat('MMMM dd, yyyy'), - textAlign: TextAlign.center, - - initialTime: - const TimeOfDay(hour: 8, minute: 0), - // locale: const Locale.fromSubtags(languageCode: 'fr'), - ), + const SizedBox( + width: 10, ), - const Text( - 'Date', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 14), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Designation'), + Container( + padding: + EdgeInsets.fromLTRB(10, 15, 10, 10), + margin: const EdgeInsets.fromLTRB( + 0, 10, 0, 0), + width: 250, + height: 50, + decoration: BoxDecoration( + border: Border.all( + color: Colors + .grey, // You can set the color here + width: + 0.9, // You can set the width here + ), + borderRadius: BorderRadius.circular( + 5), // Set the border radius here + ), + child: Text( + appraised_by_designation + .toUpperCase(), + style: TextStyle(fontSize: 15), + textAlign: TextAlign.center, + )), + ], ), - ], + const SizedBox( + width: 10, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Date'), + Container( + width: 100, + child: customDatTimePicker( + '', '', 'app_date')), + ], + ), + ]), ), - // 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()), - // ), - // const Text('Name'), - // ], - // ), - // const SizedBox( - // width: 15, - // ), - // Column( - // children: [ - // SizedBox( - // width: 100, - // child: FormBuilderDateTimePicker( - // name: 'app_date', - // initialEntryMode: - // DatePickerEntryMode.calendarOnly, - // initialValue: DateTime.now(), - // inputType: InputType.date, - // initialTime: - // const TimeOfDay(hour: 8, minute: 0), - // // locale: const Locale.fromSubtags(languageCode: 'fr'), - // ), - // ), - // const Text('Date'), - // ], - // ), - // ], - // ), const SizedBox( height: 30, ), @@ -306,104 +336,116 @@ class _PropertyAssessmentOfflinePage const SizedBox( height: 15, ), + SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row(children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text('Name'), + Container( + padding: EdgeInsets.fromLTRB(20, 0, 0, 0), + margin: const EdgeInsets.fromLTRB( + 0, 10, 0, 0), + width: 250, + decoration: BoxDecoration( + border: Border.all( + color: Colors + .grey, // You can set the color here + width: + 0.9, // You can set the width here + ), + borderRadius: BorderRadius.circular( + 5), // Set the border radius here + ), + child: SearchField( + itemHeight: 65, - Column( - children: [ - SearchField( - itemHeight: 70, - suggestions: state.signatories - .map((Signatories signatories) => - SearchFieldListItem( - '${signatories.firstname} ${signatories.lastname}', - item: signatories, - child: ListTile( - title: Text( - '${signatories.firstname} ${signatories.lastname!}', - overflow: - TextOverflow.ellipsis, - textAlign: TextAlign.center, - ), - ))) - .toList(), + suggestions: state.signatories + .map((Signatories signatories) => + SearchFieldListItem( + '${signatories.firstname} ${signatories.middlename} ${signatories.lastname}', + item: signatories, + child: ListTile( + title: Text( + '${signatories.firstname} ${signatories.middlename} ${signatories.lastname!}', + overflow: TextOverflow + .ellipsis, + textAlign: + TextAlign.center, + ), + ))) + .toList(), - validator: FormBuilderValidators.required( - errorText: "This field is required"), + validator: + FormBuilderValidators.required( + errorText: + "This field is required"), + searchStyle: TextStyle(), - // searchInputDecoration: - // normalTextFieldStyle("Appraised by", "") - // .copyWith( - // suffixIcon: const Icon( - // Icons.arrow_drop_down)), - ////agency suggestion tap - focusNode: recByFocus, - suggestionState: Suggestion.expand, - onSuggestionTap: (unit) { - setState(() {}); - recByFocus.unfocus(); - }, + ////agency suggestion tap + focusNode: recByFocus, + suggestionState: Suggestion.expand, + onSuggestionTap: (appraised) { + setState(() { + rec_by = + "${appraised.item?.firstname} ${appraised.item?.middlename} ${appraised.item?.lastname}"; + rec_by_designation = + appraised.item!.designation; + }); + recByFocus.unfocus(); + }, + ), + ), + ], ), - Text( - 'Name', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 14), - ) - ], + const SizedBox( + width: 10, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Designation'), + Container( + padding: + EdgeInsets.fromLTRB(10, 15, 10, 10), + margin: const EdgeInsets.fromLTRB( + 0, 10, 0, 0), + width: 250, + height: 50, + decoration: BoxDecoration( + border: Border.all( + color: Colors + .grey, // You can set the color here + width: + 0.9, // You can set the width here + ), + borderRadius: BorderRadius.circular( + 5), // Set the border radius here + ), + child: Text( + rec_by_designation.toUpperCase(), + style: TextStyle(fontSize: 15), + textAlign: TextAlign.center, + )), + ], + ), + const SizedBox( + width: 10, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Date'), + Container( + width: 100, + child: customDatTimePicker( + '', '', 'rec_date')), + ], + ), + ]), ), - Column( - children: [ - SizedBox( - width: 200, - child: FormBuilderDateTimePicker( - name: 'rec_date', - initialEntryMode: - DatePickerEntryMode.calendarOnly, - initialValue: DateTime.now(), - inputType: InputType.date, - format: DateFormat('MMMM dd, yyyy'), - textAlign: TextAlign.center, - initialTime: - const TimeOfDay(hour: 8, minute: 0), - // locale: const Locale.fromSubtags(languageCode: 'fr'), - ), - ), - const Text( - 'Date', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 14), - ), - ], - ), - // 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()), - // ), - // const Text('Name'), - // ], - // ), - // const SizedBox( - // width: 15, - // ), - - // ], - // ), const SizedBox( height: 30, ), @@ -415,49 +457,104 @@ class _PropertyAssessmentOfflinePage fontWeight: FontWeight.bold, ), )), - Column( - children: [ - Center( - child: SearchField( - itemHeight: 70, - suggestions: state.signatories - .map( - (Signatories signatories) => - SearchFieldListItem( - '${signatories.firstname} ${signatories.lastname}', - item: signatories, - child: ListTile( - title: Padding( - padding: - const EdgeInsets.all(8.0), - child: Text( - '${signatories.firstname} ${signatories.lastname!}', - overflow: - TextOverflow.ellipsis, - textAlign: TextAlign.center, - ), - ), - ), + const SizedBox( + height: 15, + ), + SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row(children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text('Name'), + Container( + padding: EdgeInsets.fromLTRB(20, 0, 0, 0), + margin: const EdgeInsets.fromLTRB( + 0, 10, 0, 0), + width: 250, + decoration: BoxDecoration( + border: Border.all( + color: Colors + .grey, // You can set the color here + width: + 0.9, // You can set the width here + ), + borderRadius: BorderRadius.circular( + 5), // Set the border radius here + ), + child: SearchField( + itemHeight: 65, + + suggestions: state.signatories + .map((Signatories signatories) => + SearchFieldListItem( + '${signatories.firstname} ${signatories.middlename} ${signatories.lastname}', + item: signatories, + child: ListTile( + title: Text( + '${signatories.firstname} ${signatories.middlename} ${signatories.lastname!}', + overflow: TextOverflow + .ellipsis, + textAlign: + TextAlign.center, + ), + ))) + .toList(), + + validator: + FormBuilderValidators.required( + errorText: + "This field is required"), + searchStyle: TextStyle(), + + ////agency suggestion tap + focusNode: apprvdByFocus, + suggestionState: Suggestion.expand, + onSuggestionTap: (appraised) { + setState(() { + approved_by = + "${appraised.item?.firstname} ${appraised.item?.middlename} ${appraised.item?.lastname}"; + approved_by_designation = + appraised.item!.designation; + }); + apprvdByFocus.unfocus(); + }, + ), + ), + ], + ), + const SizedBox( + width: 10, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Designation'), + Container( + padding: + EdgeInsets.fromLTRB(10, 15, 10, 10), + margin: const EdgeInsets.fromLTRB( + 0, 10, 0, 0), + width: 250, + height: 50, + decoration: BoxDecoration( + border: Border.all( + color: Colors + .grey, // You can set the color here + width: + 0.9, // You can set the width here ), - ) - .toList(), - validator: FormBuilderValidators.required( - errorText: "This field is required"), - focusNode: apprvdByFocus, - suggestionState: Suggestion.expand, - onSuggestionTap: (unit) { - setState(() {}); - apprvdByFocus.unfocus(); - }, - ), + borderRadius: BorderRadius.circular( + 5), // Set the border radius here + ), + child: Text( + approved_by_designation.toUpperCase(), + style: TextStyle(fontSize: 15), + textAlign: TextAlign.center, + )), + ], ), - Text( - 'Name', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 14), - ), - ], + ]), ), const SizedBox( @@ -525,7 +622,7 @@ class _PropertyAssessmentOfflinePage setState(() { _memoranda = memorandaController.text; }); - focus.unfocus(); + focuss.unfocus(); }, )), Container( @@ -607,7 +704,7 @@ class _PropertyAssessmentOfflinePage suggestionDirection: SuggestionDirection.up, onSuggestionTap: (memoranda) { setState(() { - _memoranda = memorandaController.text; + _notes = noteController.text; }); focus.unfocus(); }, @@ -683,93 +780,6 @@ class _PropertyAssessmentOfflinePage // ), // ), - const SizedBox( - height: 30, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - const Text('Sworn Statement No. :'), - SizedBox( - width: 150, - height: 20, - child: FormBuilderTextField( - name: 'sworn_statement', - decoration: const InputDecoration(), - validator: - FormBuilderValidators.compose([]), - ), - ), - ], - ), - const SizedBox( - height: 30, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - const Text('Date Received:'), - SizedBox( - width: 150, - height: 20, - child: FormBuilderDateTimePicker( - name: 'date_received', - initialEntryMode: - DatePickerEntryMode.calendarOnly, - initialValue: DateTime.now(), - inputType: InputType.date, - - initialTime: - const TimeOfDay(hour: 8, minute: 0), - // locale: const Locale.fromSubtags(languageCode: 'fr'), - ), - ), - ], - ), - const SizedBox( - height: 30, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - const Text( - 'Date of Entry in the Rec. of Ass. :'), - SizedBox( - width: 100, - height: 20, - child: FormBuilderDateTimePicker( - name: 'date_of_entry', - initialEntryMode: - DatePickerEntryMode.calendarOnly, - initialValue: DateTime.now(), - inputType: InputType.date, - - initialTime: - const TimeOfDay(hour: 8, minute: 0), - // locale: const Locale.fromSubtags(languageCode: 'fr'), - ), - ), - ], - ), - const SizedBox( - height: 30, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - const Text('By:'), - SizedBox( - width: 150, - height: 20, - child: FormBuilderTextField( - name: 'by', - decoration: const InputDecoration(), - validator: - FormBuilderValidators.compose([]), - ), - ), - ], - ), const SizedBox( height: 30, ), @@ -782,124 +792,90 @@ class _PropertyAssessmentOfflinePage // propertyAssessments = []; DateTime? appDate = offlineBldgKey .currentState!.value['app_date']; + DateTime? recDate = offlineBldgKey + .currentState!.value['rec_date']; + DateTime? dateReceived = offlineBldgKey + .currentState!.value['date_received']; + DateTime? entryDate = offlineBldgKey + .currentState!.value['date_of_entry']; String appDateString = appDate != null ? appDate.toString() : ''; - context - .read() - .add(AddBldgAssessment( - id: 1, - bldgapprDetailsId: - tempID.getInt('tempid')!, - assessedById: - widget.offlineProfile.id.toString(), - assessedByName: - widget.offlineProfile.firstName!, - dateCreated: '', - dateModified: '', - actualUse: offlineBldgKey.currentState! - .value['actual_use'] ?? - '', // Replace null with an empty string - marketValue: '0.00', - assessmentLevel: '0.00', - assessedValue: '0.00', - taxable: isTaxable == true ? '1' : '0', - exempt: isExempt == true ? '1' : '0', - qtr: int.parse(offlineBldgKey - .currentState!.value['qtr'] ?? - '0'), // Replace null with '0' - yr: int.parse(offlineBldgKey - .currentState!.value['yr'] ?? - '0'), // Replace null with '0' - appraisedbyName: (offlineBldgKey - .currentState! - .value['appraised_by'] - ?.firstname ?? - '') + - ' ' + - (offlineBldgKey - .currentState! - .value['appraised_by'] - ?.middlename ?? - '') + - ' ' + - (offlineBldgKey - .currentState! - .value['appraised_by'] - ?.lastname ?? - ''), - appraisedbyDate: - appDateString, // Replace null with current date - recommendapprName: (offlineBldgKey - .currentState! - .value['rec_approval'] - ?.firstname ?? - '') + - ' ' + - (offlineBldgKey - .currentState! - .value['rec_approval'] - ?.middlename ?? - '') + - ' ' + - (offlineBldgKey - .currentState! - .value['rec_approval'] - ?.lastname ?? - ''), - recommendapprDate: offlineBldgKey - .currentState!.value['rec_date'] - .toString(), // Replace null with current date - approvedbyName: (offlineBldgKey - .currentState! - .value['apprvd_by'] - ?.firstname ?? - '') + - ' ' + - (offlineBldgKey - .currentState! - .value['apprvd_by'] - ?.middlename ?? - '') + - ' ' + - (offlineBldgKey - .currentState! - .value['apprvd_by'] - ?.lastname ?? - ''), - memoranda: _memoranda, - swornstatementNo: offlineBldgKey - .currentState! - .value['sworn_statement'] ?? - '', // Replace null with an empty string - dateReceived: offlineBldgKey - .currentState!.value['date_received'] - .toString(), - // Replace null with current date - entryDateAssessment: offlineBldgKey - .currentState!.value['date_of_entry'] - .toString(), - // Replace null with current date - entryDateBy: offlineBldgKey - .currentState!.value['by'] ?? - '', // Replace null with an empty string - )); + String recDateString = + recDate != null ? recDate.toString() : ''; + String receivedDateString = + recDate != null ? recDate.toString() : ''; + String entryDateString = + recDate != null ? recDate.toString() : ''; + context.read().add( + AddBldgAssessment( + id: 1, + bldgapprDetailsId: + tempID.getInt('tempid')!, + assessedById: + widget.offlineProfile.id.toString(), + assessedByName: + widget.offlineProfile.firstName!, + dateCreated: '', + dateModified: '', + actualUse: offlineBldgKey.currentState! + .value['actual_use'] ?? + '', // Replace null with an empty string + marketValue: '0.00', + assessmentLevel: '0.00', + assessedValue: '0.00', + taxable: isTaxable == true ? '1' : '0', + exempt: isExempt == true ? '1' : '0', + qtr: offlineBldgKey + .currentState!.value['qtr'] ?? + '0', // Replace null with '0' + yr: int.parse( + offlineBldgKey.currentState!.value['yr'] ?? + '0'), // Replace null with '0' + appraisedbyName: appraised_by, + appraisedbyDate: + appDateString, // Replace null with current date + recommendapprName: rec_by, + recommendapprDate: + recDateString, // Replace null with current date + approvedbyName: approved_by, + memoranda: _memoranda, + note: _notes, + swornstatementNo: offlineBldgKey + .currentState! + .value['sworn_statement'] ?? + '', // Replace null with an empty string + dateReceived: receivedDateString, + // Replace null with current date + entryDateAssessment: entryDateString, + // Replace null with current date + entryDateBy: + widget.offlineProfile.firstName!, + genCode: '5th', + appraisedbyDesignation: + appraised_by_designation, + approvedbyDesignation: + approved_by_designation, + recommendapprDesignation: rec_by_designation + // Replace null with an empty string + )); widget.function(); }, style: ElevatedButton.styleFrom( backgroundColor: primary, foregroundColor: Colors.red), - child: const SizedBox( - width: 200, - height: 50, - child: Align( - alignment: Alignment.center, - child: Text( - 'Save', - style: TextStyle( - color: Colors.white, + child: const Expanded( + child: Padding( + padding: EdgeInsets.all(15.0), + child: Align( + alignment: Alignment.center, + child: Text( + 'Save', + style: TextStyle( + color: Colors.white, + ), + textAlign: TextAlign.center, ), - textAlign: TextAlign.center, ), ), ), diff --git a/lib/screens/offline/passo/building/add/property_owner_info.dart b/lib/screens/offline/passo/building/add/property_owner_info.dart index e77324b..77585bb 100644 --- a/lib/screens/offline/passo/building/add/property_owner_info.dart +++ b/lib/screens/offline/passo/building/add/property_owner_info.dart @@ -60,7 +60,27 @@ class _PropertyInfoPage extends State { child: customTextField("Pin", "", 'pin')), ], ), - customTextField("Owner", "", 'owner'), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Expanded( + flex: 1, + child: customTextField("First Name", "", 'fname'), + ), + const SizedBox(width: 10.0), + Expanded( + // optional flex property if flex is 1 because the default flex is 1 + flex: 1, + child: customTextField("Middle Name", "", 'mname'), + ), + const SizedBox(width: 10.0), + Expanded( + // optional flex property if flex is 1 because the default flex is 1 + flex: 1, + child: customTextField("Last Name", "", 'lname'), + ) + ]), + customDatTimePicker("Birthday", "", "bday"), customTextField("Address", "", 'address'), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, @@ -121,7 +141,14 @@ class _PropertyInfoPage extends State { '', pin: offlineBldgKey.currentState!.value['pin'] ?? '', - owner: offlineBldgKey.currentState!.value['owner'] ?? + fname: offlineBldgKey.currentState!.value['fname'] ?? + '', + mname: offlineBldgKey.currentState!.value['mname'] ?? + '', + lname: offlineBldgKey.currentState!.value['lname'] ?? + '', + bday: offlineBldgKey.currentState!.value['bday'] + .toString() ?? '', address: offlineBldgKey.currentState!.value['address'] ?? @@ -130,19 +157,17 @@ class _PropertyInfoPage extends State { '', tin: offlineBldgKey.currentState!.value['tin'] ?? '', - adminUser: offlineBldgKey - .currentState!.value['benificiary'] ?? - '', - adminAddress: offlineBldgKey.currentState! - .value['benificiary_address'] ?? - '', + adminUser: + offlineBldgKey.currentState!.value['benificiary'] ?? '', + adminAddress: offlineBldgKey.currentState!.value['benificiary_address'] ?? '', adminTin: offlineBldgKey.currentState!.value['benificiary_tin'] ?? '', adminTelno: offlineBldgKey.currentState!.value['benificiary_telno'] ?? '', faasType: "BUILDING", assessedById: widget.offlineProfile.id.toString(), assessedByName: widget.offlineProfile.firstName!, dateCreated: formatter, - dateModified: ''), + dateModified: '', + genCode: '5th'), ); widget.handleButtonPress(); }, diff --git a/lib/screens/offline/passo/building/add/structural_material.dart b/lib/screens/offline/passo/building/add/structural_material.dart index 12580cb..7ce64ef 100644 --- a/lib/screens/offline/passo/building/add/structural_material.dart +++ b/lib/screens/offline/passo/building/add/structural_material.dart @@ -7,7 +7,6 @@ import 'package:unit2/bloc/offline/offline_passo/building/structural_materials_o import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart'; import 'package:unit2/model/passo/structural_materials_ii.dart'; import 'package:unit2/screens/offline/passo/building/add/add_building.dart'; -import 'package:unit2/screens/passo/Building/add_building.dart'; import 'package:unit2/widgets/passo/custom_button.dart'; import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart'; @@ -408,57 +407,58 @@ class _StructuralMaterialsOfflinePage context .read() - .add(AddStructuralMaterial( - id: 1, - bldgapprDetailsId: tempID.getInt('tempid')!, - assessedById: '', - assessedByName: '', - dateCreated: '', - dateModified: '', - foundation: foundationOthers - ? [ - offlineBldgKey - .currentState!.value['other_foundation'] - ] - : widget.foundation, - columns: columOthers - ? [ - offlineBldgKey - .currentState!.value['other_column'] - ] - : widget.column, - beams: beamsOthers - ? [ - offlineBldgKey - .currentState!.value['other_beam'] - ] - : widget.beam, - trussFraming: tfOthers - ? [ - offlineBldgKey - .currentState!.value['other_tf'] - ] - : widget.trussFraming, - roof: roofOthers - ? [ - offlineBldgKey - .currentState!.value['other_roof'] - ] - : widget.roof, - flooring: flooringOthers - ? [ - offlineBldgKey - .currentState!.value['other_flooring'] - ] - : widget.flooring, - walls: wpOthers - ? [ - offlineBldgKey - .currentState!.value['other_wp'] - ] - : widget.walls, - others: const ["Others"], - )); + .add( + AddStructuralMaterial( + id: 1, + bldgapprDetailsId: tempID.getInt('tempid')!, + assessedById: '', + assessedByName: '', + dateCreated: '', + dateModified: '', + foundation: foundationOthers + ? [ + offlineBldgKey.currentState! + .value['other_foundation'] + ] + : widget.foundation, + columns: columOthers + ? [ + offlineBldgKey.currentState! + .value['other_column'] + ] + : widget.column, + beams: beamsOthers + ? [ + offlineBldgKey + .currentState!.value['other_beam'] + ] + : widget.beam, + trussFraming: tfOthers + ? [ + offlineBldgKey + .currentState!.value['other_tf'] + ] + : widget.trussFraming, + roof: roofOthers + ? [ + offlineBldgKey + .currentState!.value['other_roof'] + ] + : widget.roof, + flooring: flooringOthers + ? [ + offlineBldgKey.currentState! + .value['other_flooring'] + ] + : widget.flooring, + walls: wpOthers + ? [ + offlineBldgKey + .currentState!.value['other_wp'] + ] + : widget.walls, + others: const ["Others"], + genCode: '5th')); widget.NextBtn(); } ; diff --git a/lib/screens/offline/passo/building/edit/AddExtraItemsEdit.dart b/lib/screens/offline/passo/building/edit/AddExtraItemsEdit.dart index a3c57bb..01ebaef 100644 --- a/lib/screens/offline/passo/building/edit/AddExtraItemsEdit.dart +++ b/lib/screens/offline/passo/building/edit/AddExtraItemsEdit.dart @@ -570,7 +570,8 @@ class _AddExtraItemsEditOffline extends State { painted: true, secondhand: true, paintedUnitval: '1', - secondhandUnitval: '1')); + secondhandUnitval: '1', + genCode: "5th")); }, style: ElevatedButton.styleFrom( primary: Colors.black, diff --git a/lib/screens/offline/passo/building/edit/AddExtraItemsOffline.dart b/lib/screens/offline/passo/building/edit/AddExtraItemsOffline.dart new file mode 100644 index 0000000..e85bf70 --- /dev/null +++ b/lib/screens/offline/passo/building/edit/AddExtraItemsOffline.dart @@ -0,0 +1,743 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_form_builder/flutter_form_builder.dart'; +import 'package:fluttertoast/fluttertoast.dart'; +import 'package:form_builder_validators/form_builder_validators.dart'; +import 'package:intl/intl.dart'; +import 'package:searchfield/searchfield.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:unit2/bloc/offline/offline_passo/admin/class_components_admin.dart/class_components_admin_bloc.dart'; +import 'package:unit2/bloc/offline/offline_passo/admin/unit_construction/unit_construction_admin_bloc.dart'; +import 'package:unit2/bloc/offline/offline_passo/building/additional_items_offline/additional_items_offline_bloc.dart'; +import 'package:unit2/model/offline/offline_profile.dart'; +import 'package:unit2/model/passo/additional_items.dart'; +import 'package:unit2/model/passo/class_components.dart'; +import 'package:unit2/model/passo/unit_construct.dart'; +import 'package:unit2/theme-data.dart/form-style.dart'; +import 'package:unit2/utils/text_container.dart'; +import 'package:unit2/widgets/error_state.dart'; + +class AddExtraItemsOffline extends StatefulWidget { + final OfflineProfile offlineProfile; + AddExtraItemsOffline(this.offlineProfile); + + @override + _AddExtraItemsOffline createState() => _AddExtraItemsOffline(); +} + +class _AddExtraItemsOffline extends State { + GlobalKey formKey = GlobalKey(); + final focus = FocusNode(); + bool isPainted = false; + bool isSecondHand = false; + TextEditingController textEditingController = TextEditingController(); + double _unitBase = 0; + double _areaValue = 0; + final double _depValue = 0; + double _unitValue = 0; + String _className = ""; + int _classId = 0; + String _structureType = ""; + bool _withoutBUCC = false; + int _notPaintedUnitVal = 0; + int _secondHandUnitVal = 0; + + final DateTime now; + final String formatter; + + _AddExtraItemsOffline() + : now = DateTime.now(), + formatter = DateFormat.yMMMMd('en_US').format(DateTime.now()); + + BoxDecoration box1() { + return const BoxDecoration(boxShadow: [ + BoxShadow(color: Colors.black12, spreadRadius: 5, blurRadius: 5) + ], color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(3))); + } + + double _amountofDepreciation(unitVal, unitBase, area, depreciation) { + return ((unitVal * unitBase) * area) * depreciation; + } + + double _totalMarketValue(unitVal, unitBase, area, depreciation, withBUCC, + className, painted, secondHand, paintedUnitVal, secondhandUntVal) { + if (withBUCC == false) { + if (painted == true || secondHand == true) { + final deductions = (paintedUnitVal + secondhandUntVal) / 100; + + print(deductions); + return (((unitVal - deductions) * unitBase) * area); + } else { + return ((unitVal * unitBase) * area); + } + } else { + return (unitVal * area); + } + } + + @override + Widget build(BuildContext context) { + return BlocBuilder( + buildWhen: (previous, current) { + return false; + }, builder: (context, state) { + if (state is ShowAddItemsScreen) { + return BlocConsumer( + listener: (context, state) { + // TODO: implement listener + }, + builder: (context, state) { + if (state is ClassComponentsAdminLoaded) { + final classes = state.classes; + return BlocConsumer( + listener: (context, state) { + // TODO: implement listener + }, + builder: (context, state) { + if (state is UnitConstructLoaded) { + return FormBuilder( + key: formKey, + onChanged: () { + formKey.currentState?.save(); + }, + autovalidateMode: AutovalidateMode.disabled, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + height: 800, + child: SingleChildScrollView( + padding: const EdgeInsets.all(8.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Container( + margin: const EdgeInsets.only( + left: 0, + top: 10, + right: 0, + bottom: 0), + child: FormBuilderDropdown( + name: 'extra_item', + autofocus: false, + decoration: normalTextFieldStyle( + "Additional Item", ""), + items: classes + .map((e) => DropdownMenuItem( + value: e, + child: Text(e.componentName!), + )) + .toList(), + onChanged: (value) { + if (value!.minBaseUnitvalPercent != + '0.00') { + setState(() { + _unitValue = double.parse( + value.minBaseUnitvalPercent!); + _className = value.componentName!; + _classId = value.id!; + _withoutBUCC = + value.withoutBucc == 1 + ? true + : false; + }); + formKey.currentState!.patchValue({ + 'unitValue': + value.minBaseUnitvalPercent + }); + } + if (value.maxBaseUnitvalPercent != + '0.00') { + setState(() { + _unitValue = double.parse( + value.maxBaseUnitvalPercent!); + _className = value.componentName!; + _classId = value.id!; + _withoutBUCC = + value.withoutBucc == 1 + ? true + : false; + }); + formKey.currentState!.patchValue({ + 'unitValue': + value.maxBaseUnitvalPercent + }); + } + if (value.minUnitvalSqrmtr != + '0.00') { + setState(() { + _unitValue = double.parse( + value.minUnitvalSqrmtr!); + _className = value.componentName!; + _classId = value.id!; + _withoutBUCC = + value.withoutBucc == 1 + ? true + : false; + }); + formKey.currentState!.patchValue({ + 'unitValue': + value.minUnitvalSqrmtr + }); + } + if (value.maxUnitvalSqrmtr != + '0.00') { + setState(() { + _unitValue = double.parse( + value.maxUnitvalSqrmtr!); + _className = value.componentName!; + _classId = value.id!; + _withoutBUCC = + value.withoutBucc == 1 + ? true + : false; + }); + formKey.currentState!.patchValue({ + 'unitValue': + value.maxUnitvalSqrmtr + }); + } + if (value.minAddBaseunitval != + '0.00') { + setState(() { + _unitValue = double.parse( + value.minAddBaseunitval!); + _className = value.componentName!; + _classId = value.id!; + _withoutBUCC = + value.withoutBucc == 1 + ? true + : false; + }); + formKey.currentState!.patchValue({ + 'unitValue': + value.minAddBaseunitval + }); + } + if (value.maxAddBaseunitval != + '0.00') { + setState(() { + _unitValue = double.parse( + value.maxAddBaseunitval!); + _className = value.componentName!; + _classId = value.id!; + _withoutBUCC = + value.withoutBucc == 1 + ? true + : false; + }); + formKey.currentState!.patchValue({ + 'unitValue': + value.maxAddBaseunitval + }); + } + if (value.minDeductBaserate != + '0.00') { + setState(() { + _unitValue = double.parse( + value.minDeductBaserate!); + _className = value.componentName!; + _classId = value.id!; + _withoutBUCC = + value.withoutBucc == 1 + ? true + : false; + }); + formKey.currentState!.patchValue({ + 'unitValue': + value.minDeductBaserate + }); + } + if (value.maxDeductBaserate != + '0.00') { + setState(() { + _unitValue = double.parse( + value.maxDeductBaserate!); + _className = value.componentName!; + _classId = value.id!; + _withoutBUCC = + value.withoutBucc == 1 + ? true + : false; + }); + formKey.currentState!.patchValue({ + 'unitValue': + value.maxDeductBaserate + }); + } + }, + ), + ), + const SizedBox(height: 10), + Container( + margin: const EdgeInsets.only( + left: 0, + top: 10, + right: 0, + bottom: 0), + child: SizedBox( + height: 45, + child: SearchField( + itemHeight: 70, + suggestions: state.unit + .map((UnitConstruct unit) => + SearchFieldListItem( + '${unit.bldgType} - ${unit.building}', + item: unit, + child: ListTile( + title: Text( + '${unit.bldgType} - ${unit.building!.toUpperCase()}', + overflow: TextOverflow + .ellipsis, + ), + ))) + .toList(), + + validator: + FormBuilderValidators.required( + errorText: + "This field is required"), + + searchInputDecoration: + normalTextFieldStyle( + "Structure Type", "") + .copyWith( + suffixIcon: const Icon( + Icons + .arrow_drop_down)), + ////agency suggestion tap + focusNode: focus, + suggestionState: Suggestion.expand, + onSuggestionTap: (unit) { + setState(() { + if (_withoutBUCC) { + _unitBase = double.parse( + unit.item!.unitValue); + _structureType = + '${unit.item!.bldgType} - ${unit.item!.building}'; + } else { + _unitBase = double.parse( + unit.item!.unitValue); + _structureType = + '${unit.item!.bldgType} - ${unit.item!.building}'; + formKey.currentState! + .patchValue({ + 'unitValue': + unit.item!.unitValue + }); + } + }); + 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 = + double.parse(value!); + }); + }, + ), + ), + ], + ), + // const SizedBox(height: 10), + // FormBuilderTextField( + // name: 'depRate', + // decoration: + // normalTextFieldStyle("Depreciation Rate", ""), + // validator: FormBuilderValidators.compose([]), + // onChanged: (value) { + // setState(() { + // _depValue = double.parse(value!); + // }); + // }, + // ), + // const SizedBox(height: 10), + // FormBuilderTextField( + // name: 'marketValue', + // decoration: normalTextFieldStyle( + // NumberFormat.currency( + // locale: 'en-PH', symbol: "₱") + // .format(_totalMarketValue(_unitValue, + // _unitBase, _areaValue, _depValue)), + // ""), + // validator: FormBuilderValidators.compose([]), + // onChanged: (value) { + // setState(() { + // _marketValue = double.parse(value!); + // }); + // }, + // ), + // const SizedBox(height: 10), + // Text('Amount of Depreciation'), + // const SizedBox(height: 5), + // Container( + // height: 45.0, + // width: double.infinity, + // decoration: BoxDecoration( + // color: Colors.white, + // border: Border.all( + // color: Colors.grey, + // width: 1.0, + // ), + // borderRadius: BorderRadius.circular(5.0), + // ), + // child: Align( + // alignment: Alignment.center, + // child: Text(NumberFormat.currency( + // locale: 'en-PH', symbol: "₱") + // .format(_amountofDepreciation(_unitValue, + // _unitBase, _areaValue, _depValue)))), + // ), + + Visibility( + visible: !_withoutBUCC, + child: Column( + children: [ + const SizedBox(height: 10), + const Text( + 'Building is not painted?'), + const SizedBox(height: 5), + Container( + child: Row( + children: [ + Checkbox( + value: isPainted, + onChanged: (bool? value) { + setState(() { + isPainted = value!; + if (value == false) { + _notPaintedUnitVal = 0; + } else { + _notPaintedUnitVal = 10; + } + }); + }, + ), + const SizedBox(width: 10), + Container( + height: 40.0, + width: 100, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all( + color: Colors.grey, + width: 1.0, + ), + borderRadius: + BorderRadius.circular( + 5.0), + ), + child: Align( + alignment: + Alignment.center, + child: Text(' - ' + + _notPaintedUnitVal + .toString() + + '%')), + ), + ], + ), + ), + const SizedBox(height: 10), + const Text( + 'Uses second hand materials?'), + const SizedBox(height: 5), + Container( + child: Row( + children: [ + Checkbox( + value: isSecondHand, + onChanged: (bool? value) { + setState(() { + isSecondHand = value!; + if (isSecondHand == + false) { + _secondHandUnitVal = 0; + formKey.currentState! + .patchValue({ + 'secondHandMat': '0' + }); + } else { + _secondHandUnitVal = 5; + formKey.currentState! + .patchValue({ + 'secondHandMat': '5' + }); + } + }); + }, + ), + const SizedBox(width: 10), + Row( + children: [ + SizedBox( + height: 40, + width: 100, + child: + FormBuilderTextField( + enabled: isSecondHand, + name: 'secondHandMat', + textAlign: + TextAlign.center, + decoration: + normalTextFieldStyle( + "Unit Value", + ""), + validator: + FormBuilderValidators + .compose([]), + onChanged: (value) { + // Check if the value is not null before parsing to double + if (value != null && + value + .isNotEmpty) { + setState(() { + _secondHandUnitVal = + int.parse( + value); + }); + } else { + // Handle the case when the value is empty or null + // For example, set _secondHandUnitVal to a default value or show an error message. + } + }, + ), + ), + const SizedBox( + height: 40, + width: 40, + child: Center( + child: Text( + '%', + style: TextStyle( + fontSize: 18, + fontWeight: + FontWeight + .bold), + ), + ), + ) + ], + ), + ], + ), + ), + ], + ), + ), + + const SizedBox(height: 10), + const Text('Market Value'), + const SizedBox(height: 5), + Container( + height: 45.0, + width: double.infinity, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all( + color: Colors.grey, + width: 1.0, + ), + borderRadius: + BorderRadius.circular(5.0), + ), + child: Align( + alignment: Alignment.center, + child: Text(NumberFormat.currency( + locale: 'en-PH', symbol: "₱") + .format(_totalMarketValue( + _unitValue, + _unitBase, + _areaValue, + _depValue, + _withoutBUCC, + _className, + isPainted, + isSecondHand, + _notPaintedUnitVal, + _secondHandUnitVal)))), + ), + const SizedBox(height: 10), + Row( + children: [ + Container( + width: 120, + height: 60, + padding: const EdgeInsets.all(8.0), + child: ElevatedButton( + onPressed: () async { + try { + final tempID = + await SharedPreferences + .getInstance(); + + context.read().add( + AddAdditionalItems( + id: 1, + bldgapprDetailsId: tempID + .getInt('tempid')!, + classId: _classId, + assessedById: widget + .offlineProfile.id + .toString(), + assessedByName: widget + .offlineProfile + .firstName!, + dateCreated: formatter, + dateModified: 'None', + className: _className, + structType: + _structureType, + unitValue: + _withoutBUCC == true + ? 0 + : _unitValue, + baseUnitValue: + _unitBase, + area: _areaValue, + marketValue: + (_unitValue * + _unitBase) * + _areaValue, + depreciationRate: + _depValue, + adjustedMarketVal: + _totalMarketValue( + _unitValue, + _unitBase, + _areaValue, + _depValue, + _withoutBUCC, + _className, + isPainted, + isSecondHand, + _notPaintedUnitVal, + _secondHandUnitVal), + actualUse: 'Test', + amtDepreciation: + _amountofDepreciation( + _unitValue, + _unitBase, + _areaValue, + _depValue, + ), + painted: true, + secondhand: true, + paintedUnitval: '1', + secondhandUnitval: '1', + genCode: "5th")); + } catch (e) { + Fluttertoast.showToast( + msg: + "Slow internet connection, please try again!", + ); + } + }, + style: ElevatedButton.styleFrom( + primary: Colors.black, + ), + child: const Text("Submit"), + ), + ), + const SizedBox( + width: + 5), // Use SizedBox for horizontal spacing in a Row + Container( + width: 120, + height: 60, + padding: const EdgeInsets.all(8.0), + child: ElevatedButton( + onPressed: () { + context + .read< + AdditionalItemsOfflineBloc>() + .add( + const LoadAdditionalItems()); + }, + style: ElevatedButton.styleFrom( + primary: Colors.black, + ), + child: const Text("Cancel"), + ), + ), + ], + ) + ], + ), + ), + ))); + } + return Container(); + }, + ); + } + return Container(); + }, + ); + } + // if (state is Add) { + // return SomethingWentWrong( + // message: onError, + // onpressed: () { + // context.read().add(LoadAdditionalItems()); + // }, + // ); + // } + return Container(); + }); + } +} diff --git a/lib/screens/offline/passo/building/edit/additional_items_edit.dart b/lib/screens/offline/passo/building/edit/additional_items_edit.dart index 950ea89..b77eca6 100644 --- a/lib/screens/offline/passo/building/edit/additional_items_edit.dart +++ b/lib/screens/offline/passo/building/edit/additional_items_edit.dart @@ -12,7 +12,6 @@ import '../../../../../model/passo/class_components.dart'; import '../../../../../model/passo/unit_construct.dart'; import '../../../../../utils/alerts.dart'; import '../../../../../widgets/passo/custom_button.dart'; -import '../../../../passo/Building/edit_building/AddExtraItems.dart'; class AdditionalItemEditPageOffline extends StatefulWidget { final List unit; @@ -45,6 +44,14 @@ class _AdditionalItemEditPageOffline // return total; // } + double _totalMarketValue(items) { + double total = 0; + items.forEach((row) { + total += double.parse(row.adjustedMarketVal); + }); + return total; + } + @override Widget build(BuildContext context) { return Scaffold( @@ -88,14 +95,14 @@ class _AdditionalItemEditPageOffline .read() .add(ShowAdditionalItems()); }, - child: Row( + child: const Row( mainAxisSize: MainAxisSize.min, children: [ - const Text('ADD ITEM'), // <-- Text - const SizedBox( + Text('ADD ITEM'), // <-- Text + SizedBox( width: 5, ), - const Icon( + Icon( // <-- Icon Icons.add, size: 24.0, @@ -147,11 +154,11 @@ class _AdditionalItemEditPageOffline child: Container( height: 30, width: 30, - decoration: BoxDecoration( + decoration: const BoxDecoration( shape: BoxShape.circle, color: Colors.red, ), - child: Icon( + child: const Icon( Icons.delete, color: Colors.white, size: 20.0, @@ -167,18 +174,18 @@ class _AdditionalItemEditPageOffline "Are you sure you want to delete this item?"); }, ), - SizedBox( + const SizedBox( width: 10, ), InkWell( child: Container( height: 30, width: 30, - decoration: BoxDecoration( + decoration: const BoxDecoration( shape: BoxShape.circle, color: Colors.red, ), - child: Icon( + child: const Icon( Icons.edit, color: Colors.white, size: 20.0, @@ -199,25 +206,25 @@ class _AdditionalItemEditPageOffline ), ), ), - // Padding( - // padding: const EdgeInsets.only(left: 20.0, right: 20.0), - // child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // Text( - // 'Total', - // style: - // TextStyle(fontWeight: FontWeight.bold, fontSize: 15), - // ), - // Text( - // NumberFormat.currency(locale: 'en-PH', symbol: "₱") - // .format(_totalMarketValue(state.items)), - // style: - // TextStyle(fontWeight: FontWeight.bold, fontSize: 15), - // ) - // ], - // ), - // ), + Padding( + padding: const EdgeInsets.only(left: 20.0, right: 20.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + const Text( + 'Total Market Value', + style: TextStyle( + fontWeight: FontWeight.bold, fontSize: 17), + ), + Text( + NumberFormat.currency(locale: 'en-PH', symbol: "₱") + .format(_totalMarketValue(state.addItem)), + style: TextStyle( + fontWeight: FontWeight.bold, fontSize: 17), + ) + ], + ), + ), Padding( padding: const EdgeInsets.all(15.0), child: Row( @@ -230,7 +237,6 @@ class _AdditionalItemEditPageOffline { widget.PrevBtn(); } - ; }, ), CustomButton( @@ -240,7 +246,6 @@ class _AdditionalItemEditPageOffline { widget.NextBtn(); } - ; }, ) ], @@ -265,13 +270,13 @@ class _AdditionalItemEditPageOffline } if (state is ShowAddItemsScreen) { return ConstrainedBox( - constraints: BoxConstraints(maxHeight: 1000.0), + constraints: const BoxConstraints(maxHeight: 1000.0), child: AlertDialog( - insetPadding: EdgeInsets.symmetric( + insetPadding: const EdgeInsets.symmetric( horizontal: 20.0, vertical: 10.0, ), - title: Text( + title: const Text( 'ADD EXTRA ITEMS', textAlign: TextAlign.center, ), @@ -306,14 +311,14 @@ class _AdditionalItemEditPageOffline .read() .add(ShowAdditionalItems()); }, - child: Row( + child: const Row( mainAxisSize: MainAxisSize.min, children: [ - const Text('ADD ITEM'), // <-- Text - const SizedBox( + Text('ADD ITEM'), // <-- Text + SizedBox( width: 5, ), - const Icon( + Icon( // <-- Icon Icons.add, size: 24.0, diff --git a/lib/screens/offline/passo/building/edit/building_and_structure.dart b/lib/screens/offline/passo/building/edit/building_and_structure.dart new file mode 100644 index 0000000..1a20ffc --- /dev/null +++ b/lib/screens/offline/passo/building/edit/building_and_structure.dart @@ -0,0 +1,336 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:intl/intl.dart'; +import 'package:unit2/bloc/offline/offline_passo/building/building_and_structure/building_and_structure_bloc.dart'; +import 'package:unit2/model/offline/offline_profile.dart'; +import 'package:unit2/screens/offline/passo/building/add/AddBuildingAndStructure..dart'; + +import '../../../../../utils/alerts.dart'; +import '../../../../../widgets/passo/custom_button.dart'; + +class BuildingAndStructureOfflinePage extends StatefulWidget { + final VoidCallback additionalItemsPrevBtn; + final VoidCallback additionalItemsNextBtn; + final OfflineProfile offlineProfile; + + const BuildingAndStructureOfflinePage(this.additionalItemsPrevBtn, + this.additionalItemsNextBtn, this.offlineProfile); + + @override + _BuildingAndStructureOfflinePage createState() => + _BuildingAndStructureOfflinePage(); +} + +class _BuildingAndStructureOfflinePage + extends State { + // void deleteItem(int itemId) { + // context.read().add(DeleteAdditionalItems(id: itemId)); + // } + + void deleteItem(int itemId) { + context + .read() + .add(DeleteBuildingAndStructure(id: itemId)); + } + + final items = []; + + double _totalMarketValue(items) { + double total = 0; + items.forEach((row) { + total += double.parse(row.adjustedMarketValue); + }); + return total; + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: BlocConsumer( + listener: (context, state) { + // TODO: implement listener + }, + builder: (context, state) { + if (state is BuildingAndStructureOfflineInitial) { + return Column(children: [ + Expanded( + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(15.0), + child: Column(children: [ + Container( + margin: const EdgeInsets.only( + left: 0, top: 20, right: 0, bottom: 10), + child: const Text('BUILDING AND STRUCTURE', + 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(ShowBuildingAndStructure()); + }, + child: const Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text('ADD NEW'), // <-- Text + SizedBox( + width: 5, + ), + Icon( + // <-- Icon + Icons.add, + size: 24.0, + ), + ], + ), + ), + ) + ])))) + ]); + } + if (state is BuildingAndStructureLoaded) { + return Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(15.0), + child: Column( + children: [ + Container( + margin: const EdgeInsets.only( + left: 0, top: 20, right: 0, bottom: 10), + child: const Text('BUILDING AND STRUCTURES', + 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(ShowBuildingAndStructure()); + }, + child: const Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text('ADD ITEM'), // <-- Text + SizedBox( + width: 5, + ), + Icon( + // <-- Icon + Icons.add, + size: 24.0, + ), + ], + ), + ), + ), + SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: DataTable( + // ignore: prefer_const_literals_to_create_immutables + columns: [ + const DataColumn( + label: Text('Building Core'), + ), + const DataColumn( + label: Text('Type'), + ), + const DataColumn( + label: Text('Area'), + ), + const DataColumn( + label: Text('Unit Value'), + ), + const DataColumn( + label: Text('% of BUCC'), + ), + const DataColumn( + label: Text('Base Market Value'), + ), + const DataColumn( + label: Text('% of Depreciation'), + ), + const DataColumn( + label: Text('Depreciation Cost'), + ), + const DataColumn( + label: Text('Market Value'), + ), + const DataColumn( + label: Text('Action'), + ) + ], + rows: state.bldgAndStructure.map((dataRow) { + return DataRow( + cells: [ + DataCell(Text(dataRow.actualUse!)), + DataCell(Text(dataRow.bldgType!)), + DataCell(Text(dataRow.bldgArea!)), + DataCell(Text( + NumberFormat.currency( + locale: 'en-PH', symbol: "₱") + .format(double.parse(dataRow.unitValue!)), + )), + const DataCell(Text("100%")), + DataCell(Text( + NumberFormat.currency( + locale: 'en-PH', symbol: "₱") + .format( + double.parse(dataRow.marketValue!)), + )), + DataCell(Text(dataRow.depRate!)), + DataCell(Text( + NumberFormat.currency( + locale: 'en-PH', symbol: "₱") + .format(double.parse(dataRow.depAmount!)), + )), + DataCell(Text( + NumberFormat.currency( + locale: 'en-PH', symbol: "₱") + .format(double.parse( + dataRow.adjustedMarketValue!)), + )), + DataCell(Row( + children: [ + InkWell( + child: Container( + height: 30, + width: 30, + decoration: const BoxDecoration( + shape: BoxShape.circle, + color: Colors.red, + ), + child: const Icon( + Icons.delete, + color: Colors.white, + size: 20.0, + ), + ), + onTap: () { + confirmAlertWithCancel( + context, + () => deleteItem(dataRow.id!), + () => null, + 'Delete Item?', + "Are you sure you want to delete this item?"); + }, + ), + ], + )) + ], + ); + }).toList(), + ), + ) + ], + ), + ), + )), + Padding( + padding: const EdgeInsets.only(left: 20.0, right: 20.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + const Text( + 'Total Market Value', + style: + TextStyle(fontWeight: FontWeight.bold, fontSize: 17), + ), + Text( + NumberFormat.currency(locale: 'en-PH', symbol: "₱") + .format(_totalMarketValue(state.bldgAndStructure)), + style: + TextStyle(fontWeight: FontWeight.bold, fontSize: 17), + ) + ], + ), + ), + Padding( + padding: const EdgeInsets.all(15.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + CustomButton( + icon: const Icon(Icons.chevron_left_rounded, + color: Colors.white), + onPressed: () { + { + widget.additionalItemsPrevBtn(); + } + ; + }, + ), + CustomButton( + icon: const Icon(Icons.chevron_right_rounded, + color: Colors.white), + onPressed: () { + { + widget.additionalItemsNextBtn(); + } + ; + }, + ) + ], + ), + ), + ], + ); + } + if (state is BuildingAndStructureDeletedState) { + if (state.success) { + WidgetsBinding.instance.addPostFrameCallback((_) { + successAlert(context, "Deletion Successful", + "Extra item has been deleted successfully", () { + Navigator.of(context).pop(); + context + .read() + .add(LoadBuildingAndStructure()); + }); + }); + } + } + if (state is ShowBldgAndStructuresScreen) { + return ConstrainedBox( + constraints: BoxConstraints(maxHeight: 1000.0), + child: AlertDialog( + insetPadding: const EdgeInsets.symmetric( + horizontal: 10.0, + vertical: 10.0, + ), + title: const Text( + 'ADD NEW BLDG & STRUCTURE', + textAlign: TextAlign.center, + ), + content: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: + AddBuildingAndStructureOffline(widget.offlineProfile)) + ], + ), + ), + ); + } + return Container(); + }, + )); + } +} diff --git a/lib/screens/offline/passo/building/edit/edit_building.dart b/lib/screens/offline/passo/building/edit/edit_building.dart index 541832a..37da9d2 100644 --- a/lib/screens/offline/passo/building/edit/edit_building.dart +++ b/lib/screens/offline/passo/building/edit/edit_building.dart @@ -6,7 +6,9 @@ import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:im_stepper/stepper.dart'; import 'package:unit2/bloc/offline/offline_passo/admin/class_components_admin.dart/class_components_admin_bloc.dart'; import 'package:unit2/bloc/offline/offline_passo/admin/unit_construction/unit_construction_admin_bloc.dart'; +import 'package:unit2/model/offline/offline_profile.dart'; import 'package:unit2/screens/offline/passo/building/edit/additional_items_edit.dart'; +import 'package:unit2/screens/offline/passo/building/edit/building_and_structure.dart'; import 'package:unit2/screens/offline/passo/building/edit/general_description_edit.dart'; import 'package:unit2/screens/offline/passo/building/edit/landref_location_edit.dart'; import 'package:unit2/screens/offline/passo/building/edit/property_appraisal_edit.dart'; @@ -23,12 +25,14 @@ class EditBuildingOffline extends StatefulWidget { final int index; final PropertyInfo faas; final String title; + final OfflineProfile offlineProfile; const EditBuildingOffline( {super.key, required this.title, required this.index, - required this.faas}); + required this.faas, + required this.offlineProfile}); @override _EditBuildingOffline createState() => _EditBuildingOffline(); } @@ -37,7 +41,7 @@ class _EditBuildingOffline extends State { // THE FOLLOWING TWO VARIABLES ARE REQUIRED TO CONTROL THE STEPPER. int activeStep = 0; // Initial step set to 5. - int upperBound = 6; // upperBound MUST BE total number of icons minus 1. + int upperBound = 7; // upperBound MUST BE total number of icons minus 1. void PrevBtn() { setState(() { @@ -61,7 +65,7 @@ class _EditBuildingOffline extends State { appBar: AppBar( centerTitle: true, backgroundColor: primary, - title: Text('Building FAAS Edit'), + title: const Text('Building FAAS Edit'), ), body: ProgressHUD( padding: const EdgeInsets.all(24), @@ -85,9 +89,9 @@ class _EditBuildingOffline extends State { return Column( children: [ NumberStepper( - numbers: [1, 2, 3, 4, 5, 6, 7], + numbers: const [1, 2, 3, 4, 5, 6, 7, 8], activeStepColor: primary, - numberStyle: TextStyle(color: Colors.white), + numberStyle: const TextStyle(color: Colors.white), lineColor: primary, // activeStep property set to activeStep variable defined above. activeStep: activeStep, @@ -140,18 +144,22 @@ class _EditBuildingOffline extends State { return GeneralDescriptionEditOffline(widget.faas.id!, NextBtn, PrevBtn); case 3: + return BuildingAndStructureOfflinePage( + PrevBtn, NextBtn, widget.offlineProfile); + + case 4: return StructuralMaterialsPageEditOffline( widget.faas.id!, NextBtn, PrevBtn); - case 4: + case 5: return AdditionalItemEditPageOffline( unit, classes, widget.faas.id!, NextBtn, PrevBtn); - case 5: + case 6: return PropertyAppraisalEditPageOffline( widget.faas.id!, NextBtn, PrevBtn); - case 6: + case 7: return PropertyAssessmentEditOfflinePage(widget.faas.id!, onSAveAll); default: diff --git a/lib/screens/offline/passo/building/edit/property_appraisal_edit.dart b/lib/screens/offline/passo/building/edit/property_appraisal_edit.dart index b914d56..4a6cacf 100644 --- a/lib/screens/offline/passo/building/edit/property_appraisal_edit.dart +++ b/lib/screens/offline/passo/building/edit/property_appraisal_edit.dart @@ -8,12 +8,14 @@ import 'package:intl/intl.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:unit2/bloc/offline/offline_passo/building/additional_items_offline/additional_items_offline_bloc.dart'; import 'package:unit2/bloc/offline/offline_passo/building/appraisal_offline/bldg_appraisal_offline_bloc.dart'; +import 'package:unit2/bloc/offline/offline_passo/building/building_and_structure/building_and_structure_bloc.dart'; import 'package:unit2/bloc/offline/offline_passo/building/general_description/general_description_bloc.dart'; import 'package:unit2/model/passo/property_appraisal.dart'; import 'package:unit2/screens/offline/passo/building/edit/edit_building.dart'; import 'package:unit2/screens/offline/passo/building/edit/property_owner_info_edit.dart'; import '../../../../../model/passo/additional_items.dart'; +import '../../../../../model/passo/building_and_structure.dart'; import '../../../../../theme-data.dart/form-style.dart'; import '../../../../../widgets/passo/custom_button.dart'; @@ -514,756 +516,440 @@ class _PropertyAppraisalEditPage return 0; } + _calculateMarketValue( + List items, List bldg) { + double add_sum = 0; + double product = 1; + double bldg_sum = 0; + + for (AdditionalItems value in items) { + add_sum += double.parse(value.adjustedMarketVal.toString()); + } + + for (BldgAndStructure value in bldg) { + bldg_sum += double.parse(value.adjustedMarketValue.toString()); + } + + return add_sum + bldg_sum; + } + + double _totalMarketValue(items) { + double total = 0; + items.forEach((row) { + total += double.parse(row.adjustedMarketVal); + }); + return total; + } + + double _totalMarketValueBLDG(items) { + double total = 0; + items.forEach((row) { + total += double.parse(row.adjustedMarketValue); + }); + return total; + } + @override Widget build(BuildContext context) { return ProgressHUD( - padding: const EdgeInsets.all(24), - backgroundColor: Colors.black87, - indicatorWidget: const SpinKitFadingCircle(color: Colors.white), - child: BlocConsumer( - listener: (context, state) { - // if (state is PropertyAppraisalEditLoading) { - // final progress = ProgressHUD.of(context); - // progress!.showWithText("Please wait..."); - // } - - // if (state is PropertyAppraisalEditErrorState) { - // final progress = ProgressHUD.of(context); - // progress?.dismiss(); - // } - }, - builder: (context, state) { - if (state is SpecificBldgAppraisalLoaded) { - final appraisal = state.appraisal; - return BlocConsumer(listener: (context, state) { - // if (state is PropertyAppraisalEditLoading) { - // final progress = ProgressHUD.of(context); - // progress!.showWithText("Please wait..."); - // } - // if (state is AdditionalItemsEditLoading) { - // final progress = ProgressHUD.of(context); - // progress!.showWithText("Please wait..."); - // } - // if (state is AdditionalItemsEditErrorState) { - // final progress = ProgressHUD.of(context); - // progress?.dismiss(); - // } - }, builder: (context, state) { + padding: const EdgeInsets.all(24), + backgroundColor: Colors.black87, + indicatorWidget: const SpinKitFadingCircle(color: Colors.white), + child: BlocConsumer( + listener: (context, state) {}, + builder: (context, state) { if (state is AdditionalItemsLoaded) { - final item = state.addItem; - + final addItem = state.addItem; return BlocConsumer( - listener: (context, state) { - // if (state is GenDescLoading) { - // final progress = ProgressHUD.of(context); - // progress!.showWithText("Please wait..."); - // } - // if (state is GenDescLoaded) { - // final progress = ProgressHUD.of(context); - // progress?.dismiss(); - // } - // if (state is GenDescErrorState) { - // final progress = ProgressHUD.of(context); - // progress?.dismiss(); - // } - }, - builder: (context, state) { - if (state is SpecificGeneralDescriptionLoaded) { - double totalArea = double.tryParse( - (state.gendesc.totalFloorArea ?? - appraisal.totalArea) - ?.toString() ?? - '0.0') ?? - 0.0; - - double bldgUnitValue = double.tryParse( - state.gendesc.unitValue ?? - appraisal.unitconstructCost!) ?? - 0.0; - return Column( - children: [ - Expanded( - child: SingleChildScrollView( - child: Container( + GeneralDescriptionState>(listener: (context, state) { + // TODO: implement listener + }, builder: (context, state) { + if (state is SpecificGeneralDescriptionLoaded) { + final genDesc = state.gendesc; + return BlocConsumer(listener: (context, state) { + // TODO: implement listener + }, builder: (context, state) { + if (state is BuildingAndStructureLoaded) { + return SingleChildScrollView( + padding: EdgeInsets.all(20), + child: Column( + children: [ + 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: const Text( - "Unit Construction Cost", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 13), - textAlign: TextAlign.left, - ), - ), - Container( - child: Text( - bldgUnitValue.toString() + ' sq.m', - textAlign: TextAlign.right, - ), - ) - ], - ), - const SizedBox(height: 15), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - child: const Text( - "Building Core", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 13), - textAlign: TextAlign.left, - ), - ), - Container( - child: const Text( - '', - textAlign: TextAlign.right, - ), - ) - ], - ), - const SizedBox(height: 40), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - child: const Text( - "Sub-total", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 13), - textAlign: TextAlign.left, - ), - ), - Container( - child: Text( - NumberFormat.currency( - locale: 'en-PH', - symbol: "₱", - ) - .format((double.parse(state - .gendesc - .totalFloorArea!) * - double.parse(state - .gendesc.unitValue!))) - .toString(), - textAlign: TextAlign.right, - ), - ) - ], - ), - const SizedBox(height: 40), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - child: const Text( - "Cost of Additional Items", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 13), - textAlign: TextAlign.left, - ), - ), - Container( - child: const Text( - '', - textAlign: TextAlign.right, - ), - ) - ], - ), - const SizedBox(height: 15), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - child: const Text( - "Sub-total", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 13), - textAlign: TextAlign.left, - ), - ), - Container( - child: Text( - NumberFormat.currency( - locale: 'en-PH', - symbol: "₱", - ).format(double.parse(appraisal - .addItemsSubtotal!)) ?? - '0.00', - textAlign: TextAlign.right, - ), - ) - ], - ), - const SizedBox(height: 15), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - child: const Text( - "Total Construction Cost", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 13), - textAlign: TextAlign.left, - ), - ), - Container( - child: Text( - NumberFormat.currency( - locale: 'en-PH', - symbol: "₱", - ) - .format(calculateConstructionCost( - double.parse(appraisal - .unitconstructSubtotal!), - double.parse(appraisal - .addItemsSubtotal!))) - .toString(), - textAlign: TextAlign.right, - ), - ) - ], - ), - const SizedBox(height: 40), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - child: const 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: const Text( - "Depreciation Cost", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 13), - textAlign: TextAlign.left, - ), - ), - Container( - child: Text( - calculateDepCost( - (totalArea * bldgUnitValue), - item, - double.parse(offlineBldgEditKey - .currentState - ?.value[ - 'depRate'] ?? - appraisal - .depreciationRate)) - .toString(), - textAlign: TextAlign.right, - ), - ) - ], - ), - const SizedBox(height: 15), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - child: const Text( - "Total % Depreciation", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 13), - textAlign: TextAlign.left, - ), - ), - Container( - child: Text( - '${(double.parse(offlineBldgEditKey.currentState?.value['depRate'] ?? appraisal.depreciationRate) * 100).toStringAsFixed(2)}%', - textAlign: TextAlign.right, - ), - ) - ], - ), - const SizedBox(height: 15), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - child: const Text( - "Market Value", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 13), - textAlign: TextAlign.left, - ), - ), - Container( - child: Text( - NumberFormat.currency( - locale: 'en-PH', - symbol: "₱", - ) - .format(calculateMarketValue( - (totalArea * bldgUnitValue), - item, - double.parse(offlineBldgEditKey - .currentState - ?.value[ - 'depRate'] ?? - appraisal - .depreciationRate))) - .toString(), - textAlign: TextAlign.right, - ), - ) - ], - ), - Row( - children: [ - Expanded( - flex: 1, - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Container( - margin: - const EdgeInsets.symmetric( - horizontal: 20.0), - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Container( - margin: const EdgeInsets - .fromLTRB(0, 20, 0, 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: 150, - 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: 150, - 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: 50, - child: - SingleChildScrollView( - scrollDirection: - Axis.horizontal, - child: Row(children: [ - 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( - state.gendesc - .actualUse ?? - "", - style: - const TextStyle( - fontWeight: - FontWeight.bold, - fontSize: - 13, - ), - textAlign: - TextAlign - .center, - ), - ), - Container( - width: 150, - margin: const EdgeInsets - .only( - top: 15, - left: - 15), - padding: - const EdgeInsets - .all( - 5.0), - child: Text( - NumberFormat - .currency( - locale: - 'en-PH', - symbol: - "₱", - ).format( - calculateMarketValue( - (totalArea * - bldgUnitValue), - item, - double.parse(offlineBldgEditKey.currentState?.value['depRate'] ?? - appraisal.depreciationRate)), - ), - style: - const 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(calculateMarketValue((totalArea * bldgUnitValue), item, double.parse(offlineBldgEditKey.currentState?.value['depRate'] ?? appraisal.depreciationRate)).toString(), state.gendesc.actualUse)}%', - style: - const TextStyle( - fontWeight: - FontWeight.bold, - fontSize: - 13, - ), - textAlign: - TextAlign - .center, - ), - ), - Container( - width: 150, - margin: const EdgeInsets - .only( - top: 15, - left: - 15), - padding: - const EdgeInsets - .all( - 5.0), - child: Text( - NumberFormat - .currency( - locale: - 'en-PH', - symbol: - "₱", - ).format(assessmentValue( - calculateMarketValue((totalArea * bldgUnitValue), item, double.parse(offlineBldgEditKey.currentState?.value['depRate'] ?? appraisal.depreciationRate)) - .toString(), - state - .gendesc - .actualUse)), - style: - const TextStyle( - fontWeight: - FontWeight.bold, - fontSize: - 13, - ), - textAlign: - TextAlign - .center, - ), - ), - const SizedBox( - height: 80, - ), - ], - ), - ) - ]), - ), - ) - ], - ) - ], - ), - ), - ), - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - children: [ - CustomButton( - icon: const Icon( - Icons.chevron_left_rounded, - color: Colors.white), - onPressed: () { - { - widget.PrevBtn(); - } - ; - }, - ), - CustomButton( - icon: const Icon( - Icons.chevron_right_rounded, - color: Colors.white), - onPressed: () async { - final tempID = - await SharedPreferences - .getInstance(); - - final id = tempID.getInt('tempid')!; - { - var appraisals = PropertyAppraisal( - id: 1, - bldgapprDetailsId: id, - assessedById: '1', - assessedByName: 'cyril', - dateCreated: '000', - actualUse: - state.gendesc.actualUse, - dateModified: '222', - unitconstructCost: - bldgUnitValue.toString(), - buildingCore: 'test', - unitconstructSubtotal: - (totalArea * bldgUnitValue) - .toString(), - depreciationRate: - depRate.toString(), - depreciationCost: - calculateDepCost((totalArea * bldgUnitValue), item, depRate) - .toString(), - costAddItems: calculateAdditionalItems(item) - .toString(), - addItemsSubtotal: - calculateAdditionalItems(item) - .toString(), - totalpercentDepreciation: - (depRate * 100) - .toStringAsFixed(2), - marketValue: calculateMarketValue( - (totalArea * bldgUnitValue), - item, - depRate) - .toString(), - totalArea: totalArea.toString()); - - context - .read< - BldgAppraisalOfflineBloc>() - .add(UpdateAppraisal( - appraisal: appraisals, - id: widget.tempId)); - - widget.NextBtn(); - } - ; - }, - ) - ], - ) - ], - ), + left: 0, top: 20, right: 0, bottom: 20), + child: const Text('PROPERTY APPRAISAL', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + textAlign: TextAlign.left), ), - ), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + flex: 1, + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + margin: const EdgeInsets.only( + left: 0, + top: 20, + right: 0, + bottom: 20), + child: const Text( + 'BUILDING & STRUCTURE', + style: TextStyle( + fontWeight: + FontWeight.bold, + fontSize: 15), + textAlign: TextAlign.left), + ), + DataTable( + columnSpacing: + MediaQuery.of(context) + .size + .width / + 3, + columns: [ + const DataColumn( + label: Text('Building Core'), + ), + const DataColumn( + label: Text(''), + ), + const DataColumn( + label: Text('Market Value'), + ), + ], + rows: [ + ...state.bldgAndStructure + .map((dataRow) { + return DataRow(cells: [ + DataCell(Text( + dataRow.actualUse!)), + DataCell(Text("")), + DataCell(Text( + NumberFormat.currency( + locale: 'en-PH', + symbol: "₱", + ).format(double.parse( + dataRow + .adjustedMarketValue + .toString()!)), + )) + ]); + }), + DataRow(cells: [ + DataCell(Text('Total', + style: TextStyle( + fontWeight: + FontWeight.bold, + fontSize: 15, + color: Colors.red))), + DataCell(Text('')), + DataCell( + Text( + NumberFormat.currency( + locale: 'en-PH', + symbol: "₱", + ).format( + _totalMarketValueBLDG( + state + .bldgAndStructure)), + style: TextStyle( + fontWeight: + FontWeight.bold, + fontSize: 15, + color: Colors.red)), + ) + ]), + ], + ) + ], + )), + ), + ], + ), + Row( + children: [ + Expanded( + flex: 1, + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Column( + children: [ + Container( + margin: const EdgeInsets.only( + left: 0, + top: 20, + right: 0, + bottom: 20), + child: const Text( + 'ADDITIONAL ITEMS', + style: TextStyle( + fontWeight: + FontWeight.bold, + fontSize: 15), + textAlign: TextAlign.left), + ), + DataTable( + columnSpacing: + MediaQuery.of(context) + .size + .width / + 3, + columns: [ + const DataColumn( + label: + Text('Additional Item'), + ), + const DataColumn( + label: Text(''), + ), + const DataColumn( + label: Text('Market Value'), + ), + ], + rows: [ + ...addItem.map((dataRow) { + return DataRow(cells: [ + DataCell(Text( + dataRow.className!)), + DataCell(Text('')), + DataCell(Text( + NumberFormat.currency( + locale: 'en-PH', + symbol: "₱") + .format(double + .parse(dataRow + .marketValue + .toString()!)) + .toString(), + )) + ]); + }).toList(), + DataRow( + // color: MaterialStateColor.resolveWith( + // (states) { + // // Use a color for the DataRow, for example, Colors.blue + // return Colors.redAccent; + // }), + cells: [ + DataCell(Text('Total', + style: TextStyle( + fontWeight: + FontWeight + .bold, + fontSize: 15, + color: Colors + .red))), + DataCell(Text('')), + DataCell( + Text( + NumberFormat + .currency( + locale: 'en-PH', + symbol: "₱", + ).format( + _totalMarketValue( + addItem)), + style: TextStyle( + fontWeight: + FontWeight + .bold, + fontSize: 15, + color: Colors + .red)), + ) + ]), + ]), + ], + )), + ), + ], + ), + Row( + children: [ + Expanded( + flex: 1, + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Column( + 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: 15), + textAlign: TextAlign.left), + ), + DataTable( + columnSpacing: + MediaQuery.of(context) + .size + .width / + 6, + columns: const [ + DataColumn( + label: Text('Actual Use'), + ), + DataColumn( + label: Text('Market Value'), + ), + DataColumn( + label: Text('Ass. Level'), + ), + DataColumn( + label: Text('Ass. Value'), + ), + ], + rows: [ + DataRow( + cells: [ + DataCell(Text( + genDesc.actualUse ?? + "")), + DataCell(Text(NumberFormat + .currency( + locale: + 'en-PH', + symbol: "₱") + .format(_calculateMarketValue( + addItem, + state + .bldgAndStructure)))), + DataCell( + Text( + assessmentLevel( + _calculateMarketValue( + addItem, + state + .bldgAndStructure) + .toString(), + genDesc + .actualUse) + .toString(), + style: + const TextStyle( + fontWeight: + FontWeight.bold, + fontSize: 13, + ), + textAlign: + TextAlign.center, + ), + ), + DataCell(Text( + NumberFormat.currency( + locale: 'en-PH', + symbol: "₱") + .format(double.parse(assessmentValue( + _calculateMarketValue( + addItem, + state + .bldgAndStructure) + .toString(), + genDesc + .actualUse) + .toString())) + .toString(), + )), + ], + ), + ]) + ], + )), + ), + ], + ), + const SizedBox( + height: 50, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + children: [ + CustomButton( + icon: const Icon(Icons.chevron_left_rounded, + color: Colors.white), + onPressed: () { + { + widget.PrevBtn(); + } + ; + }, + ), + CustomButton( + icon: const Icon( + Icons.chevron_right_rounded, + color: Colors.white), + onPressed: () async { + { + // final tempID = + // await SharedPreferences.getInstance(); + // print(tempID.getInt('tempid')); + // context.read().add(AddBldgAppraisal( + // id: 1, + // bldgapprDetailsId: tempID.getInt('tempid')!, + // assessedById: '1', + // assessedByName: 'ad', + // dateCreated: '00', + // dateModified: '00', + // unitconstructCost: offlineBldgKey + // .currentState + // ?.value['bldg_type'] + // .unitValue, + // buildingCore: 'test', + // unitconstructSubtotal: + // (double.parse(offlineBldgKey.currentState!.value['total_area']) * + // double.parse(offlineBldgKey + // .currentState! + // .value['bldg_type'] + // .unitValue)) + // .toString(), + // depreciationRate: depRate.toString(), + // depreciationCost: calculateDepCost( + // (double.parse(offlineBldgKey.currentState!.value['total_area']) * + // double.parse(offlineBldgKey.currentState?.value['bldg_type'].unitValue)), + // addItem, + // depRate) + // .toString(), + // costAddItems: calculateAdditionalItems(addItem).toString(), + // addItemsSubtotal: calculateAdditionalItems(addItem).toString(), + // totalpercentDepreciation: (depRate * 100).toStringAsFixed(2), + // marketValue: calculateMarketValue((double.parse(offlineBldgKey.currentState!.value['total_area']) * double.parse(offlineBldgKey.currentState!.value['bldg_type'].unitValue)), addItem, depRate).toString(), + // totalArea: offlineBldgKey.currentState!.value['total_area'], + // actualUse: "Residential")); + widget.NextBtn(); + } + ; + }, + ) + ], + ), + ], ), - ], - ); - } - return Container(); - }, - ); + ); + } + return Container(); + }); + } + return Container(); + }); } return Container(); - }); - } - // if (state is PropertyAppraisalEditErrorState) { - // return SomethingWentWrong( - // message: onError, - // onpressed: () { - // context - // .read() - // .add(LoadPropertyAppraisalEdit( - // appraisalEdit: PropertyAppraisalEdit(), - // id: widget.tempId, - // )); - // }, - // ); - // } - return Container(); - }, - ), - ); + })); } } diff --git a/lib/screens/offline/passo/building/edit/property_assessment_edit.dart b/lib/screens/offline/passo/building/edit/property_assessment_edit.dart index 9c58e1f..a36e718 100644 --- a/lib/screens/offline/passo/building/edit/property_assessment_edit.dart +++ b/lib/screens/offline/passo/building/edit/property_assessment_edit.dart @@ -4,6 +4,7 @@ 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:form_builder_validators/form_builder_validators.dart'; +import 'package:intl/intl.dart'; import 'package:searchfield/searchfield.dart'; import 'package:unit2/bloc/offline/offline_passo/admin/memoranda/memoranda_admin_bloc.dart'; import 'package:unit2/bloc/offline/offline_passo/admin/signatories/signatories_admin_bloc.dart'; @@ -16,6 +17,7 @@ import '../../../../../model/passo/property_assessment.dart'; import '../../../../../model/passo/property_assessment_edit.dart'; import '../../../../../model/passo/signatories.dart'; import '../../../../../theme-data.dart/form-style.dart'; +import '../../../../../widgets/passo/custom_formBuilder_fields.dart'; class PropertyAssessmentEditOfflinePage extends StatefulWidget { int tempId; @@ -32,7 +34,22 @@ class _PropertyAssessmentEditOfflinePage bool isTaxable = false; bool isExempt = false; String _memoranda = ''; + String _notes = ""; + String appraised_by = ""; + String rec_by = ""; + String approved_by = ""; + String appraised_by_designation = ""; + String rec_by_designation = ""; + String approved_by_designation = ""; final focus = FocusNode(); + final focuss = FocusNode(); + final appraisedByFocus = FocusNode(); + final recByFocus = FocusNode(); + final apprvdByFocus = FocusNode(); + final quarter = ['1st', '2nd', '3rd', '4th']; + + TextEditingController memorandaController = TextEditingController(); + TextEditingController noteController = TextEditingController(); String assessmentLevel(marketValues, property_class) { final marketValue = double.parse(marketValues); @@ -469,6 +486,12 @@ class _PropertyAssessmentEditOfflinePage setState(() { isTaxable = state.assessment.taxable == '1' ? true : false; isExempt = state.assessment.exempt == '1' ? true : false; + memorandaController.text = state.assessment.memoranda; + noteController.text = state.assessment.note; + appraised_by_designation = + state.assessment.appraisedbyDesignation!; + rec_by_designation = state.assessment.recommendapprDesignation!; + approved_by_designation = state.assessment.approvedbyDesignation!; }); } // if (state is PropertyAssessmentEditErrorState) { @@ -512,19 +535,20 @@ class _PropertyAssessmentEditOfflinePage }, builder: (context, state) { if (state is MemorandaLoaded) { + final memoranda = state.memo; + final note = state.memo; return Padding( padding: const EdgeInsets.all(20.0), child: FormBuilder( key: offlineBldgEditKey, initialValue: { 'qtr': assessment.qtr?.toString() ?? '', - 'yr': assessment.qtr?.toString() ?? '', + 'yr': assessment.yr?.toString() ?? '', 'app_date': assessment.appraisedbyDate?.toString() ?? '', 'rec_date': assessment.recommendapprDate?.toString() ?? '', - 'memoranda': assessment.memoranda ?? '', 'sworn_statement': assessment.swornstatementNo ?? '', 'date_received': @@ -532,7 +556,6 @@ class _PropertyAssessmentEditOfflinePage 'date_of_entry': assessment.entryDateAssessment?.toString() ?? '', - 'by': assessment.entryDateBy ?? '', }, enabled: true, onChanged: () { @@ -603,7 +626,7 @@ class _PropertyAssessmentEditOfflinePage height: 20, ), const Text( - 'EFFECTIVITY OF ASSESSMENT / REASSESSMENT :', + 'EFFECTIVITY OF ASSESSMENT / REASSESSMENT / SWORN STATEMENT:', style: TextStyle( fontWeight: FontWeight.bold), @@ -616,37 +639,68 @@ class _PropertyAssessmentEditOfflinePage 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.'), + width: 90, + height: 50, + child: + customDropDownField( + 'Qtr', + '', + 'qtr', + quarter)), SizedBox( - width: 70, - height: 25, - child: - FormBuilderTextField( - name: 'yr', - validator: - FormBuilderValidators - .compose([]), - ), - ), + width: 100, + height: 50, + child: customTextField( + 'Sworn Statement No.', + '', + 'sworn_statement')), + SizedBox( + width: 90, + height: 50, + child: customTextField( + 'Year', '', 'yr')), ], ), ], ), + const SizedBox( + height: 10, + ), + Divider( + thickness: 2, + ), + SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: SizedBox( + child: Row( + children: [ + const SizedBox( + width: 10, + ), + SizedBox( + width: 150, + height: 50, + child: + customDatTimePicker( + 'Date Received', + '', + 'date_received')), + const SizedBox( + width: 20, + ), + SizedBox( + width: 150, + height: 50, + child: + customDatTimePicker( + 'Date of Entry', + '', + 'date_of_entry')) + ], + ), + ), + ), const SizedBox( height: 30, ), @@ -660,70 +714,143 @@ class _PropertyAssessmentEditOfflinePage textAlign: TextAlign.start, ), ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - children: [ + SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row(children: [ Column( + crossAxisAlignment: + CrossAxisAlignment.start, children: [ - SizedBox( - width: 200, - child: FormBuilderDropdown< - Signatories>( - name: 'appraised_by', - decoration: - InputDecoration( - labelText: assessment - .appraisedbyName ?? - "", - labelStyle: - const TextStyle( - color: Colors - .black), - ), - autofocus: false, - items: signatories - .map((signatories) => - DropdownMenuItem( - value: + const Text('Name'), + Container( + padding: + EdgeInsets.fromLTRB( + 20, 0, 0, 0), + margin: const EdgeInsets + .fromLTRB( + 0, 10, 0, 0), + width: 250, + decoration: BoxDecoration( + border: Border.all( + color: Colors + .grey, // You can set the color here + width: + 0.9, // You can set the width here + ), + borderRadius: + BorderRadius.circular( + 5), // Set the border radius here + ), + child: SearchField( + itemHeight: 65, + hint: assessment + .appraisedbyName, + suggestions: signatories + .map((Signatories + signatories) => + SearchFieldListItem( + '${signatories.firstname} ${signatories.middlename} ${signatories.lastname}', + item: signatories, - child: Text( - '${signatories.firstname} ${signatories.middlename} ${signatories.lastname}'), - )) - .toList()), + child: + ListTile( + title: + Text( + '${signatories.firstname} ${signatories.middlename} ${signatories.lastname!}', + overflow: + TextOverflow.ellipsis, + textAlign: + TextAlign.center, + ), + ))) + .toList(), + + validator: + FormBuilderValidators + .required( + errorText: + "This field is required"), + searchStyle: + TextStyle(), + + ////agency suggestion tap + focusNode: + appraisedByFocus, + suggestionState: + Suggestion.expand, + onSuggestionTap: + (appraised) { + setState(() { + appraised_by = + "${appraised.item?.firstname} ${appraised.item?.middlename} ${appraised.item?.lastname}"; + appraised_by_designation = + appraised.item! + .designation; + }); + appraisedByFocus + .unfocus(); + }, + ), ), - Text('Name'), ], ), const SizedBox( - width: 15, + width: 10, ), Column( + crossAxisAlignment: + CrossAxisAlignment.start, children: [ - SizedBox( - width: 100, - child: - FormBuilderDateTimePicker( - name: 'app_date', - initialEntryMode: - DatePickerEntryMode - .calendarOnly, - initialValue: - DateTime.now(), - inputType: - InputType.date, - - initialTime: - const TimeOfDay( - hour: 8, - minute: 0), - // locale: const Locale.fromSubtags(languageCode: 'fr'), - ), - ), - Text('Date'), + Text('Designation'), + Container( + padding: + EdgeInsets.fromLTRB( + 10, 15, 10, 10), + margin: const EdgeInsets + .fromLTRB( + 0, 10, 0, 0), + width: 250, + height: 50, + decoration: + BoxDecoration( + border: Border.all( + color: Colors + .grey, // You can set the color here + width: + 0.9, // You can set the width here + ), + borderRadius: + BorderRadius.circular( + 5), // Set the border radius here + ), + child: Text( + appraised_by_designation + .toUpperCase(), + style: TextStyle( + fontSize: 15), + textAlign: + TextAlign.center, + )), ], ), - ], + const SizedBox( + width: 10, + ), + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text('Date'), + Container( + width: 100, + child: + customDatTimePicker( + '', + '', + 'app_date')), + ], + ), + ]), ), const SizedBox( height: 30, @@ -736,70 +863,141 @@ class _PropertyAssessmentEditOfflinePage fontWeight: FontWeight.bold), )), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - children: [ + SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row(children: [ Column( + crossAxisAlignment: + CrossAxisAlignment.start, children: [ - SizedBox( - width: 200, - child: FormBuilderDropdown< - Signatories>( - name: 'rec_approval', - decoration: - InputDecoration( - labelText: assessment - .recommendapprName ?? - "", - labelStyle: - const TextStyle( - color: Colors - .black), - ), - autofocus: false, - items: signatories - .map((signatories) => - DropdownMenuItem( - value: + const Text('Name'), + Container( + padding: + EdgeInsets.fromLTRB( + 20, 0, 0, 0), + margin: const EdgeInsets + .fromLTRB( + 0, 10, 0, 0), + width: 250, + decoration: BoxDecoration( + border: Border.all( + color: Colors + .grey, // You can set the color here + width: + 0.9, // You can set the width here + ), + borderRadius: + BorderRadius.circular( + 5), // Set the border radius here + ), + child: SearchField( + itemHeight: 65, + hint: assessment + .recommendapprName, + suggestions: signatories + .map((Signatories + signatories) => + SearchFieldListItem( + '${signatories.firstname} ${signatories.middlename} ${signatories.lastname}', + item: signatories, - child: Text( - '${signatories.firstname} ${signatories.middlename} ${signatories.lastname}'), - )) - .toList()), + child: + ListTile( + title: + Text( + '${signatories.firstname} ${signatories.middlename} ${signatories.lastname!}', + overflow: + TextOverflow.ellipsis, + textAlign: + TextAlign.center, + ), + ))) + .toList(), + + validator: + FormBuilderValidators + .required( + errorText: + "This field is required"), + searchStyle: + TextStyle(), + + ////agency suggestion tap + focusNode: recByFocus, + suggestionState: + Suggestion.expand, + onSuggestionTap: + (appraised) { + setState(() { + rec_by = + "${appraised.item?.firstname} ${appraised.item?.middlename} ${appraised.item?.lastname}"; + rec_by_designation = + appraised.item! + .designation; + }); + recByFocus.unfocus(); + }, + ), ), - Text('Name'), ], ), const SizedBox( - width: 15, + width: 10, ), Column( + crossAxisAlignment: + CrossAxisAlignment.start, children: [ - SizedBox( - width: 100, - child: - FormBuilderDateTimePicker( - name: 'rec_date', - initialEntryMode: - DatePickerEntryMode - .calendarOnly, - initialValue: - DateTime.now(), - inputType: - InputType.date, - - initialTime: - const TimeOfDay( - hour: 8, - minute: 0), - // locale: const Locale.fromSubtags(languageCode: 'fr'), - ), - ), - Text('Date'), + Text('Designation'), + Container( + padding: + EdgeInsets.fromLTRB( + 10, 15, 10, 10), + margin: const EdgeInsets + .fromLTRB( + 0, 10, 0, 0), + width: 250, + height: 50, + decoration: + BoxDecoration( + border: Border.all( + color: Colors + .grey, // You can set the color here + width: + 0.9, // You can set the width here + ), + borderRadius: + BorderRadius.circular( + 5), // Set the border radius here + ), + child: Text( + rec_by_designation + .toUpperCase(), + style: TextStyle( + fontSize: 15), + textAlign: + TextAlign.center, + )), ], ), - ], + const SizedBox( + width: 10, + ), + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text('Date'), + Container( + width: 100, + child: + customDatTimePicker( + '', + '', + 'rec_date')), + ], + ), + ]), ), const SizedBox( height: 30, @@ -812,42 +1010,126 @@ class _PropertyAssessmentEditOfflinePage fontWeight: FontWeight.bold, ), )), - Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ + SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row(children: [ Column( + crossAxisAlignment: + CrossAxisAlignment.start, children: [ - SizedBox( - width: 200, - child: FormBuilderDropdown< - Signatories>( - name: 'apprvd_by', - autofocus: false, - decoration: - InputDecoration( - labelText: assessment - .approvedbyName ?? - "", - labelStyle: - const TextStyle( - color: Colors - .black), - ), - items: signatories - .map((signatories) => - DropdownMenuItem( - value: + const Text('Name'), + Container( + padding: + EdgeInsets.fromLTRB( + 20, 0, 0, 0), + margin: const EdgeInsets + .fromLTRB( + 0, 10, 0, 0), + width: 250, + decoration: BoxDecoration( + border: Border.all( + color: Colors + .grey, // You can set the color here + width: + 0.9, // You can set the width here + ), + borderRadius: + BorderRadius.circular( + 5), // Set the border radius here + ), + child: SearchField( + itemHeight: 65, + hint: assessment + .approvedbyName, + suggestions: signatories + .map((Signatories + signatories) => + SearchFieldListItem( + '${signatories.firstname} ${signatories.middlename} ${signatories.lastname}', + item: signatories, - child: Text( - '${signatories.firstname} ${signatories.middlename} ${signatories.lastname}'), - )) - .toList()), + child: + ListTile( + title: + Text( + '${signatories.firstname} ${signatories.middlename} ${signatories.lastname!}', + overflow: + TextOverflow.ellipsis, + textAlign: + TextAlign.center, + ), + ))) + .toList(), + + validator: + FormBuilderValidators + .required( + errorText: + "This field is required"), + searchStyle: + TextStyle(), + + ////agency suggestion tap + focusNode: + apprvdByFocus, + suggestionState: + Suggestion.expand, + onSuggestionTap: + (appraised) { + setState(() { + approved_by = + "${appraised.item?.firstname} ${appraised.item?.middlename} ${appraised.item?.lastname}"; + approved_by_designation = + appraised.item! + .designation; + }); + apprvdByFocus + .unfocus(); + }, + ), ), - Text('Name'), ], ), - ], + const SizedBox( + width: 10, + ), + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text('Designation'), + Container( + padding: + EdgeInsets.fromLTRB( + 10, 15, 10, 10), + margin: const EdgeInsets + .fromLTRB( + 0, 10, 0, 0), + width: 250, + height: 50, + decoration: + BoxDecoration( + border: Border.all( + color: Colors + .grey, // You can set the color here + width: + 0.9, // You can set the width here + ), + borderRadius: + BorderRadius.circular( + 5), // Set the border radius here + ), + child: Text( + approved_by_designation + .toUpperCase(), + style: TextStyle( + fontSize: 15), + textAlign: + TextAlign.center, + )), + ], + ), + ]), ), const SizedBox( height: 50, @@ -860,17 +1142,17 @@ class _PropertyAssessmentEditOfflinePage fontWeight: FontWeight.bold, ), )), - SizedBox( + const SizedBox( height: 30, ), SizedBox( width: 500, - height: 100, + height: 50, child: SearchField( - itemHeight: 70, - suggestionDirection: - SuggestionDirection.up, - suggestions: state.memo + itemHeight: 200, + controller: + memorandaController, + suggestions: memoranda .map((Memoranda memoranda) => SearchFieldListItem( @@ -882,7 +1164,7 @@ class _PropertyAssessmentEditOfflinePage '${memoranda.memoranda}', overflow: TextOverflow - .ellipsis, + .visible, ), ), )) @@ -891,124 +1173,189 @@ class _PropertyAssessmentEditOfflinePage .required( errorText: "This field is required"), - hint: assessment.memoranda, - focusNode: focus, + // searchInputDecoration: + // normalTextFieldStyle("Memoranda", "") + // .copyWith( + // suffixIcon: + // const Icon(Icons.arrow_drop_down), + // contentPadding: EdgeInsets.symmetric( + // vertical: 15.0, horizontal: 16.0), + // border: OutlineInputBorder( + // borderRadius: BorderRadius.circular(10.0), + // borderSide: BorderSide( + // color: + // Colors.grey, // Adjust border color + // ), + // ), + // focusedBorder: OutlineInputBorder( + // borderRadius: BorderRadius.circular(10.0), + // borderSide: BorderSide( + // color: Colors + // .blue, // Adjust focused border color + // ), + // ), + // ), + focusNode: focuss, suggestionState: Suggestion.expand, + suggestionDirection: + SuggestionDirection.up, onSuggestionTap: (memoranda) { setState(() { - _memoranda = memoranda - .item!.memoranda!; + _memoranda = + memorandaController + .text; }); focus.unfocus(); }, )), - SizedBox( + Container( + alignment: Alignment.center, + padding: EdgeInsets.all(10), + child: Column( + children: [ + TextField( + controller: + memorandaController, + keyboardType: + TextInputType.multiline, + maxLines: 7, + decoration: InputDecoration( + focusedBorder: + OutlineInputBorder( + borderSide: BorderSide( + width: 1, + color: Colors + .redAccent)), + disabledBorder: + OutlineInputBorder( + borderSide: + const BorderSide( + width: 1, + color: Colors.grey, + ), + borderRadius: + BorderRadius + .circular(5), + ), + enabledBorder: + OutlineInputBorder( + borderSide: + const BorderSide( + color: Colors.grey, + width: 1, + ), + borderRadius: + BorderRadius + .circular(5), + ), + ), + ), + ], + ), + ), + const 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([]), + const Align( + alignment: Alignment.centerLeft, + child: Text( + 'NOTE: ', + style: TextStyle( + fontWeight: FontWeight.bold, ), - ), - ], - ), - SizedBox( + )), + const SizedBox( height: 30, ), - Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: [ - Text('Date Received:'), - SizedBox( - width: 150, - height: 20, - child: - FormBuilderDateTimePicker( - name: 'date_received', - initialEntryMode: - DatePickerEntryMode - .calendarOnly, - initialValue: - DateTime.now(), - inputType: InputType.date, - - initialTime: - const TimeOfDay( - hour: 8, minute: 0), - // locale: const Locale.fromSubtags(languageCode: 'fr'), - ), - ), - ], - ), SizedBox( - height: 30, - ), - Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: [ - Text( - 'Date of Entry in the Rec. of Ass. :'), - SizedBox( - width: 100, - height: 20, - child: - FormBuilderDateTimePicker( - name: 'date_of_entry', - initialEntryMode: - DatePickerEntryMode - .calendarOnly, - initialValue: - DateTime.now(), - inputType: InputType.date, - - initialTime: - const TimeOfDay( - hour: 8, minute: 0), - // locale: const Locale.fromSubtags(languageCode: 'fr'), + width: 400, + height: 50, + child: SearchField( + itemHeight: 200, + controller: noteController, + suggestions: note + .map((Memoranda note) => + SearchFieldListItem( + '${note.memoranda}', + item: + note, // Change: Use individual Memoranda object + child: ListTile( + title: Text( + '${note.memoranda}', + overflow: + TextOverflow + .visible, + ), + ), + )) + .toList(), + validator: FormBuilderValidators + .required( + errorText: + "This field is required"), + searchInputDecoration: + InputDecoration() + .copyWith( + suffixIcon: const Icon( + Icons.arrow_drop_down), ), - ), - ], - ), - SizedBox( - height: 30, - ), - Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: [ - Text('By:'), - SizedBox( - width: 150, - height: 20, - child: FormBuilderTextField( - name: 'by', - decoration: - InputDecoration(), - validator: - FormBuilderValidators - .compose([]), + focusNode: focus, + suggestionState: + Suggestion.expand, + suggestionDirection: + SuggestionDirection.up, + onSuggestionTap: (memoranda) { + setState(() { + _notes = + noteController.text; + }); + focus.unfocus(); + }, + )), + Container( + alignment: Alignment.center, + padding: EdgeInsets.all(10), + child: Column( + children: [ + TextField( + controller: noteController, + keyboardType: + TextInputType.multiline, + maxLines: 7, + decoration: InputDecoration( + focusedBorder: + OutlineInputBorder( + borderSide: BorderSide( + width: 1, + color: Colors + .redAccent)), + disabledBorder: + OutlineInputBorder( + borderSide: + const BorderSide( + width: 1, + color: Colors.grey, + ), + borderRadius: + BorderRadius + .circular(5), + ), + enabledBorder: + OutlineInputBorder( + borderSide: + const BorderSide( + color: Colors.grey, + width: 1, + ), + borderRadius: + BorderRadius + .circular(5), + ), + ), ), - ), - ], + ], + ), ), const SizedBox( height: 30, @@ -1039,125 +1386,55 @@ class _PropertyAssessmentEditOfflinePage ), onPressed: () { var ass = PropertyAssessment( - id: 1, - bldgapprDetailsId: - widget.tempId, - actualUse: - assessment.actualUse, - marketValue: '0.0', - assessmentLevel: '0.0', - assessedValue: "1.0", - taxable: isTaxable == true - ? '1' - : '0', - exempt: isExempt == true - ? '1' - : '0', - qtr: offlineBldgEditKey - .currentState! - .value['qtr'], - yr: offlineBldgEditKey - .currentState! - .value['yr'], - appraisedbyName: (offlineBldgEditKey - .currentState - ?.value[ - 'appraised_by'] - ?.firstname ?? - '') + - ' ' + - (offlineBldgEditKey - .currentState - ?.value[ - 'appraised_by'] - ?.middlename ?? - '') + - ' ' + - (offlineBldgEditKey - .currentState - ?.value[ - 'appraised_by'] - ?.lastname ?? - '') ?? - assessment - .appraisedbyName, - appraisedbyDate: - offlineBldgEditKey - .currentState! - .value['app_date'] - .toString(), - recommendapprName: (offlineBldgEditKey - .currentState - ?.value[ - 'rec_approval'] - ?.firstname ?? - '') + - ' ' + - (offlineBldgEditKey - .currentState - ?.value[ - 'rec_approval'] - ?.middlename ?? - '') + - ' ' + - (offlineBldgEditKey - .currentState - ?.value[ - 'rec_approval'] - ?.lastname ?? - '') ?? - assessment - .recommendapprName, - recommendapprDate: - offlineBldgEditKey - .currentState! - .value['rec_date'] - .toString(), - approvedbyName: (offlineBldgEditKey - .currentState - ?.value[ - 'apprvd_by'] - ?.firstname ?? - '') + - ' ' + - (offlineBldgEditKey - .currentState - ?.value[ - 'apprvd_by'] - ?.middlename ?? - '') + - ' ' + - (offlineBldgEditKey - .currentState - ?.value[ - 'apprvd_by'] - ?.lastname ?? - '') ?? - assessment - .approvedbyName, - memoranda: _memoranda, - swornstatementNo: - offlineBldgEditKey - .currentState! - .value[ - 'sworn_statement'], - dateReceived: - offlineBldgEditKey - .currentState! - .value[ - 'date_received'] - .toString(), - entryDateAssessment: - offlineBldgEditKey - .currentState! - .value[ - 'date_of_entry'] - .toString(), - entryDateBy: - offlineBldgEditKey - .currentState! - .value['by'], - ); + id: 1, + bldgapprDetailsId: + widget.tempId, + assessedById: "", + assessedByName: "", + dateCreated: '', + dateModified: '', + actualUse: + assessment.actualUse, + marketValue: '0.0', + assessmentLevel: '0.0', + assessedValue: "1.0", + taxable: isTaxable == true + ? '1' + : '0', + exempt: isExempt == true + ? '1' + : '0', + qtr: offlineBldgEditKey + .currentState! + .value['qtr'], + yr: offlineBldgEditKey + .currentState! + .value['yr'], + appraisedbyName: + appraised_by, + appraisedbyDate: offlineBldgEditKey + .currentState! + .value['app_date'] + .toString(), + recommendapprName: rec_by, + recommendapprDate: offlineBldgEditKey + .currentState! + .value['rec_date'] + .toString(), + approvedbyName: + approved_by, + memoranda: _memoranda, + note: _notes, + swornstatementNo: offlineBldgEditKey + .currentState! + .value['sworn_statement'], + dateReceived: offlineBldgEditKey.currentState!.value['date_received'].toString(), + entryDateAssessment: offlineBldgEditKey.currentState!.value['date_of_entry'].toString(), + entryDateBy: '', + genCode: '5th', + appraisedbyDesignation: '', + approvedbyDesignation: '', + recommendapprDesignation: ''); context .read< diff --git a/lib/screens/offline/passo/building/edit/property_owner_info_edit.dart b/lib/screens/offline/passo/building/edit/property_owner_info_edit.dart index 2d210c2..1ee697a 100644 --- a/lib/screens/offline/passo/building/edit/property_owner_info_edit.dart +++ b/lib/screens/offline/passo/building/edit/property_owner_info_edit.dart @@ -60,7 +60,10 @@ class _PropertyOwnerInfoEditOffline 'transaction_code': widget.faas.transCode, 'arp_td': widget.faas.tdn, 'pin': widget.faas.pin, - 'owner': widget.faas.owner, + 'fname': widget.faas.fname, + 'mname': widget.faas.mname, + 'lname': widget.faas.lname, + 'bday': widget.faas.bday, 'address': widget.faas.address, 'tel_no': widget.faas.telno, 'tin': widget.faas.tin, @@ -110,7 +113,31 @@ class _PropertyOwnerInfoEditOffline child: customTextField("Pin", "", 'pin')), ], ), - customTextField("Owner", "", 'owner'), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + children: [ + Expanded( + flex: 1, + child: customTextField( + "First Name", "", 'fname'), + ), + const SizedBox(width: 10.0), + Expanded( + // optional flex property if flex is 1 because the default flex is 1 + flex: 1, + child: customTextField( + "Middle Name", "", 'mname'), + ), + const SizedBox(width: 10.0), + Expanded( + // optional flex property if flex is 1 because the default flex is 1 + flex: 1, + child: customTextField( + "Last Name", "", 'lname'), + ) + ]), + customDatTimePicker("Birthday", "", "bday"), customTextField("Address", "", 'address'), Row( mainAxisAlignment: @@ -181,12 +208,13 @@ class _PropertyOwnerInfoEditOffline widget.faas.tdn, pin: offlineBldgEditKey.currentState!.value['pin'] ?? widget.faas.pin, - owner: offlineBldgEditKey - .currentState!.value['owner'] ?? - widget.faas.owner, - address: offlineBldgEditKey - .currentState!.value['address'] ?? - widget.faas.address, + fname: offlineBldgEditKey + .currentState!.value['fname'] ?? + widget.faas.fname, + mname: offlineBldgEditKey + .currentState!.value['mname'] ?? + widget.faas.mname, + address: offlineBldgEditKey.currentState!.value['address'] ?? widget.faas.address, telno: offlineBldgEditKey.currentState!.value['tel_no'] ?? widget.faas.telno, tin: offlineBldgEditKey.currentState!.value['tin'] ?? widget.faas.tin, adminUser: offlineBldgEditKey.currentState!.value['benificiary'] ?? widget.faas.adminUser, diff --git a/lib/screens/offline/passo/building/edit/structural_materials_edit.dart b/lib/screens/offline/passo/building/edit/structural_materials_edit.dart index 8578340..c7d2b4d 100644 --- a/lib/screens/offline/passo/building/edit/structural_materials_edit.dart +++ b/lib/screens/offline/passo/building/edit/structural_materials_edit.dart @@ -47,13 +47,13 @@ class _StructuralMaterialsPageEditOffline StructuralMaterialOfflineState>(listener: (context, state) { if (state is SpecificStructuralMaterialLoaded) { setState(() { - foundation = state.materials.foundation?.split(', ') ?? []; - column = state.materials.columns?.split(', ') ?? []; - beam = state.materials.beams?.split(', ') ?? []; - truss_framing = state.materials.trussFraming?.split(', ') ?? []; - roof = state.materials.roof?.split(', ') ?? []; - flooring = state.materials.flooring?.split(', ') ?? []; - walls = state.materials.walls?.split(', ') ?? []; + // foundation = state.materials.foundation?.split(', ') ?? []; + // column = state.materials.columns?.split(', ') ?? []; + // beam = state.materials.beams?.split(', ') ?? []; + // truss_framing = state.materials.trussFraming?.split(', ') ?? []; + // roof = state.materials.roof?.split(', ') ?? []; + // flooring = state.materials.flooring?.split(', ') ?? []; + // walls = state.materials.walls?.split(', ') ?? []; // Update other local state variables here if needed }); } @@ -74,7 +74,7 @@ class _StructuralMaterialsPageEditOffline child: const Text( 'STRUCTURAL MATERIALS', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18), - textAlign: TextAlign.left, + textAlign: TextAlign.center, ), ), Row( @@ -114,7 +114,8 @@ class _StructuralMaterialsPageEditOffline }, options: const ['Reinforced Concrete', 'Plain Concrete'], selectedValues: foundation, - whenEmpty: 'Select Foundations', + whenEmpty: + state.materials.foundation ?? 'Select Foundations', ), ), ), @@ -155,7 +156,7 @@ class _StructuralMaterialsPageEditOffline }, options: const ['Steel', 'Reinforced Concrete', 'Wood'], selectedValues: column, - whenEmpty: 'Select Column/s', + whenEmpty: state.materials.columns ?? 'Select Column/s', ), ), ), @@ -196,7 +197,7 @@ class _StructuralMaterialsPageEditOffline }, options: const ['Steel', 'Reinforced Concrete', 'Wood'], selectedValues: beam, - whenEmpty: 'Select Beam/s', + whenEmpty: state.materials.beams ?? 'Select Beam/s', ), ), ), @@ -237,7 +238,8 @@ class _StructuralMaterialsPageEditOffline }, options: const ['Steel', 'Wood'], selectedValues: truss_framing, - whenEmpty: 'Select Truss Framing/s', + whenEmpty: state.materials.trussFraming ?? + 'Select Truss Framing/s', ), ), ), @@ -287,7 +289,7 @@ class _StructuralMaterialsPageEditOffline 'Nipa/Anahaw/Cogon' ], selectedValues: roof, - whenEmpty: 'Select Roof/s', + whenEmpty: state.materials.roof ?? 'Select Roof/s', ), ), ), @@ -334,7 +336,8 @@ class _StructuralMaterialsPageEditOffline 'Tiles' ], selectedValues: flooring, - whenEmpty: 'Select Flooring/s', + whenEmpty: + state.materials.flooring ?? 'Select Flooring/s', ), ), ), @@ -384,7 +387,8 @@ class _StructuralMaterialsPageEditOffline 'Bamboo' ], selectedValues: walls, - whenEmpty: 'Select Walls & Partition/s', + whenEmpty: + state.materials.walls ?? 'Select Walls & Partition/s', ), ), ), diff --git a/lib/screens/offline/passo/building_home_offline.dart b/lib/screens/offline/passo/building_home_offline.dart index d0499dd..6146d13 100644 --- a/lib/screens/offline/passo/building_home_offline.dart +++ b/lib/screens/offline/passo/building_home_offline.dart @@ -1,8 +1,12 @@ +import 'dart:convert'; +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_progress_hud/flutter_progress_hud.dart'; import 'package:flutter_speed_dial/flutter_speed_dial.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:intl/intl.dart'; import 'package:unit2/bloc/offline/offline_passo/admin/barangay_admin/barangay_admin_bloc.dart'; import 'package:unit2/bloc/offline/offline_passo/admin/class_components_admin.dart/class_components_admin_bloc.dart'; import 'package:unit2/bloc/offline/offline_passo/admin/memoranda/memoranda_admin_bloc.dart'; @@ -19,7 +23,12 @@ import 'package:unit2/bloc/offline/offline_passo/building/location/location_bloc import 'package:unit2/bloc/offline/offline_passo/building/structural_materials_offline.dart/structural_material_offline_bloc.dart'; import 'package:unit2/model/offline/offline_profile.dart'; import 'package:unit2/model/passo/additional_items.dart'; +import 'package:unit2/model/passo/bldg_loc.dart'; +import 'package:unit2/model/passo/building_and_structure.dart'; +import 'package:unit2/model/passo/building_details.dart'; +import 'package:unit2/model/passo/land_ref.dart'; import 'package:unit2/model/passo/property_appraisal.dart'; +import 'package:unit2/model/passo/property_assessment.dart'; import 'package:unit2/model/passo/property_info.dart'; import 'package:unit2/screens/offline/passo/building/add/add_building.dart'; import 'package:unit2/screens/offline/passo/building/edit/edit_building.dart'; @@ -41,7 +50,14 @@ import '../../../bloc/offline/offline_passo/land/land_property_owner_bloc/land_p import '../../../bloc/offline/offline_passo/land/land_property_signture/land_property_signature_bloc.dart'; import '../../../bloc/offline/offline_passo/land/other_improvements/other_improvements_bloc.dart'; import '../../../bloc/offline/offline_passo/land/value_adjustment/value_adjustment_bloc.dart'; +import '../../../model/passo/general_description.dart'; +import '../../../model/passo/structureMaterial.dart'; +import '../../../sevices/offline/offline_passo/admin/sql_services/sql_services.dart'; import '../../../utils/alerts.dart'; +import 'package:http/http.dart'; +import 'package:date_format/date_format.dart'; + +import '../../../utils/urls.dart'; class BuildingHomeOffline extends StatelessWidget { final OfflineProfile offlineProfile; @@ -63,6 +79,267 @@ class BuildingHomeOffline extends StatelessWidget { myBloc.add(LoadLandPropertyOwner()); } + void uploadBldg() async { + List propertyOwner = + await SQLServices.instance.readAllBldgOwner(); + for (PropertyInfo infos in propertyOwner) { + //General Description + List> genDesc = + await SQLServices.instance.getGeneralDescription(infos.id); + List genDescList = + genDesc.map((map) => GeneralDesc.fromJson2(map)).toList(); + + GeneralDesc firstGenDesc = genDescList.first; + + //Location + List> loc = + await SQLServices.instance.getLandRef(infos.id); + + List locList = + loc.map((map) => BldgLoc.fromJson2(map)).toList(); + + BldgLoc firstLoc = locList.first; + + //Land Refeernce + List> landRef = + await SQLServices.instance.getLocation(infos.id); + + List landRefList = + landRef.map((map) => LandRef.fromJson2(map)).toList(); + + LandRef firstLandRef = landRefList.first; + + //Assessment + List> assessment = + await SQLServices.instance.getBldgAssessment(infos.id); + + List assessList = + assessment.map((map) => PropertyAssessment.fromJson2(map)).toList(); + + PropertyAssessment firstAssess = assessList.first; + + //Structural Materials + List> strucMat = + await SQLServices.instance.getStructuralMaterials(infos.id); + List strcuMatList = + strucMat.map((map) => StructureMaterials.fromJson2(map)).toList(); + + StructureMaterials firstStructMat = strcuMatList.first; + + //Additional Items + List> addItems = + await SQLServices.instance.getAdditionalItems(infos.id); + List addItemsList = + addItems.map((map) => AdditionalItems.fromJson(map)).toList(); + + //BLDG Structure + List> bldgStructure = + await SQLServices.instance.getBuildingAndStructure(infos.id); + List bldgStructureList = + bldgStructure.map((map) => BldgAndStructure.fromJson(map)).toList(); + + DateTime dateIssued = DateTime.parse(firstGenDesc.dateIssued!); + + final details = { + "assessed_by_id": offlineProfile.id.toString(), + "assessed_by_name": offlineProfile.firstName, + "date_created": "{{currentTimestamp}}", + "date_modified": "{{currentTimestamp}}", + "trans_code": infos.transCode, + "tdn": infos.tdn, + "pin": infos.pin, + "fname": infos.fname, + "mname": infos.mname, + "lname": infos.lname, + "bday": infos.bday, + "address": infos.address, + "telno": infos.telno, + "tin": infos.tin, + "admin_user": infos.adminUser, + "admin_address": infos.adminAddress, + "admin_telno": infos.adminTelno, + "admin_tin": infos.adminTin, + "faas_type": infos.faasType, + "gen_code": "5TH", + "bldgappr_location.date_created": "{{currentTimestamp}}", + "bldgappr_location.date_modified": "{{currentTimestamp}}", + "bldgappr_location.street": firstLoc.street, + "bldgappr_location.barangay": firstLoc.barangay, + "bldgappr_location.municipality": firstLoc.municipality, + "bldgappr_location.province": firstLoc.province, + "bldgappr_location.gen_code": "5TH", + "bldgappr_landref.date_created": "{{currentTimestamp}}", + "bldgappr_landref.date_modified": "{{currentTimestamp}}", + "bldgappr_landref.owner": firstLandRef.owner, + "bldgappr_landref.cloa_no": firstLandRef.cloaNo, + "bldgappr_landref.lot_no": firstLandRef.lotNo, + "bldgappr_landref.tdn": firstLandRef.tdn, + "bldgappr_landref.area": firstLandRef.area, + "bldgappr_landref.survey_no": firstLandRef.surveyNo, + "bldgappr_landref.blk_no": firstLandRef.blkNo, + "bldgappr_landref.gen_code": "5TH", + "bldgappr_generaldesc.date_created": "{{currentTimestamp}}", + "bldgappr_generaldesc.date_modified": "{{currentTimestamp}}", + "bldgappr_generaldesc.bldg_kind": firstGenDesc.bldgKind, + "bldgappr_generaldesc.struc_type": firstGenDesc.strucType, + "bldgappr_generaldesc.bldg_permit": firstGenDesc.bldgPermit, + "bldgappr_generaldesc.date_issued": DateFormat("yyyy-MM-dd") + .format(DateTime.parse(firstGenDesc.dateIssued!)), + "bldgappr_generaldesc.cct": null, + "bldgappr_generaldesc.cert_completion_issued": + DateFormat("yyyy-MM-dd") + .format(DateTime.parse(firstGenDesc.certCompletionIssued!)), + "bldgappr_generaldesc.cert_ocscupancy_issued": + DateFormat("yyyy-MM-dd") + .format(DateTime.parse(firstGenDesc.certOccupancyIssued!)), + "bldgappr_generaldesc.date_completed": DateFormat("yyyy-MM-dd") + .format(DateTime.parse(firstGenDesc.dateCompleted!)), + "bldgappr_generaldesc.date_occupied": DateFormat("yyyy-MM-dd") + .format(DateTime.parse(firstGenDesc.dateOccupied!)), + "bldgappr_generaldesc.bldg_age": firstGenDesc.bldgAge, + "bldgappr_generaldesc.no_storeys": firstGenDesc.noStoreys, + "bldgappr_generaldesc.area_1stfloor": firstGenDesc.area1Stfloor, + "bldgappr_generaldesc.area_2ndfloor": firstGenDesc.area2Ndfloor, + "bldgappr_generaldesc.area_3rdfloor": firstGenDesc.area3Rdfloor, + "bldgappr_generaldesc.area_4thfloor": firstGenDesc.area4Thfloor, + "bldgappr_generaldesc.total_floor_area": firstGenDesc.totalFloorArea, + "bldgappr_generaldesc.floor_sketch": null, + "bldgappr_generaldesc.actual_use": firstGenDesc.actualUse, + "bldgappr_generaldesc.unit_value": firstGenDesc.unitValue, + "bldgappr_generaldesc.gen_code": "5TH", + "bldgappr_struct_materials.date_created": "{{currentTimestamp}}", + "bldgappr_struct_materials.date_modified": "{{currentTimestamp}}", + "bldgappr_struct_materials.foundation": firstStructMat.foundation, + "bldgappr_struct_materials.columns": firstStructMat.columns, + "bldgappr_struct_materials.beams": firstStructMat.beams, + "bldgappr_struct_materials.truss_framing": + firstStructMat.trussFraming, + "bldgappr_struct_materials.roof": firstStructMat.roof, + "bldgappr_struct_materials.flooring": firstStructMat.flooring, + "bldgappr_struct_materials.walls": firstStructMat.walls, + "bldgappr_struct_materials.others": firstStructMat.others, + "bldgappr_struct_materials.gen_code": "5TH", + "bldgappr_property_assessment.date_created": "{{currentTimestamp}}", + "bldgappr_property_assessment.date_modified": "{{currentTimestamp}}", + "bldgappr_property_assessment.actual_use": firstAssess.actualUse, + "bldgappr_property_assessment.market_value": firstAssess.marketValue, + "bldgappr_property_assessment.assessment_level": + firstAssess.assessmentLevel, + "bldgappr_property_assessment.assessed_value": + firstAssess.assessedValue, + "bldgappr_property_assessment.taxable": firstAssess.taxable, + "bldgappr_property_assessment.exempt": firstAssess.exempt, + "bldgappr_property_assessment.qtr": firstAssess.qtr, + "bldgappr_property_assessment.yr": firstAssess.yr, + "bldgappr_property_assessment.appraisedby_name": + firstAssess.appraisedbyName, + "bldgappr_property_assessment.appraisedby_date": + DateFormat("yyyy-MM-dd") + .format(DateTime.parse(firstAssess.appraisedbyDate!)), + "bldgappr_property_assessment.recommendappr_name": + firstAssess.recommendapprName, + "bldgappr_property_assessment.recommendappr_date": + DateFormat("yyyy-MM-dd") + .format(DateTime.parse(firstAssess.recommendapprDate!)), + "bldgappr_property_assessment.approvedby_name": + firstAssess.approvedbyName, + "bldgappr_property_assessment.approvedby_date": null, + "bldgappr_property_assessment.memoranda": firstAssess.memoranda, + "bldgappr_property_assessment.swornstatement_no": + firstAssess.swornstatementNo, + "bldgappr_property_assessment.date_received": DateFormat("yyyy-MM-dd") + .format(DateTime.parse(firstAssess.dateReceived!)), + "bldgappr_property_assessment.entry_date_assessment": null, + "bldgappr_property_assessment.entry_date_by": DateFormat("yyyy-MM-dd") + .format(DateTime.parse(firstAssess.entryDateAssessment!)), + "bldgappr_property_assessment.gen_code": "5TH", + "bldgappr_rec_supersededass.date_created": "{{currentTimestamp}}", + "bldgappr_rec_supersededass.date_modified": "{{currentTimestamp}}", + "bldgappr_rec_supersededass.pin": null, + "bldgappr_rec_supersededass.tdn": null, + "bldgappr_rec_supersededass.total_assval": null, + "bldgappr_rec_supersededass.owner": null, + "bldgappr_rec_supersededass.effectivity_ass": null, + "bldgappr_rec_supersededass.page_no": null, + "bldgappr_rec_supersededass.total_marketval": null, + "bldgappr_rec_supersededass.total_area": null, + "bldgappr_rec_supersededass.rec_assessment": null, + "bldgappr_rec_supersededass.rec_taxmapping": null, + "bldgappr_rec_supersededass.rec_records": null, + "bldgappr_rec_supersededass.date": null, + "bldgappr_rec_supersededass.gen_code": "5TH" + }; + + // print(details); + + String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z"; + String xClientKeySecret = "unitcYqAN7GGalyz"; + Map headers = { + 'Content-Type': 'application/json; charset=UTF-8', + 'X-Client-Key': xClientKey, + 'X-Client-Secret': xClientKeySecret + }; + + Response details_response = await post( + Uri.parse( + 'http://${Url.instance.host()}/api/rptass_app/bldgappr_details/'), + headers: headers, + body: jsonEncode(details)); + + final datas = json.decode(details_response.body); + for (AdditionalItems items in addItemsList) { + final addItems = AdditionalItems( + id: 1, + bldgapprDetailsId: datas['data']['id'], + classId: items.classId, + className: items.className, + structType: items.structType, + unitValue: items.unitValue, + baseUnitValue: items.baseUnitValue, + area: items.area, + marketValue: items.marketValue, + depreciationRate: items.depreciationRate, + adjustedMarketVal: items.adjustedMarketVal, + amtDepreciation: items.amtDepreciation, + painted: items.painted, + secondhand: items.secondhand, + paintedUnitval: items.paintedUnitval, + secondhandUnitval: items.secondhandUnitval, + actualUse: items.actualUse, + genCode: "5TH"); + Response add_response = await post( + Uri.parse( + 'http://${Url.instance.host()}/api/rptass_app/additional_items/'), + headers: headers, + body: jsonEncode(addItems)); + } + for (BldgAndStructure structure in bldgStructureList) { + final bldgStruc = BldgAndStructure( + id: 1, + bldgapprDetailsId: datas['data']['id'], + bldgArea: structure.bldgArea, + bldgType: structure.bldgType, + structType: structure.structType, + description: structure.description, + actualUse: structure.actualUse, + floorCount: structure.floorCount, + unitValue: structure.unitValue, + depRate: structure.depRate, + marketValue: structure.marketValue, + depAmount: structure.depAmount, + adjustedMarketValue: structure.adjustedMarketValue, + genCode: '5TH', + buccPercentage: structure.buccPercentage); + print(bldgStruc.toJson()); + Response response = await post( + Uri.parse( + 'http://${Url.instance.host()}/api/rptass_app/bldgappr_structure/'), + headers: headers, + body: jsonEncode(bldgStruc)); + } + } + } + return Scaffold( body: ProgressHUD( backgroundColor: Colors.black87, @@ -85,7 +362,8 @@ class BuildingHomeOffline extends StatelessWidget { context, index, deleteItem, - state.propertyInfos.length); + state.propertyInfos.length, + offlineProfile); }, ), ), @@ -260,15 +538,17 @@ class BuildingHomeOffline extends StatelessWidget { color: primary, ), label: 'Upload/Sync', - onTap: () {}, + onTap: () { + uploadBldg(); + }, ), ]), ); } } -Card _listCard( - PropertyInfo property_info, context, index, deleteItem, bldgLength) { +Card _listCard(PropertyInfo property_info, context, index, deleteItem, + bldgLength, offlineProfile) { return Card( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), @@ -338,12 +618,17 @@ Card _listCard( ..add(LoadAdditionalItemsEdit( items: const [], id: property_info.id!))), + BlocProvider( + create: (context) => BuildingAndStructureBloc() + ..add(LoadBuildingAndStructureEdit( + bldgAndStructure: const [], + id: property_info.id!))), ], child: EditBuildingOffline( - index: index, - faas: property_info, - title: 'Bldg & Structure Edit', - ), + index: index, + faas: property_info, + title: 'Bldg & Structure Edit', + offlineProfile: offlineProfile), ); })); }, @@ -373,7 +658,7 @@ Card _listCard( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - '${property_info.owner}', + '${property_info.fname} ${property_info.mname} ${property_info.lname}', style: const TextStyle( fontSize: 14, fontWeight: FontWeight.bold, diff --git a/lib/screens/offline/passo/land/add/land_appraisal.dart b/lib/screens/offline/passo/land/add/land_appraisal.dart index ff2ac45..cc43ad9 100644 --- a/lib/screens/offline/passo/land/add/land_appraisal.dart +++ b/lib/screens/offline/passo/land/add/land_appraisal.dart @@ -6,7 +6,6 @@ import 'package:intl/intl.dart'; import 'package:unit2/bloc/passo/land/land_appraisal/land_appraisal_bloc.dart'; import 'package:unit2/model/passo/land_appr.dart'; import 'package:unit2/screens/offline/passo/land/add/AddLandAppraisal.dart'; -import 'package:unit2/screens/passo/Land/add_land/AddLandAppraisal.dart'; import 'package:unit2/utils/alerts.dart'; import 'package:unit2/utils/text_container.dart'; import 'package:unit2/widgets/error_state.dart'; diff --git a/lib/screens/offline/passo/land/add/other_improvement.dart b/lib/screens/offline/passo/land/add/other_improvement.dart index d299af7..79c9ab8 100644 --- a/lib/screens/offline/passo/land/add/other_improvement.dart +++ b/lib/screens/offline/passo/land/add/other_improvement.dart @@ -4,7 +4,6 @@ import 'package:flutter_progress_hud/flutter_progress_hud.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:unit2/screens/offline/passo/land/add/AddOtherImprovementModal.dart'; -import 'package:unit2/screens/passo/Land/add_land/AddOtherImprovementModal.dart'; import 'package:unit2/utils/alerts.dart'; import 'package:unit2/widgets/passo/custom_button.dart'; diff --git a/lib/screens/passo/Building/add_building.dart b/lib/screens/passo/Building/add_building.dart deleted file mode 100644 index fc000c8..0000000 --- a/lib/screens/passo/Building/add_building.dart +++ /dev/null @@ -1,301 +0,0 @@ -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:fluttertoast/fluttertoast.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -import 'package:unit2/bloc/passo/bulding/class_components/class_components_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/property_appraisal/property_appraisal_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/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/general_description.dart'; -import 'package:unit2/model/passo/land_ref.dart'; -import 'package:unit2/model/passo/property_appraisal.dart'; -import 'package:unit2/model/passo/property_info.dart'; -import 'package:unit2/model/passo/structural_materials_ii.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'; -import 'package:unit2/utils/text_container.dart'; -import 'package:unit2/widgets/error_state.dart'; - -GlobalKey formKey = GlobalKey(); - -class AddBuilding extends StatefulWidget { - Function triggerBlocEvent; - AddBuilding(this.triggerBlocEvent); - @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; - - Future _loadTempId() async { - final prefs = await SharedPreferences.getInstance(); - setState(() { - tempId = (prefs.getInt('tempid') ?? 0); - }); - } - - void PrevBtn() { - setState(() { - activeStep--; - }); - } - - void NextBtn() { - setState(() { - activeStep++; - }); - } - - void onPutStructuralMaterials() { - if (activeStep < upperBound) { - setState(() { - activeStep++; - }); - } - // var strucMaterials = StructureMaterialsII( - // foundation: _foundations.getSelectedAsString().split(","), - // columns: _coumns.getSelectedAsString().split(","), - // beams: _beams.getSelectedAsString().split(","), - // trussFraming: - // _trussframing.getSelectedAsString().split(","), - // roof: _roof.getSelectedAsString().split(","), - // flooring: _flooring.getSelectedAsString().split(","), - // walls: _walls.getSelectedAsString().split(",")); - } - - void onPutPropertyAppraisal() {} - void bldgPrevBtn() { - if (activeStep > 0) { - setState(() { - activeStep--; - }); - } - } - - @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) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - if (state is PropertyInfoErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - if (state is ShowGenDescErrorAlertState || - state is ShowLandRefErrorAlertState || - state is ShowStrucMatErrorAlertState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - Fluttertoast.showToast( - msg: "Slow internet connection, please try again!"); - } - if (state is ShowLandRefSuccessAlertState || - state is ShowGenDescSuccessAlertState || - state is ShowStrucMatSuccessAlertState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - NextBtn(); - } - }, builder: (context, state) { - if (state is PropertyInfoLoading || - state is PropertyInfoLoaded || - state is PropertyInfoErrorState || - state is ShowBldgLocErrorAlertState || - state is ShowGenDescErrorAlertState || - state is ShowLandRefErrorAlertState || - state is ShowStrucMatErrorAlertState || - state is ShowBldgLocSuccessAlertState || - state is ShowLandRefSuccessAlertState || - state is ShowGenDescSuccessAlertState || - state is ShowStrucMatSuccessAlertState) { - return BlocConsumer( - listener: ( - context, - state, - ) { - if (state is UnitConstructLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - if (state is UnitConstructLoaded || - state is UnitConstructErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, - builder: (context, state) { - if (state is UnitConstructLoaded) { - final unit = state.unit; - return BlocConsumer( - listener: ( - context, - state, - ) { - if (state is ClassComponentLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - if (state is ClassComponentLoaded || - state is ClassComponentErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, - builder: (context, state) { - if (state is ClassComponentLoaded) { - final classes = state.classes; - - return Column( - children: [ - NumberStepper( - numbers: [1, 2, 3, 4, 5, 6, 7], - stepPadding: 5, - activeStepColor: primary, - numberStyle: TextStyle(color: Colors.white), - lineColor: primary, - // activeStep property set to activeStep variable defined above. - activeStep: activeStep, - activeStepBorderColor: Colors.white, - activeStepBorderWidth: 1, - // This ensures step-tapping updates the activeStep. - onStepReached: (index) { - setState(() { - activeStep = index; - }); - }, - enableStepTapping: false, - ), - Expanded( - child: StatefulBuilder(builder: - (BuildContext context, - StateSetter setState) { - return FormBuilder( - key: formKey, - onChanged: () { - formKey.currentState?.save(); - }, - autovalidateMode: AutovalidateMode.disabled, - child: Container( - child: content( - unit, - classes, - PrevBtn, - NextBtn, - ), - ), - ); - }), - ), - ], - ); - } - if (state is ClassComponentErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context - .read() - .add(LoadClassComponents()); - }, - ); - } - return Container(); - }, - ); - } - if (state is UnitConstructErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context - .read() - .add(LoadUnitConstruct()); - }, - ); - } - return Container(); - }, - ); - } - - return Container(); - })), - ); - } - - Widget content(unit, List classes, PrevBtn, NextBtn) { - switch (activeStep) { - case 0: - return PropertyInfoPage(NextBtn); - - case 1: - return BldgLocationLandrefPage(PrevBtn, NextBtn); - - case 2: - return GeneralDescriptionPage(unit, NextBtn, PrevBtn); - - case 3: - return StructuralMaterialsPage(PrevBtn, NextBtn); - - case 4: - return AdditionalItemPage(unit, classes, PrevBtn, NextBtn); - - case 5: - return PropertyAppraisalPage(NextBtn, PrevBtn); - - case 6: - return PropertyAssessmentPage(onSAveAll); - - default: - return Text("Property Info"); - } - } - - void onSAveAll() { - Navigator.of(context).pop(); - widget.triggerBlocEvent(); - } -} diff --git a/lib/screens/passo/Building/add_building_components/AddExtraItems.dart b/lib/screens/passo/Building/add_building_components/AddExtraItems.dart deleted file mode 100644 index 37a0e6d..0000000 --- a/lib/screens/passo/Building/add_building_components/AddExtraItems.dart +++ /dev/null @@ -1,599 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_form_builder/flutter_form_builder.dart'; -import 'package:fluttertoast/fluttertoast.dart'; -import 'package:form_builder_validators/form_builder_validators.dart'; -import 'package:intl/intl.dart'; -import 'package:searchfield/searchfield.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -import 'package:unit2/bloc/passo/bulding/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'; -import 'package:unit2/utils/text_container.dart'; -import 'package:unit2/widgets/error_state.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(); - bool isPainted = false; - bool isSecondHand = false; - TextEditingController textEditingController = TextEditingController(); - double _unitBase = 0; - int _areaValue = 0; - final double _depValue = 0; - double _unitValue = 0; - String _className = ""; - int _classId = 0; - String _structureType = ""; - bool _withoutBUCC = false; - int _notPaintedUnitVal = 0; - int _secondHandUnitVal = 0; - - BoxDecoration box1() { - return const BoxDecoration(boxShadow: [ - BoxShadow(color: Colors.black12, spreadRadius: 5, blurRadius: 5) - ], color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(3))); - } - - double _amountofDepreciation(unitVal, unitBase, area, depreciation) { - return ((unitVal * unitBase) * area) * depreciation; - } - - double _totalMarketValue(unitVal, unitBase, area, depreciation, withBUCC, - className, painted, secondHand, paintedUnitVal, secondhandUntVal) { - if (withBUCC == false) { - if (painted == true || secondHand == true) { - final deductions = (paintedUnitVal + secondhandUntVal) / 100; - - print(deductions); - return (((unitVal - deductions) * unitBase) * area); - } else { - return ((unitVal * unitBase) * area); - } - } else { - return (unitVal * area); - } - } - - @override - Widget build(BuildContext context) { - return BlocBuilder( - buildWhen: (previous, current) { - return false; - }, builder: (context, state) { - if (state is ShowAddItemsScreen) { - return FormBuilder( - key: formKey, - onChanged: () { - formKey.currentState?.save(); - }, - autovalidateMode: AutovalidateMode.disabled, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - height: 800, - child: SingleChildScrollView( - padding: const EdgeInsets.all(8.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - 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), - const Text('Building is not painted?'), - const SizedBox(height: 5), - Container( - child: Row( - children: [ - Checkbox( - value: isPainted, - onChanged: (bool? value) { - setState(() { - isPainted = value!; - if (value == false) { - _notPaintedUnitVal = 0; - } else { - _notPaintedUnitVal = 10; - } - }); - }, - ), - const SizedBox(width: 10), - Container( - height: 40.0, - width: 100, - decoration: BoxDecoration( - color: Colors.white, - border: Border.all( - color: Colors.grey, - width: 1.0, - ), - borderRadius: - BorderRadius.circular(5.0), - ), - child: Align( - alignment: Alignment.center, - child: Text(' - ' + - _notPaintedUnitVal.toString() + - '%')), - ), - ], - ), - ), - const SizedBox(height: 10), - const Text('Uses second hand materials?'), - const SizedBox(height: 5), - Container( - child: Row( - children: [ - Checkbox( - value: isSecondHand, - onChanged: (bool? value) { - setState(() { - isSecondHand = value!; - if (isSecondHand == false) { - _secondHandUnitVal = 0; - formKey.currentState!.patchValue( - {'secondHandMat': '0'}); - } else { - _secondHandUnitVal = 5; - formKey.currentState!.patchValue( - {'secondHandMat': '5'}); - } - }); - }, - ), - const SizedBox(width: 10), - Row( - children: [ - SizedBox( - height: 40, - width: 100, - child: FormBuilderTextField( - enabled: isSecondHand, - name: 'secondHandMat', - textAlign: TextAlign.center, - decoration: normalTextFieldStyle( - "Unit Value", ""), - validator: - FormBuilderValidators.compose( - []), - onChanged: (value) { - // Check if the value is not null before parsing to double - if (value != null && - value.isNotEmpty) { - setState(() { - _secondHandUnitVal = - int.parse(value); - }); - } else { - // Handle the case when the value is empty or null - // For example, set _secondHandUnitVal to a default value or show an error message. - } - }, - ), - ), - const SizedBox( - height: 40, - width: 40, - child: Center( - child: Text( - '%', - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold), - ), - ), - ) - ], - ), - ], - ), - ), - ], - ), - ), - - const SizedBox(height: 10), - const Text('Market Value'), - const SizedBox(height: 5), - Container( - height: 45.0, - width: double.infinity, - decoration: BoxDecoration( - color: Colors.white, - border: Border.all( - color: Colors.grey, - width: 1.0, - ), - borderRadius: BorderRadius.circular(5.0), - ), - child: Align( - alignment: Alignment.center, - child: Text(NumberFormat.currency( - locale: 'en-PH', symbol: "₱") - .format(_totalMarketValue( - _unitValue, - _unitBase, - _areaValue, - _depValue, - _withoutBUCC, - _className, - isPainted, - isSecondHand, - _notPaintedUnitVal, - _secondHandUnitVal)))), - ), - const SizedBox(height: 10), - Row( - children: [ - Container( - width: 120, - height: 60, - padding: const EdgeInsets.all(8.0), - child: ElevatedButton( - onPressed: () async { - try { - final tempID = - await SharedPreferences.getInstance(); - var itemss = AdditionalItems( - id: 1, - bldgapprDetailsId: - tempID.getInt('tempid')! - 1, - classId: _classId, - className: _className, - structType: _structureType, - unitValue: _withoutBUCC == true - ? 0 - : _unitValue, - baseUnitValue: _unitBase, - area: _areaValue, - marketValue: (_unitValue * _unitBase) * - _areaValue, - depreciationRate: _depValue, - adjustedMarketVal: _totalMarketValue( - _unitValue, - _unitBase, - _areaValue, - _depValue, - _withoutBUCC, - _className, - isPainted, - isSecondHand, - _notPaintedUnitVal, - _secondHandUnitVal), - actualUse: 'Test', - amtDepreciation: _amountofDepreciation( - _unitValue, - _unitBase, - _areaValue, - _depValue, - ), - painted: isPainted == true ? '1' : '0', - secondhand: - isSecondHand == true ? '1' : '0', - paintedUnitval: '1', - secondhandUnitval: '1'); - - context - .read() - .add(AddAdditionalItems(items: itemss)); - } catch (e) { - Fluttertoast.showToast( - msg: - "Slow internet connection, please try again!", - ); - } - }, - style: ElevatedButton.styleFrom( - primary: Colors.black, - ), - child: const Text("Submit"), - ), - ), - const SizedBox( - width: - 5), // Use SizedBox for horizontal spacing in a Row - Container( - width: 120, - height: 60, - padding: const EdgeInsets.all(8.0), - child: ElevatedButton( - onPressed: () { - context - .read() - .add(const LoadAdditionalItems()); - }, - style: ElevatedButton.styleFrom( - primary: Colors.black, - ), - child: const Text("Cancel"), - ), - ), - ], - ) - ], - ), - ), - ))); - } - if (state is AdditionalItemsErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context.read().add(LoadAdditionalItems()); - }, - ); - } - 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 deleted file mode 100644 index dd0f133..0000000 --- a/lib/screens/passo/Building/add_building_components/additional_items.dart +++ /dev/null @@ -1,292 +0,0 @@ -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:intl/intl.dart'; -import 'package:unit2/bloc/passo/bulding/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'; -import 'package:unit2/utils/text_container.dart'; -import 'package:unit2/widgets/error_state.dart'; -import 'package:unit2/widgets/passo/custom_button.dart'; - -class AdditionalItemPage extends StatefulWidget { - final List unit; - final List options; - - final VoidCallback additionalItemsPrevBtn; - final VoidCallback additionalItemsNextBtn; - - const AdditionalItemPage(this.unit, this.options, this.additionalItemsPrevBtn, - this.additionalItemsNextBtn); - - @override - _AdditionalItemPage createState() => _AdditionalItemPage(); -} - -class _AdditionalItemPage extends State { - void deleteItem(int itemId) { - context.read().add(DeleteAdditionalItems(id: itemId)); - } - - double _totalMarketValue(items) { - double total = 0; - items.forEach((row) { - total += double.parse(row.adjustedMarketVal); - }); - return total; - } - - @override - Widget build(BuildContext context) { - return Scaffold( - body: ProgressHUD( - padding: const EdgeInsets.all(24), - backgroundColor: Colors.black87, - indicatorWidget: const SpinKitFadingCircle(color: Colors.white), - child: BlocConsumer( - listener: (context, state) { - if (state is AdditionalItemsLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - if (state is AdditionalItemsLoaded) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - if (state is AdditionalItemsErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, - builder: (context, state) { - final state = context.watch().state; - if (state is AdditionalItemsLoaded) { - return Column( - children: [ - Expanded( - child: SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - children: [ - Container( - margin: const EdgeInsets.only( - left: 0, top: 20, right: 0, bottom: 10), - child: const Text('ADDITIONAL ITEMS', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18), - textAlign: TextAlign.left), - ), - Align( - alignment: Alignment.topRight, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: Colors.red, - ), - onPressed: () { - context - .read() - .add(ShowAdditionalItems()); - }, - child: Row( - mainAxisSize: MainAxisSize.min, - children: const [ - Text('ADD ITEM'), // <-- Text - SizedBox( - width: 5, - ), - Icon( - // <-- Icon - Icons.add, - size: 24.0, - ), - ], - ), - ), - ), - SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: DataTable( - // ignore: prefer_const_literals_to_create_immutables - columns: [ - const DataColumn( - label: Text('Items'), - ), - const DataColumn( - label: Text('Unit Value'), - ), - const DataColumn( - label: Text('% of BUCC'), - ), - const DataColumn( - label: Text('Market Value'), - ), - const DataColumn( - label: Text('Action'), - ) - ], - rows: state.items.map((dataRow) { - return DataRow( - cells: [ - DataCell(Text(dataRow.className)), - DataCell(Text(dataRow.baseUnitValue)), - DataCell(Text(dataRow.unitValue)), - DataCell(Text(((double.parse( - dataRow.adjustedMarketVal))) - .toString())), - DataCell(Row( - children: [ - InkWell( - child: Container( - height: 30, - width: 30, - decoration: const BoxDecoration( - shape: BoxShape.circle, - color: Colors.red, - ), - child: const Icon( - Icons.delete, - color: Colors.white, - size: 20.0, - ), - ), - onTap: () { - deleteItem(dataRow.id); - }, - ), - const SizedBox( - width: 10, - ), - InkWell( - child: Container( - height: 30, - width: 30, - decoration: const BoxDecoration( - shape: BoxShape.circle, - color: Colors.red, - ), - child: const Icon( - Icons.edit, - color: Colors.white, - size: 20.0, - ), - ), - onTap: () {}, - ), - ], - )) - ], - ); - }).toList(), - ), - ), - ], - ), - ), - ), - ), - Padding( - padding: const EdgeInsets.only(left: 20.0, right: 20.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - const Text( - 'Total', - style: TextStyle( - fontWeight: FontWeight.bold, fontSize: 15), - ), - Text( - NumberFormat.currency(locale: 'en-PH', symbol: "₱") - .format(_totalMarketValue(state.items)), - style: TextStyle( - fontWeight: FontWeight.bold, fontSize: 15), - ) - ], - ), - ), - Padding( - padding: const EdgeInsets.all(15.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - CustomButton( - icon: const Icon(Icons.chevron_left_rounded, - color: Colors.white), - onPressed: () { - { - widget.additionalItemsPrevBtn(); - } - ; - }, - ), - CustomButton( - icon: const Icon(Icons.chevron_right_rounded, - color: Colors.white), - onPressed: () { - { - widget.additionalItemsNextBtn(); - } - ; - }, - ) - ], - ), - ), - ], - ); - } - 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: const EdgeInsets.symmetric( - horizontal: 20.0, - vertical: 10.0, - ), - title: const Text( - 'ADD EXTRA ITEMS', - textAlign: TextAlign.center, - ), - content: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: AddExtraItems(widget.unit, widget.options)) - ], - ), - ), - ); - } - if (state is AdditionalItemsErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context.read().add(LoadAdditionalItems()); - }, - ); - } - return Container(); - }, - ), - ), - ); - } -} 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 deleted file mode 100644 index 3374a9e..0000000 --- a/lib/screens/passo/Building/add_building_components/bldg_location_landref.dart +++ /dev/null @@ -1,434 +0,0 @@ -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:fluttertoast/fluttertoast.dart'; -import 'package:form_builder_validators/form_builder_validators.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -import 'package:unit2/bloc/passo/barangay/barangay_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart'; - -import 'package:unit2/bloc/passo/municipality/municipality_bloc.dart'; -import 'package:unit2/model/location/barangay.dart'; -import 'package:unit2/model/passo/bldg_loc.dart'; - -import 'package:unit2/model/passo/city.dart'; -import 'package:unit2/model/passo/land_ref.dart'; -import 'package:unit2/screens/passo/Building/add_building.dart'; -import 'package:unit2/theme-data.dart/colors.dart'; -import 'package:unit2/theme-data.dart/form-style.dart'; -import 'package:unit2/utils/alerts.dart'; -import 'package:unit2/utils/text_container.dart'; -import 'package:unit2/widgets/error_state.dart'; -import 'package:unit2/widgets/passo/custom_button.dart'; -import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart'; - -import '../../../../model/passo/barangay.dart'; - -class BldgLocationLandrefPage extends StatefulWidget { - final VoidCallback PrevBtn; - final VoidCallback NextBtn; - BldgLocationLandrefPage(this.PrevBtn, this.NextBtn); - - @override - _BldgLocationLandrefPage createState() => _BldgLocationLandrefPage(); -} - -class _BldgLocationLandrefPage extends State { - @override - Widget build(BuildContext context) { - return Scaffold( - body: ProgressHUD( - padding: const EdgeInsets.all(24), - backgroundColor: Colors.black87, - indicatorWidget: const SpinKitFadingCircle(color: Colors.white), - child: BlocConsumer( - listener: (context, state) { - if (state is MunicipalityLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - - if (state is MunicipalityErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, - builder: (context, state) { - if (state is MunicipalityLoaded) { - List cityList = state.municipality; - - return BlocConsumer( - listener: (context, state) { - if (state is BarangayLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - - if (state is BarangayLoaded) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - if (state is BarangayErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, - builder: (context, state) { - if (state is BarangayLoaded) { - List brgyList = state.brgy; - List brgyNAmes = brgyList - .map((brgy) => brgy.barangayDescription) - .toList() - .cast(); - return StatefulBuilder(builder: (context, locationState) { - 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( - child: Container( - height: 45.0, - width: double.infinity, - decoration: BoxDecoration( - color: Colors.white, - border: Border.all( - color: Colors.grey, - width: 1.0, - ), - borderRadius: - BorderRadius.circular(5.0), - ), - child: const Align( - alignment: Alignment.center, - child: Text( - "AGUSAN DEL NORTE", - style: TextStyle(fontSize: 15), - ), - ), - ), - ), - const SizedBox(width: 10.0), - Expanded( - flex: 1, - child: FormBuilderDropdown( - name: 'municipality', - autofocus: false, - decoration: normalTextFieldStyle( - "Municipality", ""), - items: cityList - .map((city) => - DropdownMenuItem( - value: city, - child: Text(city - .cityDescription!), // Use cityDescription instead of cityName - )) - .toList(), - onChanged: (selectedCity) { - if (selectedCity != null) { - final selectedCityCode = - selectedCity.cityCode; - final barangayBloc = - context.read(); - barangayBloc.add(LoadBarangay( - id: selectedCityCode!)); // Use selectedCityCode directly - } - }, - )), - ]), - 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: customDropDownField( - "Brgy. / District", - "", - 'brgy', - brgyNAmes)) - ]), - Container( - margin: const EdgeInsets.only( - left: 0, top: 20, right: 0, bottom: 10), - child: const Text('LAND REFERENCE', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18), - textAlign: TextAlign.left), - ), - customTextField("Land Owner", "", 'l_owner'), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - children: [ - 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')) - ]), - const SizedBox( - height: 50, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - children: [ - CustomButton( - icon: const Icon(Icons.chevron_left_rounded, - color: Colors.white), - onPressed: () { - { - widget.PrevBtn(); - } - ; - }, - ), - // Builder(builder: (context) { - // return CustomButton( - // icon: const Icon( - // Icons.chevron_right_rounded, - // color: Colors.white), - // onPressed: () async { - // { - // try { - // final progress = - // ProgressHUD.of(context); - // Future.delayed(Duration(seconds: 3), - // () { - // progress?.dismiss(); - // }); - // final tempID = await SharedPreferences - // .getInstance(); - // var bldgLocData = BldgLoc( - // id: tempID.getInt('tempid')! - 1, - // street: formKey.currentState - // ?.value['street'], - // barangay: formKey - // .currentState?.value['brgy'], - // municipality: formKey - // .currentState - // ?.value['municipality'] - // .cityDescription, - // province: "Agusan Del Norte"); - // var landRefData = LandRef( - // id: tempID.getInt('tempid')! - 1, - // owner: formKey - // .currentState?.value['l_owner'], - // cloaNo: formKey.currentState - // ?.value['oct_tct_cloa'], - // lotNo: formKey - // .currentState?.value['lot_no'], - // tdn: formKey.currentState - // ?.value['l_td_arp'], - // area: formKey - // .currentState?.value['area'], - // surveyNo: formKey.currentState - // ?.value['survey_no'], - // blkNo: formKey - // .currentState?.value['blk_no'], - // ); - // context.read() - // ..add(UpdateBldgLoc( - // bldg_loc: bldgLocData)) - // ..add(UpdateLandRef( - // land_ref: landRefData)); - // } catch (e) { - // Fluttertoast.showToast( - // msg: - // "Slow internet connection, please try again!"); - // } - // } - // ; - // }, - // ); - // }) - Builder(builder: (context) { - return CustomButton( - icon: const Icon( - Icons.chevron_right_rounded, - color: Colors.white, - ), - onPressed: () async { - try { - // Get the ProgressHUD instance - final progress = - ProgressHUD.of(context); - - // Show the progress indicator - progress?.show(); - - // Dismiss the progress indicator - progress?.dismiss(); - - // Rest of your code... - final tempID = await SharedPreferences - .getInstance(); - var bldgLocData = BldgLoc( - id: tempID.getInt('tempid')! - 1, - street: formKey.currentState - ?.value['street'], - barangay: formKey - .currentState?.value['brgy'], - municipality: formKey - .currentState - ?.value['municipality'] - .cityDescription, - province: "Agusan Del Norte"); - var landRefData = LandRef( - id: tempID.getInt('tempid')! - 1, - owner: formKey - .currentState?.value['l_owner'], - cloaNo: formKey.currentState - ?.value['oct_tct_cloa'], - lotNo: formKey - .currentState?.value['lot_no'], - tdn: formKey.currentState - ?.value['l_td_arp'], - area: formKey - .currentState?.value['area'], - surveyNo: formKey.currentState - ?.value['survey_no'], - blkNo: formKey - .currentState?.value['blk_no'], - ); - context.read() - ..add(UpdateBldgLoc( - bldg_loc: bldgLocData)) - ..add(UpdateLandRef( - land_ref: landRefData)); - } catch (e) { - Fluttertoast.showToast( - msg: - "Slow internet connection, please try again!", - ); - } - }, - ); - }) - ], - ) - ], - ), - ), - ); - }); - } - if (state is BarangayErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context.read().add(LoadBarangay(id: '1')); - }, - ); - } - return Container(); - }, - ); - } - if (state is MunicipalityErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context.read().add(LoadMunicipality()); - }, - ); - } - if (state is ShowBldgLocErrorAlertState) { - WidgetsBinding.instance.addPostFrameCallback((_) { - errorAlert( - context, "Something went wrong", "Please try again...", () { - Navigator.of(context).pop(); - }); - }); - } - if (state is ShowLandRefErrorAlertState) { - WidgetsBinding.instance.addPostFrameCallback((_) { - errorAlert( - context, "Something went wrong", "Please try again...", () { - Navigator.of(context).pop(); - }); - }); - } - return Container(); - }, - ), - ), - ); - } - - Future _waitForAddPropertyInfoToComplete() async { - // Wait for the state change indicating completion - final propertyInfoState = context.read().state; - - if (propertyInfoState is ShowBldgLocErrorAlertState || - propertyInfoState is ShowLandRefErrorAlertState) { - // Check if the add operation was successful - return false; // You'll need to define this in your state class - } - - // Return false if the state didn't change as expected - return true; - } -} diff --git a/lib/screens/passo/Building/add_building_components/general_description.dart b/lib/screens/passo/Building/add_building_components/general_description.dart deleted file mode 100644 index 976c9ae..0000000 --- a/lib/screens/passo/Building/add_building_components/general_description.dart +++ /dev/null @@ -1,235 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_form_builder/flutter_form_builder.dart'; -import 'package:fluttertoast/fluttertoast.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart'; -import 'package:unit2/model/passo/general_description.dart'; -import 'package:unit2/model/passo/unit_construct.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_button.dart'; -import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart'; - -class GeneralDescriptionPage extends StatefulWidget { - final List unit; - final VoidCallback onPutGeneralDescription; - final VoidCallback gendescPrevBtn; - - GeneralDescriptionPage( - this.unit, this.onPutGeneralDescription, this.gendescPrevBtn); - - @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: [ - 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: () { - { - widget.gendescPrevBtn(); - } - ; - }, - ), - CustomButton( - icon: const Icon(Icons.chevron_right_rounded, - color: Colors.white), - onPressed: () async { - { - try { - final tempID = await SharedPreferences.getInstance(); - - var genDescData = GeneralDesc( - id: tempID.getInt('tempid')! - 1, - bldgKind: formKey - .currentState?.value['bldg_type'].building, - strucType: formKey - .currentState?.value['bldg_type'].bldgType, - bldgPermit: - formKey.currentState?.value['bldg_permit'], - dateIssued: - formKey.currentState?.value['coc_issued'], - cct: formKey.currentState?.value['cct'], - certCompletionIssued: - formKey.currentState?.value['coc_issued'], - certOccupancyIssued: - formKey.currentState?.value['coo_issued'], - dateCompleted: - formKey.currentState?.value['date_cnstructed'], - dateOccupied: - formKey.currentState?.value['date_occupied'], - bldgAge: formKey.currentState?.value['bldg_age'], - noStoreys: - formKey.currentState?.value['no_of_storeys'], - area1Stfloor: '0', - area2Ndfloor: '0', - area3Rdfloor: '0', - area4Thfloor: '0', - totalFloorArea: - formKey.currentState?.value['total_area'], - floorSketch: null, - actualUse: - formKey.currentState?.value['actual_use']); - - context.read() - ..add(UpdateGeneralDesc(gen_desc: genDescData)); - } catch (e) { - Fluttertoast.showToast( - msg: "Slow internet connection, please try again!"); - } - } - ; - }, - ) - ], - ) - ], - ), - ), - ); - } -} diff --git a/lib/screens/passo/Building/add_building_components/property_appraisal.dart b/lib/screens/passo/Building/add_building_components/property_appraisal.dart deleted file mode 100644 index 2f0061c..0000000 --- a/lib/screens/passo/Building/add_building_components/property_appraisal.dart +++ /dev/null @@ -1,1172 +0,0 @@ -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:fluttertoast/fluttertoast.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/bloc/passo/bulding/additional_item/additional_item_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/property_appraisal/property_appraisal_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart'; -import 'package:unit2/model/passo/additional_items.dart'; -import 'package:unit2/model/passo/property_appraisal.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_button.dart'; - -class PropertyAppraisalPage extends StatefulWidget { - final VoidCallback NextBtn; - final VoidCallback PrevBtn; - - PropertyAppraisalPage(this.NextBtn, this.PrevBtn); - - @override - _PropertyAppraisalPage createState() => _PropertyAppraisalPage(); -} - -class _PropertyAppraisalPage extends State { - double depRate = 0; - - double _depRate = 0; - - double assessment_level = 0; - bool isTaxable = false; - bool isExempt = false; - String _memoranda = ''; - final focus = FocusNode(); - - String assessmentLevel(marketValues, property_class) { - final marketValue = double.parse(marketValues); - 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(marketValues, property_class) { - final marketValue = double.parse(marketValues); - 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; - } - - 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 Scaffold( - body: ProgressHUD( - padding: const EdgeInsets.all(24), - backgroundColor: Colors.black87, - indicatorWidget: const SpinKitFadingCircle(color: Colors.white), - child: BlocConsumer( - listener: (context, state) { - if (state is PropertyAppraisalLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - print('app_load'); - } - - if (state is PropertyAppraisalErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - if (state is PropertyAppraisalLoaded) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - if (state is ShowPropertyAppraisalSuccessAlertState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - widget.NextBtn(); - } - if (state is ShowPropertyAppraisalErrorAlertState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - Fluttertoast.showToast( - msg: "Slow internet connection, please try again!"); - } - }, - builder: (context, state) { - if (state is PropertyAppraisalLoaded) { - return BlocConsumer( - listener: (context, state) { - if (state is AdditionalItemsLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - if (state is AdditionalItemsLoaded) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - if (state is AdditionalItemsErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, - 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: const Text( - "Cost of Additional Items", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 13), - textAlign: TextAlign.left, - ), - ), - Container( - child: const Text( - '', - textAlign: TextAlign.right, - ), - ) - ], - ), - const SizedBox(height: 15), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - child: const 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: const 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: const Text( - "Depreciation Rate", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 13), - textAlign: TextAlign.left, - ), - ), - SizedBox( - width: 90, - height: 25, - child: FormBuilderTextField( - name: 'depRate', - decoration: normalTextFieldStyle("", ""), - 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( - '${(depRate * 100).toStringAsFixed(2)}%', - 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, - ), - ), - ], - ), - Row( - 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: 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( - calculateMarketValue( - (double.parse(formKey.currentState!.value[ - 'total_area']) * - double.parse(formKey - .currentState! - .value['bldg_type'] - .unitValue)), - state.items, - depRate) - .toString(), - 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( - calculateMarketValue( - (double.parse(formKey.currentState!.value['total_area']) * - double.parse(formKey - .currentState! - .value[ - 'bldg_type'] - .unitValue)), - state - .items, - depRate) - .toString(), - 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( - assessmentValue( - calculateMarketValue((double.parse(formKey.currentState!.value['total_area']) * double.parse(formKey.currentState!.value['bldg_type'].unitValue)), state.items, depRate) - .toString(), - formKey - .currentState - ?.value['actual_use']) - .toString(), - style: TextStyle( - fontWeight: - FontWeight - .bold, - fontSize: 13, - ), - textAlign: - TextAlign - .center, - ), - ), - ], - ), - ) - ], - ), - ]))), - ), - ], - ), - SizedBox( - height: 50, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - CustomButton( - icon: const Icon(Icons.chevron_left_rounded, - color: Colors.white), - onPressed: () { - { - widget.PrevBtn(); - } - ; - }, - ), - CustomButton( - icon: const Icon(Icons.chevron_right_rounded, - color: Colors.white), - onPressed: () async { - { - final tempID = - await SharedPreferences.getInstance(); - print(tempID.getInt('tempid')); - var appraisals = PropertyAppraisal( - id: 1, - bldgapprDetailsId: - tempID.getInt('tempid')! - 1, - unitconstructCost: formKey - .currentState! - .value['bldg_type'] - .unitValue, - buildingCore: 'test', - unitconstructSubtotal: (double.parse(formKey.currentState!.value['total_area']) * - double.parse(formKey - .currentState! - .value['bldg_type'] - .unitValue)) - .toString(), - depreciationRate: depRate.toString(), - depreciationCost: calculateDepCost( - (double.parse(formKey.currentState!.value['total_area']) * - double.parse(formKey.currentState!.value['bldg_type'].unitValue)), - state.items, - depRate) - .toString(), - costAddItems: calculateAdditionalItems(state.items).toString(), - addItemsSubtotal: calculateAdditionalItems(state.items).toString(), - totalpercentDepreciation: (depRate * 100).toStringAsFixed(2), - marketValue: calculateMarketValue((double.parse(formKey.currentState!.value['total_area']) * double.parse(formKey.currentState!.value['bldg_type'].unitValue)), state.items, depRate).toString(), - totalArea: formKey.currentState!.value['total_area'], - actualUse: "Residential"); - context.read() - ..add(AddPropertyAppraisal( - appraisal: appraisals)); - } - ; - }, - ) - ], - ), - ], - ), - ), - ); - } - return Container(); - }, - ); - } - return Container(); - }, - ), - ), - ); - } - - Future _waitForAddPropertyInfoToComplete() async { - // Wait for the state change indicating completion - final propertyInfoState = context.read().state; - - if (propertyInfoState is PropertyInfoErrorState) { - // Check if the add operation was unsuccessful - return true; // You'll need to define this in your state class - } - - // Return false if the state didn't change as expected - return false; - } -} diff --git a/lib/screens/passo/Building/add_building_components/property_assessment.dart b/lib/screens/passo/Building/add_building_components/property_assessment.dart deleted file mode 100644 index ed3c38a..0000000 --- a/lib/screens/passo/Building/add_building_components/property_assessment.dart +++ /dev/null @@ -1,631 +0,0 @@ -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:flutter_progress_hud/flutter_progress_hud.dart'; -import 'package:flutter_spinkit/flutter_spinkit.dart'; -import 'package:form_builder_validators/form_builder_validators.dart'; -import 'package:intl/intl.dart'; -import 'package:searchfield/searchfield.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -import 'package:unit2/bloc/passo/bulding/property_appraisal/property_appraisal_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/property_assessment/property_assessment_bloc.dart'; -import 'package:unit2/bloc/passo/memoranda/memoranda_bloc.dart'; - -import 'package:unit2/bloc/passo/signatories/signatories_bloc.dart'; -import 'package:unit2/model/passo/memoranda.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/colors.dart'; -import 'package:unit2/theme-data.dart/form-style.dart'; -import 'package:unit2/utils/text_container.dart'; -import 'package:unit2/widgets/error_state.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 _memoranda = ''; - final focus = FocusNode(); - - @override - Widget build(BuildContext context) { - return Scaffold( - resizeToAvoidBottomInset: true, - body: ProgressHUD( - padding: const EdgeInsets.all(24), - backgroundColor: Colors.black87, - indicatorWidget: const SpinKitFadingCircle(color: Colors.white), - child: BlocConsumer( - listener: (context, state) { - // TODO: implement listener - }, - builder: (context, state) { - if (state is SignatoriesLoaded) { - final signatories = state.signatories; - return BlocConsumer( - listener: (context, state) { - // TODO: implement listener - }, - builder: (context, state) { - if (state is MemorandaLoaded) { - final memoranda = state.memorada; - return ListView( - children: [ - Align( - alignment: Alignment.center, - child: Container( - margin: const EdgeInsets.fromLTRB(0, 20, 0, 20), - child: const Text( - 'PROPERTY ASSESSMENT cont..', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18, - ), - textAlign: TextAlign.left, - ), - ), - ), - Expanded( - flex: 3, - child: SingleChildScrollView( - padding: - EdgeInsets.only(left: 20.0, right: 20.0), - scrollDirection: Axis.vertical, - child: Column(children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - children: [ - Row( - children: [ - const Text('Taxable'), - Checkbox( - checkColor: Colors.white, - value: isTaxable, - onChanged: (bool? value) { - setState(() { - isTaxable = value!; - }); - }, - ) - ], - ), - Row( - children: [ - const Text('Exempt'), - Checkbox( - checkColor: Colors.white, - value: isExempt, - onChanged: (bool? value) { - setState(() { - isExempt = value!; - }); - }, - ) - ], - ), - ], - ), - Column( - children: [ - const SizedBox( - height: 20, - ), - const Text( - 'EFFECTIVITY OF ASSESSMENT / REASSESSMENT :', - style: TextStyle( - fontWeight: FontWeight.bold), - ), - const SizedBox( - height: 20, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - children: [ - const Text('Qtr.'), - SizedBox( - width: 70, - height: 25, - child: FormBuilderTextField( - name: 'qtr', - validator: - FormBuilderValidators.compose( - []), - ), - ), - const SizedBox( - width: 20, - ), - const Text('Yr.'), - SizedBox( - width: 70, - height: 25, - child: FormBuilderTextField( - name: 'yr', - validator: - FormBuilderValidators.compose( - []), - ), - ), - ], - ), - ], - ), - const SizedBox( - height: 30, - ), - Align( - alignment: Alignment.centerLeft, - child: Text( - 'APPRAISED/ASSESSED BY:', - style: TextStyle( - fontWeight: FontWeight.bold), - textAlign: TextAlign.start, - ), - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - children: [ - Column( - children: [ - SizedBox( - width: 200, - child: FormBuilderDropdown< - Signatories>( - name: 'appraised_by', - autofocus: false, - items: signatories - .map((signatories) => - DropdownMenuItem( - value: signatories, - child: Text( - '${signatories.firstname} ${signatories.middlename} ${signatories.lastname}'), - )) - .toList()), - ), - Text('Name'), - ], - ), - const SizedBox( - width: 15, - ), - Column( - children: [ - SizedBox( - width: 100, - child: FormBuilderDateTimePicker( - name: 'app_date', - initialEntryMode: - DatePickerEntryMode - .calendarOnly, - initialValue: DateTime.now(), - inputType: InputType.date, - - initialTime: const TimeOfDay( - hour: 8, minute: 0), - // locale: const Locale.fromSubtags(languageCode: 'fr'), - ), - ), - Text('Date'), - ], - ), - ], - ), - const SizedBox( - height: 30, - ), - const Align( - alignment: Alignment.centerLeft, - child: Text( - 'RECOMMENDING APPROVAL:', - style: TextStyle( - fontWeight: FontWeight.bold), - )), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - children: [ - Column( - children: [ - SizedBox( - width: 200, - child: FormBuilderDropdown< - Signatories>( - name: 'rec_approval', - autofocus: false, - items: signatories - .map((signatories) => - DropdownMenuItem( - value: signatories, - child: Text( - '${signatories.firstname} ${signatories.middlename} ${signatories.lastname}'), - )) - .toList()), - ), - Text('Name'), - ], - ), - const SizedBox( - width: 15, - ), - Column( - children: [ - SizedBox( - width: 100, - child: FormBuilderDateTimePicker( - name: 'rec_date', - initialEntryMode: - DatePickerEntryMode - .calendarOnly, - initialValue: DateTime.now(), - inputType: InputType.date, - - initialTime: const TimeOfDay( - hour: 8, minute: 0), - // locale: const Locale.fromSubtags(languageCode: 'fr'), - ), - ), - Text('Date'), - ], - ), - ], - ), - const SizedBox( - height: 30, - ), - const Align( - alignment: Alignment.centerLeft, - child: Text( - 'APPROVED BY:', - style: TextStyle( - fontWeight: FontWeight.bold, - ), - )), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Column( - children: [ - SizedBox( - width: 200, - child: FormBuilderDropdown< - Signatories>( - name: 'apprvd_by', - autofocus: false, - items: signatories - .map((signatories) => - DropdownMenuItem( - value: signatories, - child: Text( - '${signatories.firstname} ${signatories.middlename} ${signatories.lastname}'), - )) - .toList()), - ), - Text('Name'), - ], - ), - ], - ), - const SizedBox( - height: 50, - ), - const Align( - alignment: Alignment.centerLeft, - child: Text( - 'MEMORANDA: ', - style: TextStyle( - fontWeight: FontWeight.bold, - ), - )), - SizedBox( - height: 30, - ), - SizedBox( - width: 500, - height: 100, - child: SearchField( - itemHeight: 70, - suggestions: memoranda - .map((Memoranda memoranda) => - SearchFieldListItem( - '${memoranda.memoranda}', - item: - memoranda, // Change: Use individual Memoranda object - child: ListTile( - title: Text( - '${memoranda.memoranda}', - overflow: - TextOverflow.ellipsis, - ), - ), - )) - .toList(), - validator: - FormBuilderValidators.required( - errorText: - "This field is required"), - // searchInputDecoration: - // normalTextFieldStyle( - // "Memoranda", "") - // .copyWith( - // suffixIcon: const Icon( - // Icons.arrow_drop_down), - // ), - // focusNode: focus, - suggestionState: Suggestion.expand, - onSuggestionTap: (memoranda) { - setState(() { - _memoranda = - memoranda.item!.memoranda!; - }); - focus.unfocus(); - }, - )), - 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([]), - ), - ), - ], - ), - const SizedBox( - height: 30, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text('Date Received:'), - SizedBox( - width: 150, - height: 20, - child: FormBuilderDateTimePicker( - name: 'date_received', - initialEntryMode: - DatePickerEntryMode.calendarOnly, - initialValue: DateTime.now(), - inputType: InputType.date, - - initialTime: const TimeOfDay( - hour: 8, minute: 0), - // locale: const Locale.fromSubtags(languageCode: 'fr'), - ), - ), - ], - ), - const SizedBox( - height: 30, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - const Text( - 'Date of Entry in the Rec. of Ass. :'), - SizedBox( - width: 100, - height: 20, - child: FormBuilderDateTimePicker( - name: 'date_of_entry', - initialEntryMode: - DatePickerEntryMode.calendarOnly, - initialValue: DateTime.now(), - inputType: InputType.date, - - initialTime: const TimeOfDay( - hour: 8, minute: 0), - // locale: const Locale.fromSubtags(languageCode: 'fr'), - ), - ), - ], - ), - const SizedBox( - height: 30, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text('By:'), - SizedBox( - width: 150, - height: 20, - child: FormBuilderTextField( - name: 'by', - decoration: InputDecoration(), - validator: - FormBuilderValidators.compose([]), - ), - ), - ], - ), - const SizedBox( - height: 30, - ), - ElevatedButton( - onPressed: () async { - final tempID = - await SharedPreferences.getInstance(); - print(tempID.getInt('tempid')! - 1); - final List - propertyAssessments = []; - - PropertyAssessment ass = - PropertyAssessment( - id: 1, - bldgapprDetailsId: - tempID.getInt('tempid')! - 1, - actualUse: formKey.currentState! - .value['actual_use'] ?? - '', // Replace null with an empty string - marketValue: '0.00', - assessmentLevel: '0.00', - assessedValue: '0.00', - taxable: isTaxable == true ? '1' : '0', - exempt: isExempt == true ? '1' : '0', - qtr: formKey.currentState!.value[ - 'qtr'], // Replace null with '0' - yr: formKey.currentState!.value[ - 'yr'], // Replace null with '0' - appraisedbyName: (formKey - .currentState! - .value['appraised_by'] - ?.firstname ?? - '') + - ' ' + - (formKey - .currentState! - .value['appraised_by'] - ?.middlename ?? - '') + - ' ' + - (formKey - .currentState! - .value['appraised_by'] - ?.lastname ?? - ''), - appraisedbyDate: formKey - .currentState!.value['app_date'], - // Replace null with current date - recommendapprName: (formKey - .currentState! - .value['rec_approval'] - ?.firstname ?? - '') + - ' ' + - (formKey - .currentState! - .value['rec_approval'] - ?.middlename ?? - '') + - ' ' + - (formKey - .currentState! - .value['rec_approval'] - ?.lastname ?? - ''), - recommendapprDate: formKey - .currentState!.value['rec_date'], - // Replace null with current date - approvedbyName: (formKey - .currentState! - .value['apprvd_by'] - ?.firstname ?? - '') + - ' ' + - (formKey - .currentState! - .value['apprvd_by'] - ?.middlename ?? - '') + - ' ' + - (formKey - .currentState! - .value['apprvd_by'] - ?.lastname ?? - ''), - memoranda: _memoranda, - swornstatementNo: formKey.currentState! - .value['sworn_statement'] ?? - '', // Replace null with an empty string - dateReceived: formKey.currentState! - .value['date_received'], - // Replace null with current date - entryDateAssessment: formKey - .currentState! - .value['date_of_entry'], - // Replace null with current date - entryDateBy: formKey - .currentState!.value['by'] ?? - '', // Replace null with an empty string - ); - - propertyAssessments.add(ass); - - context - .read() - .add(UpdatePropertyAssessment( - assessment: - propertyAssessments[0])); - widget.function(); - }, - style: ElevatedButton.styleFrom( - backgroundColor: primary, - foregroundColor: Colors.red), - child: const SizedBox( - width: 200, - height: 50, - child: Align( - alignment: Alignment.center, - child: Text( - 'Save', - style: TextStyle( - color: Colors.white, - ), - textAlign: TextAlign.center, - ), - ), - ), - ), - const SizedBox( - height: 30, - ), - ]), - ), - ) - ], - ); - } - if (state is MemorandaErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context.read().add(LoadMemoranda()); - }, - ); - } - return Container(); - }, - ); - } - if (state is SignatoriesErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context.read().add(LoadSignatories()); - }, - ); - } - return Container(); - }, - ))); - } -} diff --git a/lib/screens/passo/Building/add_building_components/property_info.dart b/lib/screens/passo/Building/add_building_components/property_info.dart deleted file mode 100644 index 97f7aae..0000000 --- a/lib/screens/passo/Building/add_building_components/property_info.dart +++ /dev/null @@ -1,165 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_form_builder/flutter_form_builder.dart'; -import 'package:fluttertoast/fluttertoast.dart'; -import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart'; -import 'package:unit2/model/passo/property_info.dart'; -import 'package:unit2/screens/passo/Building/add_building.dart'; -import 'package:unit2/widgets/passo/custom_button.dart'; -import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart'; - -GlobalKey ownerKey = GlobalKey(); - -class PropertyInfoPage extends StatefulWidget { - final VoidCallback handleButtonPress; - const PropertyInfoPage(this.handleButtonPress, {super.key}); - - @override - _PropertyInfoPage createState() => _PropertyInfoPage(); -} - -class _PropertyInfoPage extends State { - int tempId = 0; - final transaction_codes = ['New', 'Revision']; - - @override - Widget build(BuildContext context) { - return SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.all(20.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - 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: [ - Expanded( - flex: 1, - child: - customTextField("Address", "", 'benificiary_address'), - ), - const SizedBox(width: 10.0), - Expanded( - // optional flex property if flex is 1 because the default flex is 1 - flex: 1, - child: - customTextField("Tel No.", "", 'benificiary_telno')) - ]), - const SizedBox(height: 25), - CustomButton( - icon: const Icon(Icons.chevron_right, color: Colors.white), - onPressed: () async { - try { - 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'], - faasType: "BUILDING", - ); - - // Dispatch the event to add the property_info - context.read().add( - AddPropertyInfo(property_info: property_info), - ); - widget.handleButtonPress(); - } catch (e) { - Fluttertoast.showToast( - msg: "Slow internet connection, please try again!"); - } - - // Wait for the event to complete and get the result - // bool failed = await _waitForAddPropertyInfoToComplete(); - - // if (failed) { - // // Proceed to the next step or perform an action - // Fluttertoast.showToast( - // msg: "Slow internet connection, please try again!"); - // } else { - // // Stay or show an error message - // widget.handleButtonPress(); - // } - }, - ) - ]), - ), - ); - } - - Future _waitForAddPropertyInfoToComplete() async { - // Wait for the state change indicating completion - final propertyInfoState = context.read().state; - - if (propertyInfoState is PropertyInfoErrorState) { - // Check if the add operation was unsuccessful - return true; // You'll need to define this in your state class - } - - // Return false if the state didn't change as expected - return false; - } -} diff --git a/lib/screens/passo/Building/add_building_components/structural_materials.dart b/lib/screens/passo/Building/add_building_components/structural_materials.dart deleted file mode 100644 index 95c7db4..0000000 --- a/lib/screens/passo/Building/add_building_components/structural_materials.dart +++ /dev/null @@ -1,431 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:fluttertoast/fluttertoast.dart'; -import 'package:multiselect/multiselect.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart'; -import 'package:unit2/model/passo/structural_materials_ii.dart'; -import 'package:unit2/screens/passo/Building/add_building.dart'; -import 'package:unit2/widgets/passo/custom_button.dart'; -import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart'; - -class MaterialOption { - final String id; - final String label; - - MaterialOption(this.id, this.label); -} - -class StructuralMaterialsPage extends StatefulWidget { - final VoidCallback NextBtn; - final VoidCallback PrevBtn; - - StructuralMaterialsPage(this.NextBtn, this.PrevBtn); - - @override - _StructuralMaterialsPage createState() => _StructuralMaterialsPage(); -} - -class _StructuralMaterialsPage extends State { - List foundation = []; - List column = []; - List beam = []; - List truss_framing = []; - List roof = []; - List flooring = []; - List walls = []; - bool foundationOthers = false; - bool columOthers = false; - bool beamsOthers = false; - bool tfOthers = false; - bool roofOthers = false; - bool flooringOthers = false; - bool wpOthers = false; - - List columnOptions = [ - MaterialOption('steel', 'Steel'), - MaterialOption('concrete', 'Reinforced Concrete'), - MaterialOption('wood', 'Wood'), - ]; - - List selectedColumnValues = []; - - @override - Widget build(BuildContext context) { - return StatefulBuilder(builder: (context, structuralState) { - return SingleChildScrollView( - padding: const EdgeInsets.all(30.0), - child: Column( - children: [ - Container( - margin: - const EdgeInsets.only(left: 0, top: 20, right: 0, bottom: 10), - child: const Text('STRUCTURAL MATERIALS', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18), - textAlign: TextAlign.left), - ), - Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - 'FOUNDATION', - textAlign: TextAlign.start, - ), - Row( - children: [ - const Text('Others'), - Checkbox( - checkColor: Colors.white, - value: foundationOthers, - onChanged: (bool? value) { - structuralState(() { - foundationOthers = value!; - }); - }, - ) - ], - ), - ]), - Padding( - padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), - child: Visibility( - visible: foundationOthers, - child: customTextField( - "Enter other foundation", "", "other_foundation"), - replacement: DropDownMultiSelect( - selected_values_style: TextStyle(color: Colors.black), - onChanged: (List x) { - structuralState(() { - foundation = x; - }); - }, - options: const ['Reinforced Concrete', 'Plain Concrete'], - selectedValues: foundation, - whenEmpty: 'Select Foundations', - ), - ), - ), - Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - 'COLUMNS', - textAlign: TextAlign.start, - ), - Row( - children: [ - const Text('Others'), - Checkbox( - checkColor: Colors.white, - value: columOthers, - onChanged: (bool? value) { - structuralState(() { - columOthers = value!; - }); - }, - ) - ], - ), - ]), - Padding( - padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), - child: Visibility( - visible: columOthers, - child: - customTextField("Enter other columns", "", "other_column"), - replacement: DropDownMultiSelect( - selected_values_style: TextStyle(color: Colors.black), - onChanged: (List x) { - structuralState(() { - column = x; - }); - }, - options: const ['Steel', 'Reinforced Concrete', 'Wood'], - selectedValues: column, - whenEmpty: 'Select Column/s', - ), - ), - ), - Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - 'BEAMS', - textAlign: TextAlign.start, - ), - Row( - children: [ - const Text('Others'), - Checkbox( - checkColor: Colors.white, - value: beamsOthers, - onChanged: (bool? value) { - structuralState(() { - beamsOthers = value!; - }); - }, - ) - ], - ), - ]), - Padding( - padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), - child: Visibility( - visible: beamsOthers, - child: customTextField("Enter other beam/s", "", "other_beam"), - replacement: DropDownMultiSelect( - selected_values_style: TextStyle(color: Colors.black), - onChanged: (List x) { - structuralState(() { - beam = x; - }); - }, - options: const ['Steel', 'Reinforced Concrete', 'Wood'], - selectedValues: beam, - whenEmpty: 'Select Beam/s', - ), - ), - ), - Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - 'TRUSS FRAMING', - textAlign: TextAlign.start, - ), - Row( - children: [ - const Text('Others'), - Checkbox( - checkColor: Colors.white, - value: tfOthers, - onChanged: (bool? value) { - structuralState(() { - tfOthers = value!; - }); - }, - ) - ], - ), - ]), - Padding( - padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), - child: Visibility( - visible: tfOthers, - child: customTextField( - "Enter other truss framing/s", "", "other_tf"), - replacement: DropDownMultiSelect( - selected_values_style: TextStyle(color: Colors.black), - onChanged: (List x) { - structuralState(() { - truss_framing = x; - }); - }, - options: const ['Steel', 'Wood'], - selectedValues: truss_framing, - whenEmpty: 'Select Truss Framing/s', - ), - ), - ), - Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - 'ROOF', - textAlign: TextAlign.start, - ), - Row( - children: [ - const Text('Others'), - Checkbox( - checkColor: Colors.white, - value: roofOthers, - onChanged: (bool? value) { - structuralState(() { - roofOthers = value!; - }); - }, - ) - ], - ), - ]), - Padding( - padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), - child: Visibility( - visible: roofOthers, - child: customTextField("Enter other roof/s", "", "other_roof"), - replacement: DropDownMultiSelect( - selected_values_style: TextStyle(color: Colors.black), - onChanged: (List x) { - structuralState(() { - roof = x; - }); - }, - options: const [ - 'Reinforced Concrete', - 'Tiles', - 'G.I Sheet', - 'Aluminum', - 'Asbestos', - 'Long Span', - 'Concrete Desk', - 'Nipa/Anahaw/Cogon' - ], - selectedValues: roof, - whenEmpty: 'Select Roof/s', - ), - ), - ), - Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - 'FLOORING', - textAlign: TextAlign.start, - ), - Row( - children: [ - const Text('Others'), - Checkbox( - checkColor: Colors.white, - value: flooringOthers, - onChanged: (bool? value) { - structuralState(() { - flooringOthers = value!; - }); - }, - ) - ], - ), - ]), - Padding( - padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), - child: Visibility( - visible: flooringOthers, - child: customTextField( - "Enter other flooring/s", "", "other_flooring"), - replacement: DropDownMultiSelect( - selected_values_style: TextStyle(color: Colors.black), - onChanged: (List x) { - structuralState(() { - flooring = x; - }); - }, - options: const [ - 'Reinforced Concrete', - 'Plain Cement', - 'Marble', - 'Wood', - 'Tiles' - ], - selectedValues: flooring, - whenEmpty: 'Select Flooring/s', - ), - ), - ), - Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - 'WALLS & PARTITIONS', - textAlign: TextAlign.start, - ), - Row( - children: [ - const Text('Others'), - Checkbox( - checkColor: Colors.white, - value: wpOthers, - onChanged: (bool? value) { - structuralState(() { - wpOthers = value!; - }); - }, - ) - ], - ), - ]), - Padding( - padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), - child: Visibility( - visible: wpOthers, - child: customTextField( - "Enter other walls & partition/s", "", "other_wp"), - replacement: DropDownMultiSelect( - selected_values_style: TextStyle(color: Colors.black), - onChanged: (List x) { - setState(() { - walls = x; - }); - }, - options: const [ - 'Reinforced Concrete', - 'Plain Concrete', - 'Wood', - 'CHIB', - 'G.I Sheet', - 'Build-a-wall', - 'Sawali', - 'Bamboo' - ], - selectedValues: walls, - whenEmpty: 'Select Walls & Partition/s', - ), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - CustomButton( - icon: const Icon(Icons.chevron_left_rounded, - color: Colors.white), - onPressed: () { - { - widget.PrevBtn(); - } - ; - }, - ), - CustomButton( - icon: const Icon(Icons.chevron_right_rounded, - color: Colors.white), - onPressed: () async { - { - try { - final tempID = await SharedPreferences.getInstance(); - var strucMaterials = StructureMaterialsII( - id: tempID.getInt('tempid')! - 1, - foundation: foundationOthers - ? formKey - .currentState!.value['other_foundation'] - .split(',') - : foundation, - columns: columOthers - ? formKey.currentState!.value['other_column'] - .split(',') - : column, - beams: beamsOthers - ? formKey.currentState!.value['other_beam'] - .split(',') - : beam, - trussFraming: tfOthers - ? formKey.currentState!.value['other_tf'] - .split(',') - : truss_framing, - roof: roofOthers - ? formKey.currentState!.value['other_roof'] - .split(',') - : roof, - flooring: flooringOthers - ? formKey.currentState!.value['other_flooring'] - .split(',') - : flooring, - walls: wpOthers - ? formKey.currentState!.value['other_wp'] - .split(',') - : walls, - others: ["Others"]); - context.read() - ..add(UpdateStrucMaterials(data: strucMaterials)); - } catch (e) { - Fluttertoast.showToast( - msg: "Slow internet connection, please try again!"); - } - } - ; - }, - ) - ], - ) - ], - ), - ); - }); - } -} diff --git a/lib/screens/passo/Building/edit_building.dart b/lib/screens/passo/Building/edit_building.dart deleted file mode 100644 index 326dd35..0000000 --- a/lib/screens/passo/Building/edit_building.dart +++ /dev/null @@ -1,211 +0,0 @@ -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:im_stepper/stepper.dart'; -import 'package:unit2/bloc/passo/bulding/class_components/class_components_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/unit_construct/unit_construct_bloc.dart'; -import 'package:unit2/model/passo/class_components.dart'; -import 'package:unit2/model/passo/property_info.dart'; -import 'package:unit2/model/passo/unit_construct.dart'; -import 'package:unit2/screens/passo/Building/edit_building/additional_items.dart'; -import 'package:unit2/screens/passo/Building/edit_building/bldgloc_landref.dart'; -import 'package:unit2/screens/passo/Building/edit_building/general_description.dart'; -import 'package:unit2/screens/passo/Building/edit_building/property_appraisal.dart'; -import 'package:unit2/screens/passo/Building/edit_building/property_assessement_edit.dart'; -import 'package:unit2/screens/passo/Building/edit_building/property_owner_info.dart'; -import 'package:unit2/screens/passo/Building/edit_building/structural_materials.dart'; -import 'package:unit2/screens/passo/Building/edit_building/structural_materials_edit.dart'; -import 'package:unit2/screens/passo/Land/add_land.dart'; -import 'package:unit2/theme-data.dart/colors.dart'; -import 'package:unit2/utils/text_container.dart'; -import 'package:unit2/widgets/error_state.dart'; - -class EditBuilding extends StatefulWidget { - final int index; - final PropertyInfo faas; - final String title; - - const EditBuilding( - {super.key, - required this.title, - required this.index, - required this.faas}); - @override - _EditBuilding createState() => _EditBuilding(); -} - -class _EditBuilding extends State { - // THE FOLLOWING TWO VARIABLES ARE REQUIRED TO CONTROL THE STEPPER. - int activeStep = 0; // Initial step set to 5. - - int upperBound = 6; // upperBound MUST BE total number of icons minus 1. - - void PrevBtn() { - setState(() { - activeStep--; - }); - } - - void NextBtn() { - setState(() { - activeStep++; - }); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - centerTitle: true, - backgroundColor: primary, - title: Text('Building FAAS Edit'), - ), - body: ProgressHUD( - padding: const EdgeInsets.all(24), - backgroundColor: Colors.black87, - indicatorWidget: const SpinKitFadingCircle(color: Colors.white), - child: BlocConsumer( - listener: (context, state) { - if (state is UnitConstructLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - if (state is UnitConstructLoaded) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - if (state is UnitConstructErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - // Fluttertoast.showToast( - // msg: onError, - // fontSize: 24, - // toastLength: Toast.LENGTH_LONG, - // gravity: ToastGravity.CENTER, - // backgroundColor: Colors.black, - // textColor: Colors.white); - } - }, - builder: (context, state) { - if (state is UnitConstructLoaded) { - final unit = state.unit; - return BlocConsumer( - listener: (context, state) { - if (state is ClassComponentLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - if (state is ClassComponentLoaded) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - if (state is ClassComponentErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - // Fluttertoast.showToast( - // msg: onError, - // fontSize: 24, - // toastLength: Toast.LENGTH_LONG, - // gravity: ToastGravity.CENTER, - // backgroundColor: Colors.black, - // textColor: Colors.white); - } - }, - builder: (context, state) { - if (state is ClassComponentLoaded) { - return Column( - children: [ - NumberStepper( - numbers: [1, 2, 3, 4, 5, 6, 7], - activeStepColor: primary, - numberStyle: TextStyle(color: Colors.white), - lineColor: primary, - // activeStep property set to activeStep variable defined above. - activeStep: activeStep, - activeStepBorderColor: Colors.white, - activeStepBorderWidth: 1, - // This ensures step-tapping updates the activeStep. - onStepReached: (index) { - setState(() { - activeStep = index; - }); - }, - ), - Expanded( - child: StatefulBuilder(builder: - (BuildContext context, StateSetter setState) { - return Container( - child: content( - unit, - state.classes, - ), - ); - }), - ), - ], - ); - } - if (state is ClassComponentErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context - .read() - .add(LoadClassComponents()); - }, - ); - } - return Container(); - }, - ); - } - if (state is UnitConstructErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context.read().add(LoadUnitConstruct()); - }, - ); - } - return Container(); - }, - ), - ), - ); - } - - // Returns the header text based on the activeStep. - Widget content(List unit, classes) { - switch (activeStep) { - case 0: - return PropertyOwnerInfoEdit( - widget.index, widget.faas, widget.title, NextBtn, PrevBtn); - - case 1: - return BldgLocLandRefEdit(widget.faas.id!, NextBtn, PrevBtn); - - case 2: - return GeneralDescriptionEdit(unit, widget.faas.id!, NextBtn, PrevBtn); - - case 3: - return StructuralMaterialsEditPage(widget.faas.id!, NextBtn, PrevBtn); - - case 4: - return AdditionalItemEditPage( - unit, classes, widget.faas.id!, NextBtn, PrevBtn); - - case 5: - return PropertyAppraisalEditPage(widget.faas.id!, NextBtn, PrevBtn); - - case 6: - return PropertyAssessmentEditPage(widget.faas.id!); - - default: - return PropertyOwnerInfoEdit( - widget.index, widget.faas, widget.title, NextBtn, PrevBtn); - } - } -} diff --git a/lib/screens/passo/Building/edit_building/AddExtraItems.dart b/lib/screens/passo/Building/edit_building/AddExtraItems.dart deleted file mode 100644 index 48d353c..0000000 --- a/lib/screens/passo/Building/edit_building/AddExtraItems.dart +++ /dev/null @@ -1,609 +0,0 @@ -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/bulding/additional_item/additional_item_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/additional_items_edit/additional_items_edit_bloc.dart'; -import 'package:unit2/model/passo/additional_items.dart'; -import 'package:unit2/model/passo/class_components%20_offline.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 AddExtraItemsEdit extends StatefulWidget { - final List unit; - final List options; - final int tempId; - - AddExtraItemsEdit(this.unit, this.options, this.tempId); - - @override - _AddExtraItemsEdit createState() => _AddExtraItemsEdit(); -} - -class _AddExtraItemsEdit 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; - int _notPaintedUnitVal = 0; - int _secondHandUnitVal = 0; - - BoxDecoration box1() { - return const BoxDecoration(boxShadow: [ - BoxShadow(color: Colors.black12, spreadRadius: 5, blurRadius: 5) - ], color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(3))); - } - - double _computeValue(double unitbase, double unitvalue, double area) { -// Compute some value based on the text here - return (unitbase * unitvalue) * area; - } - - double _amountofDepreciation(unitVal, unitBase, area, depreciation) { - return ((unitVal * unitBase) * area) * depreciation; - } - - double _adjustedMarketValue(unitVal, unitBase, area, depreciation) { - double depAmount = ((unitVal * unitBase) * area) * depreciation; - - return ((unitVal * unitBase) * area) - depAmount; - } - - double _totalMarketValue(unitVal, unitBase, area, depreciation, withBUCC, - className, painted, secondHand, paintedUnitVal, secondhandUntVal) { - if (withBUCC == false) { - if (painted == true || secondHand == true) { - final deductions = (paintedUnitVal + secondhandUntVal) / 100; - - print(deductions); - return (((unitVal - deductions) * unitBase) * area); - } else { - return ((unitVal * unitBase) * area); - } - } else { - return (unitVal * area); - } - } - - @override - Widget build(BuildContext context) { - return BlocBuilder( - buildWhen: (previous, current) { - return false; - }, builder: (context, state) { - if (state is ShowAddItemsScreenEdit) { - return FormBuilder( - key: formKey, - onChanged: () { - formKey.currentState?.save(); - }, - autovalidateMode: AutovalidateMode.disabled, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - height: 800, - child: SingleChildScrollView( - padding: const EdgeInsets.all(8.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - 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 == '1' ? true : false; - }); - formKey.currentState!.patchValue( - {'unitValue': value.minBaseUnitvalPercent}); - } - if (value.maxBaseUnitvalPercent != '0.00') { - setState(() { - _unitValue = double.parse( - value.maxBaseUnitvalPercent!); - _className = value.componentName!; - _classId = value.id!; - _withoutBUCC = - value.withoutBucc == '1' ? true : false; - }); - formKey.currentState!.patchValue( - {'unitValue': value.maxBaseUnitvalPercent}); - } - if (value.minUnitvalSqrmtr != '0.00') { - setState(() { - _unitValue = - double.parse(value.minUnitvalSqrmtr!); - _className = value.componentName!; - _classId = value.id!; - _withoutBUCC = - value.withoutBucc == '1' ? true : false; - }); - formKey.currentState!.patchValue( - {'unitValue': value.minUnitvalSqrmtr}); - } - if (value.maxUnitvalSqrmtr != '0.00') { - setState(() { - _unitValue = - double.parse(value.maxUnitvalSqrmtr!); - _className = value.componentName!; - _classId = value.id!; - _withoutBUCC = - value.withoutBucc == '1' ? true : false; - ; - }); - formKey.currentState!.patchValue( - {'unitValue': value.maxUnitvalSqrmtr}); - } - if (value.minAddBaseunitval != '0.00') { - setState(() { - _unitValue = - double.parse(value.minAddBaseunitval!); - _className = value.componentName!; - _classId = value.id!; - _withoutBUCC = - value.withoutBucc == '1' ? true : false; - ; - }); - formKey.currentState!.patchValue( - {'unitValue': value.minAddBaseunitval}); - } - if (value.maxAddBaseunitval != '0.00') { - setState(() { - _unitValue = - double.parse(value.maxAddBaseunitval!); - _className = value.componentName!; - _classId = value.id!; - _withoutBUCC = - value.withoutBucc == '1' ? true : false; - ; - }); - formKey.currentState!.patchValue( - {'unitValue': value.maxAddBaseunitval}); - } - if (value.minDeductBaserate != '0.00') { - setState(() { - _unitValue = - double.parse(value.minDeductBaserate!); - _className = value.componentName!; - _classId = value.id!; - _withoutBUCC = - value.withoutBucc == '1' ? true : false; - ; - }); - formKey.currentState!.patchValue( - {'unitValue': value.minDeductBaserate}); - } - if (value.maxDeductBaserate != '0.00') { - setState(() { - _unitValue = - double.parse(value.maxDeductBaserate!); - _className = value.componentName!; - _classId = value.id!; - _withoutBUCC = - value.withoutBucc == '1' ? true : false; - ; - }); - formKey.currentState!.patchValue( - {'unitValue': value.maxDeductBaserate}); - } - }, - ), - ), - const SizedBox(height: 10), - Container( - margin: const EdgeInsets.only( - left: 0, top: 10, right: 0, bottom: 0), - child: SizedBox( - height: 45, - child: SearchField( - itemHeight: 70, - suggestions: widget.unit - .map((UnitConstruct unit) => - SearchFieldListItem( - unit.bldgType! + - ' - ' + - unit.building, - item: unit, - child: ListTile( - title: Text( - unit.bldgType + - ' - ' + - unit.building!.toUpperCase(), - overflow: TextOverflow.ellipsis, - ), - ))) - .toList(), - - validator: FormBuilderValidators.required( - errorText: "This field is required"), - - searchInputDecoration: normalTextFieldStyle( - "Structure Type", "") - .copyWith( - suffixIcon: - const Icon(Icons.arrow_drop_down)), - ////agency suggestion tap - focusNode: focus, - suggestionState: Suggestion.expand, - onSuggestionTap: (unit) { - setState(() { - _unitBase = - double.parse(unit.item!.unitValue); - _structureType = unit.item!.bldgType + - ' - ' + - unit.item!.building; - }); - focus.unfocus(); - }, - ), - ), - ), - // const SizedBox(height: 10), - // Container( - // margin: const EdgeInsets.only( - // left: 0, top: 10, right: 0, bottom: 0), - // child: FormBuilderDropdown( - // name: 'struc_type', - // autofocus: false, - // decoration: - // normalTextFieldStyle("Structure Type", ""), - // items: widget.unit - // .map((e) => DropdownMenuItem( - // value: e, - // child: - // Text(e.bldgType + " - " + e.building), - // )) - // .toList(), - // onChanged: (val) { - // setState(() { - // _unitBase = double.parse(val!.unitValue); - // _structureType = val.bldgType; - // }); - // }, - // ), - // ), - const SizedBox(height: 10), - Row( - children: [ - Expanded( - flex: 1, - child: FormBuilderTextField( - name: 'unitValue', - decoration: - normalTextFieldStyle("Unit Value", ""), - validator: FormBuilderValidators.compose([]), - ), - ), - const SizedBox(width: 10), - Expanded( - flex: 1, - child: FormBuilderTextField( - name: 'areaValue', - decoration: normalTextFieldStyle("Area", ""), - validator: FormBuilderValidators.compose([]), - onChanged: (value) { - setState(() { - _areaValue = int.parse(value!); - }); - }, - ), - ), - ], - ), - // const SizedBox(height: 10), - // FormBuilderTextField( - // name: 'depRate', - // decoration: - // normalTextFieldStyle("Depreciation Rate", ""), - // validator: FormBuilderValidators.compose([]), - // onChanged: (value) { - // setState(() { - // _depValue = double.parse(value!); - // }); - // }, - // ), - // const SizedBox(height: 10), - // FormBuilderTextField( - // name: 'marketValue', - // decoration: normalTextFieldStyle( - // NumberFormat.currency( - // locale: 'en-PH', symbol: "₱") - // .format(_totalMarketValue(_unitValue, - // _unitBase, _areaValue, _depValue)), - // ""), - // validator: FormBuilderValidators.compose([]), - // onChanged: (value) { - // setState(() { - // _marketValue = double.parse(value!); - // }); - // }, - // ), - // const SizedBox(height: 10), - // Text('Amount of Depreciation'), - // const SizedBox(height: 5), - // Container( - // height: 45.0, - // width: double.infinity, - // decoration: BoxDecoration( - // color: Colors.white, - // border: Border.all( - // color: Colors.grey, - // width: 1.0, - // ), - // borderRadius: BorderRadius.circular(5.0), - // ), - // child: Align( - // alignment: Alignment.center, - // child: Text(NumberFormat.currency( - // locale: 'en-PH', symbol: "₱") - // .format(_amountofDepreciation(_unitValue, - // _unitBase, _areaValue, _depValue)))), - // ), - - Visibility( - visible: !_withoutBUCC, - child: Column( - children: [ - const SizedBox(height: 10), - Text('Building is not painted?'), - const SizedBox(height: 5), - Container( - child: Row( - children: [ - Checkbox( - value: isPainted, - onChanged: (bool? value) { - setState(() { - isPainted = value!; - if (value == false) { - _notPaintedUnitVal = 0; - } else { - _notPaintedUnitVal = 10; - } - }); - }, - ), - const SizedBox(width: 10), - Container( - height: 40.0, - width: 100, - decoration: BoxDecoration( - color: Colors.white, - border: Border.all( - color: Colors.grey, - width: 1.0, - ), - borderRadius: - BorderRadius.circular(5.0), - ), - child: Align( - alignment: Alignment.center, - child: Text(' - ' + - _notPaintedUnitVal.toString() + - '%')), - ), - ], - ), - ), - const SizedBox(height: 10), - Text('Uses second hand materials?'), - const SizedBox(height: 5), - Container( - child: Row( - children: [ - Checkbox( - value: isSecondHand, - onChanged: (bool? value) { - setState(() { - isSecondHand = value!; - if (isSecondHand == false) { - _secondHandUnitVal = 0; - formKey.currentState!.patchValue( - {'secondHandMat': '0'}); - } else { - _secondHandUnitVal = 5; - formKey.currentState!.patchValue( - {'secondHandMat': '5'}); - } - }); - }, - ), - const SizedBox(width: 10), - Row( - children: [ - SizedBox( - height: 40, - width: 100, - child: FormBuilderTextField( - enabled: isSecondHand, - name: 'secondHandMat', - textAlign: TextAlign.center, - decoration: normalTextFieldStyle( - "Unit Value", ""), - validator: - FormBuilderValidators.compose( - []), - onChanged: (value) { - // Check if the value is not null before parsing to double - if (value != null && - value.isNotEmpty) { - setState(() { - _secondHandUnitVal = - int.parse(value); - }); - } else { - // Handle the case when the value is empty or null - // For example, set _secondHandUnitVal to a default value or show an error message. - } - }, - ), - ), - SizedBox( - height: 40, - width: 40, - child: Center( - child: Text( - '%', - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold), - ), - ), - ) - ], - ), - ], - ), - ), - ], - ), - ), - - const SizedBox(height: 10), - Text('Market Value'), - const SizedBox(height: 5), - Container( - height: 45.0, - width: double.infinity, - decoration: BoxDecoration( - color: Colors.white, - border: Border.all( - color: Colors.grey, - width: 1.0, - ), - borderRadius: BorderRadius.circular(5.0), - ), - child: Align( - alignment: Alignment.center, - child: Text(NumberFormat.currency( - locale: 'en-PH', symbol: "₱") - .format(_totalMarketValue( - _unitValue, - _unitBase, - _areaValue, - _depValue, - _withoutBUCC, - _className, - isPainted, - isSecondHand, - _notPaintedUnitVal, - _secondHandUnitVal)))), - ), - const SizedBox(height: 10), - Row( - children: [ - Container( - width: 120, - height: 60, - padding: const EdgeInsets.all(8.0), - child: ElevatedButton( - onPressed: () { - var itemss = AdditionalItems( - id: 1, - bldgapprDetailsId: widget.tempId, - classId: _classId, - className: _className, - structType: _structureType, - unitValue: - _withoutBUCC == true ? 0 : _unitValue, - baseUnitValue: _unitBase, - area: _areaValue, - marketValue: - (_unitValue * _unitBase) * _areaValue, - depreciationRate: _depValue, - adjustedMarketVal: _totalMarketValue( - _unitValue, - _unitBase, - _areaValue, - _depValue, - _withoutBUCC, - _className, - isPainted, - isSecondHand, - _notPaintedUnitVal, - _secondHandUnitVal), - actualUse: 'Test', - amtDepreciation: _amountofDepreciation( - _unitValue, - _unitBase, - _areaValue, - _depValue, - ), - painted: isPainted == true ? '1' : '0', - secondhand: - isSecondHand == true ? '1' : '0', - paintedUnitval: '1', - secondhandUnitval: '1'); - - context.read().add( - AddAdditionalItemsEdit(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/edit_building/additional_items.dart b/lib/screens/passo/Building/edit_building/additional_items.dart deleted file mode 100644 index cdc0c20..0000000 --- a/lib/screens/passo/Building/edit_building/additional_items.dart +++ /dev/null @@ -1,329 +0,0 @@ -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:intl/intl.dart'; -import 'package:unit2/bloc/passo/bulding/additional_item/additional_item_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/additional_items_edit/additional_items_edit_bloc.dart'; -import 'package:unit2/model/passo/additional_items.dart'; -import 'package:unit2/model/passo/class_components%20_offline.dart'; -import 'package:unit2/model/passo/class_components.dart'; -import 'package:unit2/model/passo/unit_construct.dart'; -import 'package:unit2/screens/passo/Building/edit_building/AddExtraItems.dart'; -import 'package:unit2/utils/alerts.dart'; -import 'package:unit2/widgets/passo/custom_button.dart'; - -class AdditionalItemEditPage extends StatefulWidget { - final List unit; - final List options; - final int tempId; - final VoidCallback NextBtn; - final VoidCallback PrevBtn; - - AdditionalItemEditPage( - this.unit, this.options, this.tempId, this.NextBtn, this.PrevBtn); - - @override - _AdditionalItemEditPage createState() => _AdditionalItemEditPage(); -} - -class _AdditionalItemEditPage extends State { - void deleteItem(int itemId) { - context - .read() - .add(DeleteAdditionalItemsEdit(id: itemId)); - } - - // double _totalMarketValue(items) { - // double total = 0; - // items.forEach((row) { - // total += double.parse(row.adjustedMarketVal); - // }); - // return total; - // } - - @override - Widget build(BuildContext context) { - return Scaffold( - body: ProgressHUD( - padding: const EdgeInsets.all(24), - backgroundColor: Colors.black87, - indicatorWidget: const SpinKitFadingCircle(color: Colors.white), - child: BlocConsumer( - listener: (context, state) { - if (state is AdditionalItemsEditLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - if (state is AdditionalItemsEditLoaded) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - if (state is AdditionalItemsEditErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, - builder: (context, state) { - final state = context.watch().state; - if (state is AdditionalItemsEditLoaded) { - return Column( - children: [ - Container( - height: 500, - child: Expanded( - child: SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - children: [ - Container( - margin: const EdgeInsets.only( - left: 0, top: 20, right: 0, bottom: 10), - child: const Text('ADDITIONAL ITEMS', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18), - textAlign: TextAlign.left), - ), - Align( - alignment: Alignment.topRight, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: Colors.red, - ), - onPressed: () { - context - .read() - .add(ShowAdditionalItemsEdit()); - }, - 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.adjustedMarketVal))) - .toString())), - DataCell(Row( - children: [ - InkWell( - child: Container( - height: 30, - width: 30, - decoration: const BoxDecoration( - shape: BoxShape.circle, - color: Colors.red, - ), - child: Icon( - Icons.delete, - color: Colors.white, - size: 20.0, - ), - ), - onTap: () { - deleteItem(dataRow.id); - }, - ), - SizedBox( - width: 10, - ), - InkWell( - child: Container( - height: 30, - width: 30, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.red, - ), - child: Icon( - Icons.edit, - color: Colors.white, - size: 20.0, - ), - ), - onTap: () {}, - ), - ], - )) - ], - ); - }).toList(), - ), - ), - ], - ), - ), - ), - ), - ), - // Padding( - // padding: const EdgeInsets.only(left: 20.0, right: 20.0), - // child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // Text( - // 'Total', - // style: - // TextStyle(fontWeight: FontWeight.bold, fontSize: 15), - // ), - // Text( - // NumberFormat.currency(locale: 'en-PH', symbol: "₱") - // .format(_totalMarketValue(state.items)), - // style: - // TextStyle(fontWeight: FontWeight.bold, fontSize: 15), - // ) - // ], - // ), - // ), - Padding( - padding: const EdgeInsets.all(15.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - CustomButton( - icon: const Icon(Icons.chevron_left_rounded, - color: Colors.white), - onPressed: () { - { - widget.PrevBtn(); - } - ; - }, - ), - CustomButton( - icon: const Icon(Icons.chevron_right_rounded, - color: Colors.white), - onPressed: () { - { - widget.NextBtn(); - } - ; - }, - ) - ], - ), - ), - ], - ); - } - if (state is AdditionalItemsEditDeletedState) { - if (state.success) { - WidgetsBinding.instance.addPostFrameCallback((_) { - successAlert(context, "Deletion Successful", - "Extra item has been deleted successfully", () { - Navigator.of(context).pop(); - context.read().add( - LoadAdditionalItemsEdit( - items: const [], - id: widget.tempId)); - }); - }); - } - } - if (state is ShowAddItemsScreenEdit) { - return ConstrainedBox( - constraints: BoxConstraints(maxHeight: 1000.0), - child: AlertDialog( - insetPadding: EdgeInsets.symmetric( - horizontal: 20.0, - vertical: 10.0, - ), - title: Text( - 'ADD EXTRA ITEMS', - textAlign: TextAlign.center, - ), - content: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: AddExtraItemsEdit( - widget.unit, widget.options, widget.tempId)) - ], - ), - ), - ); - } - return Container( - child: Column( - children: [ - Container( - margin: const EdgeInsets.only( - left: 0, top: 20, right: 0, bottom: 10), - child: const Text('ADDITIONAL MATERIALS', - style: TextStyle( - fontWeight: FontWeight.bold, fontSize: 18), - textAlign: TextAlign.left), - ), - Align( - alignment: Alignment.topRight, - child: ElevatedButton( - onPressed: () { - context - .read() - .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/edit_building/bldgloc_landref.dart b/lib/screens/passo/Building/edit_building/bldgloc_landref.dart deleted file mode 100644 index f0d70b7..0000000 --- a/lib/screens/passo/Building/edit_building/bldgloc_landref.dart +++ /dev/null @@ -1,419 +0,0 @@ -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/barangay/barangay_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/landref/landref_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/location/location_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart'; - -import 'package:unit2/bloc/passo/municipality/municipality_bloc.dart'; - -import 'package:unit2/model/passo/barangay.dart'; -import 'package:unit2/model/passo/bldg_loc.dart'; -import 'package:unit2/model/passo/city.dart'; -import 'package:unit2/model/passo/land_ref.dart'; -import 'package:unit2/screens/passo/Building/edit_building/property_owner_info.dart'; -import 'package:unit2/theme-data.dart/form-style.dart'; -import 'package:unit2/utils/text_container.dart'; -import 'package:unit2/widgets/error_state.dart'; -import 'package:unit2/widgets/passo/custom_button.dart'; -import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart'; - -class BldgLocLandRefEdit extends StatefulWidget { - final int tempId; - final VoidCallback NextBtn; - final VoidCallback PrevBtn; - - BldgLocLandRefEdit(this.tempId, this.NextBtn, this.PrevBtn); - @override - _BldgLocLandRefEdit createState() => _BldgLocLandRefEdit(); -} - -class _BldgLocLandRefEdit extends State { - Set seenCityCodes = Set(); - @override - Widget build(BuildContext context) { - return Scaffold( - body: ProgressHUD( - padding: const EdgeInsets.all(24), - backgroundColor: Colors.black87, - indicatorWidget: const SpinKitFadingCircle(color: Colors.white), - child: BlocConsumer( - listener: (context, state) { - if (state is LocationLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - - if (state is LocationErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, - builder: (context, state) { - if (state is LocationLoaded) { - final bldgloc = state.bldgloc; - return BlocConsumer( - listener: (context, state) { - if (state is LandrefLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - if (state is LandrefErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, - builder: (context, state) { - if (state is LandrefLoaded) { - final landRef = state.landRef; - return BlocConsumer( - listener: (context, state) { - if (state is MunicipalityLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - if (state is MunicipalityErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, builder: (context, state) { - if (state is MunicipalityLoaded) { - final cityList = state.municipality; - Set uniqueItems = {}; - - // Iterate through the dropdownItems list to filter out duplicates - for (var item in cityList) { - uniqueItems.add(item); - } - return BlocConsumer( - listener: (context, state) { - if (state is BarangayLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - if (state is BarangayLoaded) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - if (state is BarangayErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, builder: (context, state) { - if (state is BarangayLoaded) { - List brgyList = state.brgy; - List brgyNAmes = brgyList - .map((brgy) => brgy.barangayDescription) - .toList() - .cast(); - return FormBuilder( - key: keys, - initialValue: { - 'street': bldgloc.street ?? "", - 'province': bldgloc.province ?? "", - 'l_owner': landRef.owner, - 'oct_tct_cloa': landRef.cloaNo ?? "", - 'survey_no': landRef.surveyNo ?? "", - 'lot_no': landRef.lotNo ?? "", - 'blk_no': landRef.blkNo ?? "", - 'l_td_arp': landRef.tdn ?? "", - 'area': landRef.area ?? "" - }, - enabled: true, - onChanged: () { - keys.currentState!.save(); - debugPrint(keys.currentState!.value.toString()); - }, - autovalidateMode: AutovalidateMode.disabled, - skipDisabled: true, - child: SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.all(20.0), - child: ListView( - shrinkWrap: true, - children: [ - Container( - margin: const EdgeInsets.only( - left: 0, - top: 20, - right: 0, - bottom: 10), - child: const Text('BUILDING LOCATION', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18), - textAlign: TextAlign.left), - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - children: [ - Expanded( - flex: 1, - child: FormBuilderDropdown( - name: 'municipality', - autofocus: false, - decoration: - normalTextFieldStyle( - bldgloc.municipality ?? - "Municipality", - "", - ), - items: uniqueItems - .map( - (city) => - DropdownMenuItem< - City>( - value: city, - child: Text( - city.cityDescription ?? - ''), - ), - ) - .toList(), - onChanged: (selectedCityCode) { - // Find the corresponding City object using selectedCityCode - final selectedCity = cityList - .firstWhere((city) => - city.cityCode == - selectedCityCode); - - final barangayBloc = context - .read(); - barangayBloc.add(LoadBarangay( - id: selectedCityCode! - .cityCode!)); - }, - ), - ), - 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')) - ]), - 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: customDropDownField( - bldgloc.barangay ?? "", - "Barangay", - 'brgy', - brgyNAmes)) - ]), - Container( - margin: const EdgeInsets.only( - left: 0, - top: 20, - right: 0, - bottom: 10), - child: const Text('LAND REFERENCE', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18), - textAlign: TextAlign.left), - ), - customTextField( - "Land Owner", "", 'l_owner'), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - children: [ - 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: () { - { - widget.PrevBtn(); - } - ; - }, - ), - CustomButton( - icon: const Icon( - Icons.chevron_right_rounded, - color: Colors.white), - onPressed: () { - { - var bldgLocData = BldgLoc( - id: widget.tempId, - street: keys.currentState - ?.value['street'], - barangay: keys.currentState - ?.value['brgy'], - municipality: keys - .currentState - ?.value[ - 'municipality'] - ?.cityDescription ?? - bldgloc.municipality, - province: keys.currentState - ?.value['province'], - ); - var landRefData = LandRef( - id: widget.tempId, - owner: keys.currentState - ?.value['l_owner'], - cloaNo: keys.currentState - ?.value['oct_tct_cloa'], - lotNo: keys.currentState - ?.value['lot_no'], - tdn: keys.currentState - ?.value['l_td_arp'], - area: keys.currentState - ?.value['area'], - surveyNo: keys.currentState - ?.value['survey_no'], - blkNo: keys.currentState - ?.value['blk_no'], - ); - context.read() - ..add(UpdateBldgLoc( - bldg_loc: bldgLocData)) - ..add(UpdateLandRef( - land_ref: landRefData)); - - widget.NextBtn(); - } - ; - }, - ) - ], - ) - ], - ), - ), - ), - ); - } - if (state is BarangayErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context - .read() - .add(LoadBarangay(id: '01')); - }, - ); - } - return Container(); - }); - } - if (state is MunicipalityErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context - .read() - .add(LoadMunicipality()); - }, - ); - } - return Container(); - }); - } - if (state is LandrefErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context.read().add( - LoadLandref(id: widget.tempId, landRef: LandRef())); - }, - ); - } - return Container(); - }, - ); - } - - if (state is LocationErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context - .read() - .add(LoadLocation(id: widget.tempId, bldgloc: BldgLoc())); - }, - ); - } - return Container(); - }, - ), - ), - ); - } -} diff --git a/lib/screens/passo/Building/edit_building/general_description.dart b/lib/screens/passo/Building/edit_building/general_description.dart deleted file mode 100644 index 16c9957..0000000 --- a/lib/screens/passo/Building/edit_building/general_description.dart +++ /dev/null @@ -1,361 +0,0 @@ -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:shared_preferences/shared_preferences.dart'; -import 'package:unit2/bloc/passo/bulding/general_description/general_description_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart'; -import 'package:unit2/model/passo/general_description.dart'; -import 'package:unit2/model/passo/unit_construct.dart'; -import 'package:unit2/screens/passo/Building/edit_building/property_owner_info.dart'; -import 'package:unit2/theme-data.dart/form-style.dart'; -import 'package:unit2/utils/text_container.dart'; -import 'package:unit2/widgets/error_state.dart'; -import 'package:unit2/widgets/passo/custom_button.dart'; -import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart'; - -import '../add_building.dart'; - -class GeneralDescriptionEdit extends StatefulWidget { - final List unit; - final int tempId; - final VoidCallback NextBtn; - final VoidCallback PrevBtn; - - GeneralDescriptionEdit(this.unit, this.tempId, this.NextBtn, this.PrevBtn); - @override - _GeneralDescriptionEdit createState() => _GeneralDescriptionEdit(); -} - -class _GeneralDescriptionEdit extends State { - final actual_use = [ - "Residential", - "Agricultural", - "Commercial", - "Industrial", - "Mineral", - "Timberland", - ]; - - @override - Widget build(BuildContext context) { - return Scaffold( - body: Column( - children: [ - Expanded( - child: ProgressHUD( - padding: const EdgeInsets.all(24), - backgroundColor: Colors.black87, - indicatorWidget: const SpinKitFadingCircle(color: Colors.white), - child: - BlocConsumer( - listener: (context, state) async { - if (state is GenDescLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - if (state is GenDescLoaded) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - - final tempID = await SharedPreferences.getInstance(); - await tempID.setInt( - 'totalValue', int.parse(state.gendesc.totalFloorArea!)); - await tempID.setString( - 'actualUse', state.gendesc.actualUse!); - } - if (state is GenDescErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, - builder: (context, state) { - if (state is GenDescLoaded) { - return FormBuilder( - key: keys, - initialValue: { - 'bldg_permit': state.gendesc.bldgPermit, - 'date_issued': state.gendesc.dateIssued.toString(), - 'cct': state.gendesc.cct.toString(), - 'coc_issued': - state.gendesc.certCompletionIssued.toString(), - 'coo_issued': - state.gendesc.certOccupancyIssued.toString(), - 'date_cnstructed': state.gendesc.dateIssued.toString(), - 'date_occupied': state.gendesc.dateOccupied.toString(), - 'bldg_age': state.gendesc.bldgAge.toString(), - 'no_of_storeys': state.gendesc.noStoreys.toString(), - 'area_of_1stFl': state.gendesc.area1Stfloor, - 'area_of_2ndFl': state.gendesc.area2Ndfloor, - 'area_of_3rdFl': state.gendesc.area3Rdfloor, - 'area_of_4thFl': state.gendesc.area4Thfloor, - 'total_area': state.gendesc.totalFloorArea.toString(), - 'actual_use': state.gendesc.actualUse - }, - enabled: true, - onChanged: () { - keys.currentState!.save(); - debugPrint(keys.currentState!.value.toString()); - }, - autovalidateMode: AutovalidateMode.disabled, - skipDisabled: true, - child: Expanded( - child: SingleChildScrollView( - scrollDirection: Axis.vertical, - child: Padding( - padding: const EdgeInsets.all(20.0), - child: Column( - children: [ - Container( - margin: const EdgeInsets.only( - left: 0, top: 20, right: 0, bottom: 10), - child: const Text('GENERAL DESCRIPTION', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18), - textAlign: TextAlign.left), - ), - Container( - margin: const EdgeInsets.only( - left: 0, top: 10, right: 0, bottom: 0), - child: FormBuilderDropdown( - name: 'bldg_type', - autofocus: false, - decoration: normalTextFieldStyle( - state.gendesc.bldgKind ?? - "Kind of Building", - "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: [ - 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: () { - { - widget.PrevBtn(); - } - ; - }, - ), - CustomButton( - icon: const Icon( - Icons.chevron_right_rounded, - color: Colors.white), - onPressed: () { - { - keys.currentState!.save(); - var genDescData = GeneralDesc( - id: widget.tempId, - bldgKind: keys - .currentState - ?.value['bldg_type'] - ?.building ?? - state.gendesc.bldgKind, - strucType: keys - .currentState - ?.value['bldg_type'] - ?.bldgType ?? - state.gendesc.strucType, - bldgPermit: keys.currentState - ?.value['bldg_permit'], - dateIssued: keys.currentState - ?.value['coc_issued'], - cct: keys - .currentState?.value['cct'], - certCompletionIssued: keys - .currentState - ?.value['coc_issued'], - certOccupancyIssued: keys - .currentState - ?.value['coo_issued'], - dateCompleted: - keys.currentState?.value['date_cnstructed'], - dateOccupied: keys.currentState?.value['date_occupied'], - bldgAge: keys.currentState?.value['bldg_age'], - noStoreys: keys.currentState?.value['no_of_storeys'], - area1Stfloor: keys.currentState?.value['area_of_1stFl'], - area2Ndfloor: keys.currentState?.value['area_of_2ndFl'], - area3Rdfloor: keys.currentState?.value['area_of_3rdFl'], - area4Thfloor: keys.currentState?.value['area_of_4thFl'], - totalFloorArea: keys.currentState?.value['total_area'], - floorSketch: null, - actualUse: keys.currentState?.value['actual_use']); - - context.read() - ..add(UpdateGeneralDesc( - gen_desc: genDescData)); - - widget.NextBtn(); - } - ; - }, - ) - ], - ) - ], - ), - ), - ), - ), - ); - } - if (state is GenDescErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context.read().add(LoadGenDesc( - id: widget.tempId, gendesc: GeneralDesc())); - }, - ); - } - return Container(); - }, - ), - ), - ), - ], - ), - ); - } -} diff --git a/lib/screens/passo/Building/edit_building/property_appraisal.dart b/lib/screens/passo/Building/edit_building/property_appraisal.dart deleted file mode 100644 index aa6a967..0000000 --- a/lib/screens/passo/Building/edit_building/property_appraisal.dart +++ /dev/null @@ -1,1244 +0,0 @@ -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:form_builder_validators/form_builder_validators.dart'; -import 'package:intl/intl.dart'; -import 'package:shared_preferences/shared_preferences.dart'; - -import 'package:unit2/bloc/passo/bulding/additional_items_edit/additional_items_edit_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/general_description/general_description_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/property_appraisal_edit/property_appraisal_edit_bloc.dart'; - -import 'package:unit2/model/passo/additional_items.dart'; -import 'package:unit2/model/passo/property_appraisal.dart'; -import 'package:unit2/model/passo/property_appraisal_edit.dart'; -import 'package:unit2/screens/passo/Building/edit_building/property_owner_info.dart'; -import 'package:unit2/theme-data.dart/form-style.dart'; -import 'package:unit2/utils/text_container.dart'; -import 'package:unit2/widgets/error_state.dart'; -import 'package:unit2/widgets/passo/custom_button.dart'; - -class PropertyAppraisalEditPage extends StatefulWidget { - final int tempId; - final VoidCallback NextBtn; - final VoidCallback PrevBtn; - - PropertyAppraisalEditPage(this.tempId, this.NextBtn, this.PrevBtn); - - @override - _PropertyAppraisalEditPage createState() => _PropertyAppraisalEditPage(); -} - -class _PropertyAppraisalEditPage extends State { - double depRate = 0; - // int totalAreas = 0; - // String actualUse = ""; - - // @override - // void initState() { - // super.initState(); - // _loadDataFromSharedPreferences(); // Call the method to load data - // } - - // Method to load data from SharedPreferences - // _loadDataFromSharedPreferences() async { - // SharedPreferences prefs = await SharedPreferences.getInstance(); - // setState(() { - // actualUse = prefs.getString('actualUse') ?? ''; - // totalAreas = prefs.getInt('totalArea') ?? - // 0; // Provide a default value if the key doesn't exist - // }); - // } - - calculateAdditionalItems(List items) { - double sum = 0; - double product = 1; - - for (AdditionalItems value in items) { - sum += double.parse(value.adjustedMarketVal); - } - - 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; - } - - calculateConstructionCost(constructioncost, addtionalCost) { - double sum = 0; - sum = constructioncost + addtionalCost; - - return sum; - } - - String assessmentLevel(marketValues, property_class) { - final marketValue = double.parse(marketValues); - 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(marketValues, property_class) { - final marketValue = double.parse(marketValues); - 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 ProgressHUD( - padding: const EdgeInsets.all(24), - backgroundColor: Colors.black87, - indicatorWidget: const SpinKitFadingCircle(color: Colors.white), - child: - BlocConsumer( - listener: (context, state) { - if (state is PropertyAppraisalEditLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - - if (state is PropertyAppraisalEditErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, - builder: (context, state) { - if (state is PropertyAppraisalEditLoaded) { - final appraisal = state.appraisalEdit; - return BlocConsumer(listener: (context, state) { - if (state is PropertyAppraisalEditLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - if (state is AdditionalItemsEditLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - if (state is AdditionalItemsEditErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, builder: (context, state) { - if (state is AdditionalItemsEditLoaded) { - final item = state.items; - - return BlocConsumer( - listener: (context, state) { - if (state is GenDescLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - if (state is GenDescLoaded) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - if (state is GenDescErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, - builder: (context, state) { - if (state is GenDescLoaded) { - double totalArea = double.tryParse( - (state.gendesc.totalFloorArea ?? - appraisal.totalArea) - ?.toString() ?? - '0.0') ?? - 0.0; - - double bldgUnitValue = double.tryParse(keys.currentState - ?.value['bldg_type']?.unitValue ?? - appraisal.unitconstructCost) ?? - 0.0; - return Column( - children: [ - Expanded( - child: 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: const Text( - "Unit Construction Cost", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 13), - textAlign: TextAlign.left, - ), - ), - Container( - child: Text( - bldgUnitValue.toString() + ' sq.m', - textAlign: TextAlign.right, - ), - ) - ], - ), - const SizedBox(height: 15), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - child: const Text( - "Building Core", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 13), - textAlign: TextAlign.left, - ), - ), - Container( - child: const Text( - '', - textAlign: TextAlign.right, - ), - ) - ], - ), - const SizedBox(height: 40), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - child: const Text( - "Sub-total", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 13), - textAlign: TextAlign.left, - ), - ), - Container( - child: Text( - bldgUnitValue.toString(), - textAlign: TextAlign.right, - ), - ) - ], - ), - const SizedBox(height: 40), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - child: const Text( - "Cost of Additional Items", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 13), - textAlign: TextAlign.left, - ), - ), - Container( - child: const Text( - '', - textAlign: TextAlign.right, - ), - ) - ], - ), - const SizedBox(height: 15), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - child: const Text( - "Sub-total", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 13), - textAlign: TextAlign.left, - ), - ), - Container( - child: Text( - appraisal.addItemsSubtotal ?? - '0.00', - textAlign: TextAlign.right, - ), - ) - ], - ), - const SizedBox(height: 15), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - child: const Text( - "Total Construction Cost", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 13), - textAlign: TextAlign.left, - ), - ), - Container( - child: Text( - calculateConstructionCost( - double.parse(appraisal - .unitconstructSubtotal!), - double.parse(appraisal - .addItemsSubtotal!)) - .toString(), - textAlign: TextAlign.right, - ), - ) - ], - ), - const SizedBox(height: 40), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - child: const 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: const Text( - "Depreciation Cost", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 13), - textAlign: TextAlign.left, - ), - ), - Container( - child: Text( - calculateDepCost( - (totalArea * bldgUnitValue), - item, - double.parse(keys - .currentState - ?.value[ - 'depRate'] ?? - appraisal - .depreciationRate)) - .toString(), - textAlign: TextAlign.right, - ), - ) - ], - ), - const SizedBox(height: 15), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - child: const Text( - "Total % Depreciation", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 13), - textAlign: TextAlign.left, - ), - ), - Container( - child: Text( - '${(double.parse(keys.currentState?.value['depRate'] ?? appraisal.depreciationRate) * 100).toStringAsFixed(2)}%', - textAlign: TextAlign.right, - ), - ) - ], - ), - const SizedBox(height: 15), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - child: const Text( - "Market Value", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 13), - textAlign: TextAlign.left, - ), - ), - Container( - child: Text( - calculateMarketValue( - (totalArea * bldgUnitValue), - item, - double.parse(keys - .currentState - ?.value[ - 'depRate'] ?? - appraisal - .depreciationRate)) - .toString(), - textAlign: TextAlign.right, - ), - ) - ], - ), - Row( - children: [ - Expanded( - flex: 1, - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Container( - margin: - const EdgeInsets.symmetric( - horizontal: 20.0), - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Container( - margin: const EdgeInsets - .fromLTRB(0, 20, 0, 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: 150, - 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: 150, - 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: 50, - child: - SingleChildScrollView( - scrollDirection: - Axis.horizontal, - child: Row(children: [ - 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( - state.gendesc - .actualUse ?? - "", - style: - const TextStyle( - fontWeight: - FontWeight.bold, - fontSize: - 13, - ), - textAlign: - TextAlign - .center, - ), - ), - Container( - width: 150, - margin: const EdgeInsets - .only( - top: 15, - left: - 15), - padding: - const EdgeInsets.all( - 5.0), - child: Text( - NumberFormat - .currency( - locale: - 'en-PH', - symbol: - "₱", - ).format( - calculateMarketValue( - (totalArea * - bldgUnitValue), - item, - double.parse(keys.currentState?.value['depRate'] ?? - appraisal.depreciationRate)), - ), - style: - const 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(calculateMarketValue((totalArea * bldgUnitValue), item, double.parse(keys.currentState?.value['depRate'] ?? appraisal.depreciationRate)).toString(), state.gendesc.actualUse)}%', - style: - const TextStyle( - fontWeight: - FontWeight.bold, - fontSize: - 13, - ), - textAlign: - TextAlign - .center, - ), - ), - Container( - width: 150, - margin: const EdgeInsets - .only( - top: 15, - left: - 15), - padding: - const EdgeInsets.all( - 5.0), - child: Text( - NumberFormat - .currency( - locale: - 'en-PH', - symbol: - "₱", - ).format(assessmentValue( - calculateMarketValue((totalArea * bldgUnitValue), item, double.parse(keys.currentState?.value['depRate'] ?? appraisal.depreciationRate)) - .toString(), - state - .gendesc - .actualUse)), - style: - const TextStyle( - fontWeight: - FontWeight.bold, - fontSize: - 13, - ), - textAlign: - TextAlign - .center, - ), - ), - const SizedBox( - height: 80, - ), - ], - ), - ) - ]), - ), - ) - ], - ) - ], - ), - ), - ), - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - children: [ - CustomButton( - icon: const Icon( - Icons.chevron_left_rounded, - color: Colors.white), - onPressed: () { - { - widget.PrevBtn(); - } - ; - }, - ), - CustomButton( - icon: const Icon( - Icons.chevron_right_rounded, - color: Colors.white), - onPressed: () async { - final tempID = - await SharedPreferences - .getInstance(); - - final id = - tempID.getInt('tempid')! - 1; - { - var appraisals = PropertyAppraisalEdit( - id: 1, - bldgapprDetailsId: id, - unitconstructCost: - bldgUnitValue.toString(), - buildingCore: 'test', - unitconstructSubtotal: - (totalArea * bldgUnitValue) - .toString(), - depreciationRate: - depRate.toString(), - depreciationCost: - calculateDepCost((totalArea * bldgUnitValue), item, depRate) - .toString(), - costAddItems: - calculateAdditionalItems(item) - .toString(), - addItemsSubtotal: - calculateAdditionalItems(item) - .toString(), - totalpercentDepreciation: - (depRate * 100) - .toStringAsFixed(2), - marketValue: calculateMarketValue( - (totalArea * bldgUnitValue), - item, - depRate) - .toString(), - totalArea: totalArea.toString()); - context - .read< - PropertyAppraisalEditBloc>() - .add( - UpdatePropertyAppraisalEdit( - appraisalEdit: - appraisals, - id: widget.tempId)); - - widget.NextBtn(); - } - ; - }, - ) - ], - ) - ], - ), - ), - ), - ), - ], - ); - } - return Container(); - }, - ); - } - return Container(); - }); - } - if (state is PropertyAppraisalEditErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context - .read() - .add(LoadPropertyAppraisalEdit( - appraisalEdit: PropertyAppraisalEdit(), - id: widget.tempId, - )); - }, - ); - } - return Container(); - }, - ), - ); - } -} diff --git a/lib/screens/passo/Building/edit_building/property_assessement_edit.dart b/lib/screens/passo/Building/edit_building/property_assessement_edit.dart deleted file mode 100644 index 97bb863..0000000 --- a/lib/screens/passo/Building/edit_building/property_assessement_edit.dart +++ /dev/null @@ -1,1176 +0,0 @@ -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:form_builder_validators/form_builder_validators.dart'; -import 'package:intl/intl.dart'; -import 'package:searchfield/searchfield.dart'; -import 'package:unit2/bloc/passo/bulding/property_appraisal_edit/property_appraisal_edit_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/property_assessment_edit/property_assessment_edit_bloc.dart'; -import 'package:unit2/bloc/passo/memoranda/memoranda_bloc.dart'; -import 'package:unit2/bloc/passo/signatories/signatories_bloc.dart'; -import 'package:unit2/model/passo/memoranda.dart'; -import 'package:unit2/model/passo/property_appraisal.dart'; -import 'package:unit2/model/passo/property_appraisal_edit.dart'; -import 'package:unit2/model/passo/property_assessment_edit.dart'; -import 'package:unit2/model/passo/signatories.dart'; -import 'package:unit2/screens/passo/Building/add_building.dart'; -import 'package:unit2/screens/passo/Building/edit_building/property_owner_info.dart'; -import 'package:unit2/theme-data.dart/btn-style.dart'; -import 'package:unit2/theme-data.dart/colors.dart'; -import 'package:unit2/theme-data.dart/form-style.dart'; -import 'package:unit2/utils/text_container.dart'; -import 'package:unit2/widgets/error_state.dart'; - -import '../../../../model/passo/general_description.dart'; - -class PropertyAssessmentEditPage extends StatefulWidget { - int tempId; - PropertyAssessmentEditPage(this.tempId); - @override - _PropertyAssessmentEditPage createState() => _PropertyAssessmentEditPage(); -} - -class _PropertyAssessmentEditPage extends State { - double assessment_level = 0; - bool isTaxable = false; - bool isExempt = false; - String _memoranda = ''; - final focus = FocusNode(); - - String assessmentLevel(marketValues, property_class) { - final marketValue = double.parse(marketValues); - 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(marketValues, property_class) { - final marketValue = double.parse(marketValues); - 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 ProgressHUD( - padding: const EdgeInsets.all(24), - backgroundColor: Colors.black87, - indicatorWidget: const SpinKitFadingCircle(color: Colors.white), - child: - BlocConsumer( - listener: (context, state) { - if (state is PropertyAssessmentEditLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - if (state is PropertyAssessmentEditLoaded) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - if (state is PropertyAssessmentEditErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, - builder: (context, state) { - if (state is PropertyAssessmentEditLoaded) { - final assessment = state.assessmentsEdit; - return BlocConsumer( - listener: (context, state) { - if (state is SignatoriesLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - - if (state is SignatoriesErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, - builder: (context, state) { - if (state is SignatoriesLoaded) { - final signatories = state.signatories; - - return BlocConsumer( - listener: (context, state) { - if (state is MemorandaLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - if (state is MemorandaLoaded) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - if (state is MemorandaErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, - builder: (context, state) { - if (state is MemorandaLoaded) { - return FormBuilder( - key: keys, - initialValue: { - 'qtr': assessment.qtr?.toString() ?? '', - 'yr': assessment.qtr?.toString() ?? '', - 'app_date': - assessment.appraisedbyDate?.toString() ?? '', - 'rec_date': - assessment.recommendapprDate?.toString() ?? '', - 'memoranda': assessment.memoranda ?? '', - 'sworn_statement': - assessment.swornstatementNo ?? '', - 'date_received': - assessment.dateReceived?.toString() ?? '', - 'date_of_entry': - assessment.entryDateAssessment?.toString() ?? - '', - 'by': assessment.entryDateBy ?? '', - }, - enabled: true, - onChanged: () { - keys.currentState!.save(); - debugPrint(keys.currentState!.value.toString()); - }, - autovalidateMode: AutovalidateMode.disabled, - skipDisabled: true, - child: Expanded( - child: Column( - children: [ - Container( - margin: - const EdgeInsets.fromLTRB(0, 20, 0, 20), - child: const Text( - 'PROPERTY ASSESSMENT cont..', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18, - ), - textAlign: TextAlign.left, - ), - ), - Expanded( - flex: 3, - child: SingleChildScrollView( - 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< - Signatories>( - name: 'appraised_by', - decoration: - InputDecoration( - labelText: assessment - .appraisedbyName ?? - "", - labelStyle: - const TextStyle( - color: Colors - .black), - ), - autofocus: false, - items: signatories - .map((signatories) => - DropdownMenuItem( - value: - signatories, - child: Text( - '${signatories.firstname} ${signatories.middlename} ${signatories.lastname}'), - )) - .toList()), - ), - Text('Name'), - ], - ), - const SizedBox( - width: 15, - ), - Column( - children: [ - SizedBox( - width: 100, - child: - FormBuilderDateTimePicker( - name: 'app_date', - initialEntryMode: - DatePickerEntryMode - .calendarOnly, - initialValue: - DateTime.now(), - inputType: InputType.date, - - initialTime: - const TimeOfDay( - hour: 8, - minute: 0), - // locale: const Locale.fromSubtags(languageCode: 'fr'), - ), - ), - Text('Date'), - ], - ), - ], - ), - const SizedBox( - height: 30, - ), - const Align( - alignment: Alignment.centerLeft, - child: Text( - 'RECOMMENDING APPROVAL:', - style: TextStyle( - fontWeight: - FontWeight.bold), - )), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - children: [ - Column( - children: [ - SizedBox( - width: 200, - child: FormBuilderDropdown< - Signatories>( - name: 'rec_approval', - decoration: - InputDecoration( - labelText: assessment - .recommendapprName ?? - "", - labelStyle: - const TextStyle( - color: Colors - .black), - ), - autofocus: false, - items: signatories - .map((signatories) => - DropdownMenuItem( - value: - signatories, - child: Text( - '${signatories.firstname} ${signatories.middlename} ${signatories.lastname}'), - )) - .toList()), - ), - Text('Name'), - ], - ), - const SizedBox( - width: 15, - ), - Column( - children: [ - SizedBox( - width: 100, - child: - FormBuilderDateTimePicker( - name: 'rec_date', - initialEntryMode: - DatePickerEntryMode - .calendarOnly, - initialValue: - DateTime.now(), - inputType: InputType.date, - - initialTime: - const TimeOfDay( - hour: 8, - minute: 0), - // locale: const Locale.fromSubtags(languageCode: 'fr'), - ), - ), - Text('Date'), - ], - ), - ], - ), - const SizedBox( - height: 30, - ), - const Align( - alignment: Alignment.centerLeft, - child: Text( - 'APPROVED BY:', - style: TextStyle( - fontWeight: FontWeight.bold, - ), - )), - Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Column( - children: [ - SizedBox( - width: 200, - child: FormBuilderDropdown< - Signatories>( - name: 'apprvd_by', - autofocus: false, - decoration: - InputDecoration( - labelText: assessment - .approvedbyName ?? - "", - labelStyle: - const TextStyle( - color: Colors - .black), - ), - items: signatories - .map((signatories) => - DropdownMenuItem( - value: - signatories, - child: Text( - '${signatories.firstname} ${signatories.middlename} ${signatories.lastname}'), - )) - .toList()), - ), - Text('Name'), - ], - ), - ], - ), - const SizedBox( - height: 50, - ), - const Align( - alignment: Alignment.centerLeft, - child: Text( - 'MEMORANDA: ', - style: TextStyle( - fontWeight: FontWeight.bold, - ), - )), - SizedBox( - height: 30, - ), - SizedBox( - width: 500, - height: 100, - child: SearchField( - itemHeight: 70, - - suggestions: state.memorada - .map( - (Memoranda memoranda) => - SearchFieldListItem( - '${memoranda.memoranda}', - item: - memoranda, // Change: Use individual Memoranda object - child: ListTile( - title: Text( - '${memoranda.memoranda}', - overflow: - TextOverflow - .ellipsis, - ), - ), - )) - .toList(), - validator: FormBuilderValidators - .required( - errorText: - "This field is required"), - // searchInputDecoration: - // normalTextFieldStyle( - // "Memoranda", "") - // .copyWith( - // suffixIcon: const Icon( - // Icons.arrow_drop_down), - // ), - // focusNode: focus, - suggestionState: - Suggestion.expand, - onSuggestionTap: (memoranda) { - setState(() { - _memoranda = memoranda - .item!.memoranda!; - }); - focus.unfocus(); - }, - )), - 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: - FormBuilderDateTimePicker( - name: 'date_received', - initialEntryMode: - DatePickerEntryMode - .calendarOnly, - initialValue: DateTime.now(), - inputType: InputType.date, - - initialTime: const TimeOfDay( - hour: 8, minute: 0), - // locale: const Locale.fromSubtags(languageCode: 'fr'), - ), - ), - ], - ), - SizedBox( - height: 30, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - 'Date of Entry in the Rec. of Ass. :'), - SizedBox( - width: 100, - height: 20, - child: - FormBuilderDateTimePicker( - name: 'date_of_entry', - initialEntryMode: - DatePickerEntryMode - .calendarOnly, - initialValue: DateTime.now(), - inputType: InputType.date, - - initialTime: const TimeOfDay( - hour: 8, minute: 0), - // locale: const Locale.fromSubtags(languageCode: 'fr'), - ), - ), - ], - ), - 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, - ), - SizedBox( - width: MediaQuery.of(context) - .size - .width, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: primary, - 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, - ), - ), - ), - onPressed: () { - final List< - PropertyAssessmentEdit> - propertyAssessments = []; - - PropertyAssessmentEdit ass = - PropertyAssessmentEdit( - id: 1, - bldgapprDetailsId: 440, - actualUse: - assessment.actualUse, - marketValue: '0.0', - assessmentLevel: '0.0', - assessedValue: "1.0", - taxable: isTaxable, - exempt: isExempt, - qtr: int.parse(keys - .currentState! - .value['qtr']), - yr: int.parse(keys - .currentState! - .value['yr']), - appraisedbyName: keys - .currentState! - .value['appraised_by'] - .firstname + - ' ' + - keys - .currentState! - .value['appraised_by'] - .middlename + - ' ' + - keys - .currentState! - .value['appraised_by'] - .lastname, - appraisedbyDate: keys - .currentState! - .value['app_date'], - recommendapprName: keys - .currentState! - .value['rec_approval'] - .firstname + - ' ' + - keys - .currentState! - .value['rec_approval'] - .middlename + - ' ' + - keys - .currentState! - .value['rec_approval'] - .lastname, - recommendapprDate: keys - .currentState! - .value['rec_date'], - approvedbyName: keys - .currentState! - .value['apprvd_by'] - .firstname + - ' ' + - keys - .currentState! - .value['apprvd_by'] - .middlename + - ' ' + - keys - .currentState! - .value['apprvd_by'] - .lastname, - memoranda: _memoranda, - swornstatementNo: keys - .currentState! - .value['sworn_statement'], - dateReceived: keys - .currentState! - .value['date_received'], - entryDateAssessment: keys - .currentState! - .value['date_of_entry'], - entryDateBy: keys - .currentState! - .value['by'], - ); - - propertyAssessments.add(ass); - - context - .read< - PropertyAssessmentEditBloc>() - .add(UpdatePropertyAssessmentEdit( - assessmentsEdit: - propertyAssessments[ - 0])); - }, - ), - ), - ], - ), - )) - ], - ), - ), - ); - } - if (state is MemorandaErrorState) { - return SomethingWentWrong( - message: state.error, - onpressed: () { - context - .read() - .add(const LoadMemoranda()); - }, - ); - } - return Container(); - }, - ); - } - if (state is SignatoriesErrorState) { - return SomethingWentWrong( - message: state.error, - onpressed: () { - context - .read() - .add(const LoadSignatories()); - }, - ); - } - return Container(); - }, - ); - } - if (state is PropertyAssessmentEditErrorState) { - return SomethingWentWrong( - message: state.error, - onpressed: () { - context.read().add( - LoadPropertyAssessmentEdit( - assessmentsEdit: PropertyAssessmentEdit(), - id: widget.tempId)); - }, - ); - } - return Container(); - }, - ), - ); - } -} diff --git a/lib/screens/passo/Building/edit_building/property_owner_info.dart b/lib/screens/passo/Building/edit_building/property_owner_info.dart deleted file mode 100644 index 4dc028b..0000000 --- a/lib/screens/passo/Building/edit_building/property_owner_info.dart +++ /dev/null @@ -1,254 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_form_builder/flutter_form_builder.dart'; -import 'package:flutter_localizations/flutter_localizations.dart'; -import 'package:flutter_progress_hud/flutter_progress_hud.dart'; -import 'package:form_builder_validators/form_builder_validators.dart'; -import 'package:multiselect/multiselect.dart'; -import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart'; -import 'package:unit2/model/passo/property_info.dart'; -import 'package:unit2/theme-data.dart/btn-style.dart'; -import 'package:unit2/theme-data.dart/colors.dart'; -import 'package:unit2/utils/text_container.dart'; -import 'package:unit2/widgets/error_state.dart'; -import 'package:unit2/widgets/passo/custom_button.dart'; -import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart'; - -GlobalKey keys = GlobalKey(); - -class PropertyOwnerInfoEdit extends StatefulWidget { - final int index; - final PropertyInfo faas; - final String title; - final VoidCallback NextBtn; - final VoidCallback PrevBtn; - - const PropertyOwnerInfoEdit( - this.index, this.faas, this.title, this.NextBtn, this.PrevBtn); - - @override - State createState() => _PropertyOwnerInfoEdit(); -} - -ButtonStyle secondaryBtnStyle( - Color background, Color borderColor, Color overlay) { - return ButtonStyle( - elevation: MaterialStateProperty.all(0), - backgroundColor: MaterialStateProperty.all(background), - overlayColor: MaterialStateProperty.all(overlay), - shape: MaterialStateProperty.all( - RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8.0), - side: BorderSide( - width: 2, - color: borderColor, - )))); -} - -class _PropertyOwnerInfoEdit extends State { - // late List selectedFoundation = widget.faas.foundations; - // late List selectedColumns = widget.faas.columns; - // late List selectedBeams = widget.faas.beams; - // late List selectedTFraming = widget.faas.truss_framing; - // late List selectedRoof = widget.faas.roof; - // late List selectedFlooring = widget.faas.flooring; - // late List selectedWallPartition = widget.faas.walls_and_partition; - - Map myMap = {'zero': 0, 'one': 1, 'two': 2}; - - final transaction_codes = ['New', 'Revision']; - - @override - Widget build(BuildContext context) { - return BlocConsumer( - listener: (context, state) { - if (state is PropertyInfoLoaded) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - if (state is PropertyInfoLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - - if (state is PropertyInfoErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, builder: (context, state) { - if (state is PropertyInfoLoaded) { - return SingleChildScrollView( - scrollDirection: Axis.vertical, - child: Column( - children: [ - Padding( - padding: const EdgeInsets.all(15.0), - child: Expanded( - child: Column( - children: [ - FormBuilder( - key: keys, - initialValue: { - 'transaction_code': widget.faas.transCode, - 'arp_td': widget.faas.tdn, - 'pin': widget.faas.pin, - 'owner': widget.faas.owner, - 'address': widget.faas.address, - 'tel_no': widget.faas.telno, - 'tin': widget.faas.tin, - 'benificiary': widget.faas.adminUser, - 'benificiary_telno': widget.faas.adminTelno, - 'benificiary_address': widget.faas.adminAddress, - 'benificaiary_tin': widget.faas.adminTin, - }, - enabled: true, - onChanged: () { - keys.currentState!.save(); - debugPrint(keys.currentState!.value.toString()); - }, - autovalidateMode: AutovalidateMode.disabled, - skipDisabled: true, - 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: [ - Expanded( - flex: 1, - child: customTextField("Address", "", - 'benificiary_address'), - ), - const SizedBox(width: 10.0), - Expanded( - // optional flex property if flex is 1 because the default flex is 1 - flex: 1, - child: customTextField("Tel No.", "", - 'benificiary_telno')) - ]), - const SizedBox(height: 25), - SizedBox( - width: MediaQuery.of(context).size.width, - child: CustomButton( - icon: const Icon(Icons.chevron_right, - color: Colors.white), - onPressed: () { - var property_info = PropertyInfo( - id: widget.faas.id, - transCode: keys.currentState! - .value['transaction_code'] - .toString(), - tdn: keys.currentState!.value['arp_td'], - pin: keys.currentState!.value['pin'], - owner: - keys.currentState!.value['owner'], - address: - keys.currentState!.value['address'], - telno: - keys.currentState!.value['tel_no'], - tin: keys.currentState!.value['tin'], - adminUser: keys - .currentState!.value['benificiary'], - adminAddress: keys.currentState! - .value['benificiary_address'], - adminTin: keys.currentState! - .value['benificiary_tin'], - adminTelno: keys.currentState! - .value['benificiary_telno'], - ); - - context.read().add( - UpdatPropertyInfo( - property_info: property_info)); - - widget.NextBtn(); - }, - ), - ), - ])), - ], - ), - ), - ), - ], - ), - ); - } - if (state is PropertyInfoErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context.read().add(LoadPropertyInfo()); - }, - ); - } - return Container(); - }); - } -} diff --git a/lib/screens/passo/Building/edit_building/structural_materials.dart b/lib/screens/passo/Building/edit_building/structural_materials.dart deleted file mode 100644 index 24580b3..0000000 --- a/lib/screens/passo/Building/edit_building/structural_materials.dart +++ /dev/null @@ -1,448 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:multiselect/multiselect.dart'; -import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/structural_material/structural_material_bloc.dart'; -import 'package:unit2/model/passo/structural_materials_ii.dart'; -import 'package:unit2/widgets/passo/custom_button.dart'; -import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart'; - -class StructuralMaterialsPageEdit extends StatefulWidget { - // final VoidCallback onPutStructuralMaterials; - final int tempId; - final VoidCallback NextBtn; - final VoidCallback PrevBtn; - - StructuralMaterialsPageEdit(this.tempId, this.NextBtn, this.PrevBtn); - - @override - _StructuralMaterialsPageEdit createState() => _StructuralMaterialsPageEdit(); -} - -class _StructuralMaterialsPageEdit extends State { - bool foundationOthers = false; - bool columOthers = false; - bool beamsOthers = false; - bool tfOthers = false; - bool roofOthers = false; - bool flooringOthers = false; - bool wpOthers = false; - List foundation = []; - List column = []; - List beam = []; - List truss_framing = []; - List roof = []; - List flooring = []; - List walls = []; - - List selectedColumnValues = []; - - @override - Widget build(BuildContext context) { - return BlocConsumer( - listener: (context, state) { - if (state is StructuralMaterialsLoaded) { - setState(() { - foundation = state.structure.foundation!.split(',') ?? []; - column = state.structure.columns!.split(',') ?? []; - beam = state.structure.beams!.split(',') ?? []; - truss_framing = state.structure.trussFraming!.split(',') ?? []; - roof = state.structure.roof!.split(',') ?? []; - flooring = state.structure.flooring!.split(',') ?? []; - walls = state.structure.walls!.split(',') ?? []; - // Update other local state variables here if needed - }); - } - // TODO: implement listener - }, builder: (context, state) { - if (state is StructuralMaterialsLoaded) { - return SingleChildScrollView( - scrollDirection: Axis.vertical, - child: Column( - children: [ - Expanded( - child: Column( - children: [ - Container( - margin: const EdgeInsets.only( - left: 0, top: 20, right: 0, bottom: 10), - child: const Text('STRUCTURAL MATERIALS', - style: TextStyle( - fontWeight: FontWeight.bold, fontSize: 18), - textAlign: TextAlign.left), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'FOUNDATION', - textAlign: TextAlign.start, - ), - Row( - children: [ - const Text('Others'), - Checkbox( - checkColor: Colors.white, - value: foundationOthers, - onChanged: (bool? value) { - setState(() { - foundationOthers = value!; - }); - }, - ) - ], - ), - ]), - Padding( - padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), - child: Visibility( - visible: foundationOthers, - child: customTextField( - "Enter other foundation", "", "other_foundation"), - replacement: DropDownMultiSelect( - selected_values_style: TextStyle(color: Colors.black), - onChanged: (List x) { - setState(() { - foundation = x; - }); - }, - options: const [ - 'Reinforced Concrete', - 'Plain Concrete' - ], - selectedValues: foundation, - whenEmpty: 'Select Foundations', - ), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'COLUMNS', - textAlign: TextAlign.start, - ), - Row( - children: [ - const Text('Others'), - Checkbox( - checkColor: Colors.white, - value: columOthers, - onChanged: (bool? value) { - setState(() { - columOthers = value!; - }); - }, - ) - ], - ), - ]), - Padding( - padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), - child: Visibility( - visible: columOthers, - child: customTextField( - "Enter other columns", "", "other_column"), - replacement: DropDownMultiSelect( - selected_values_style: TextStyle(color: Colors.black), - onChanged: (List x) { - setState(() { - column = x; - }); - }, - options: const [ - 'Steel', - 'Reinforced Concrete', - 'Wood' - ], - selectedValues: column, - whenEmpty: 'Select Column/s', - ), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'BEAMS', - textAlign: TextAlign.start, - ), - Row( - children: [ - const Text('Others'), - Checkbox( - checkColor: Colors.white, - value: beamsOthers, - onChanged: (bool? value) { - setState(() { - beamsOthers = value!; - }); - }, - ) - ], - ), - ]), - Padding( - padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), - child: Visibility( - visible: beamsOthers, - child: customTextField( - "Enter other beam/s", "", "other_beam"), - replacement: DropDownMultiSelect( - selected_values_style: TextStyle(color: Colors.black), - onChanged: (List x) { - setState(() { - beam = x; - }); - }, - options: const [ - 'Steel', - 'Reinforced Concrete', - 'Wood' - ], - selectedValues: beam, - whenEmpty: 'Select Beam/s', - ), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'TRUSS FRAMING', - textAlign: TextAlign.start, - ), - Row( - children: [ - const Text('Others'), - Checkbox( - checkColor: Colors.white, - value: tfOthers, - onChanged: (bool? value) { - setState(() { - tfOthers = value!; - }); - }, - ) - ], - ), - ]), - Padding( - padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), - child: Visibility( - visible: tfOthers, - child: customTextField( - "Enter other truss framing/s", "", "other_tf"), - replacement: DropDownMultiSelect( - selected_values_style: TextStyle(color: Colors.black), - onChanged: (List x) { - setState(() { - truss_framing = x; - }); - }, - options: const ['Steel', 'Wood'], - selectedValues: truss_framing, - whenEmpty: 'Select Truss Framing/s', - ), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'ROOF', - textAlign: TextAlign.start, - ), - Row( - children: [ - const Text('Others'), - Checkbox( - checkColor: Colors.white, - value: roofOthers, - onChanged: (bool? value) { - setState(() { - roofOthers = value!; - }); - }, - ) - ], - ), - ]), - Padding( - padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), - child: Visibility( - visible: roofOthers, - child: customTextField( - "Enter other roof/s", "", "other_roof"), - replacement: DropDownMultiSelect( - selected_values_style: TextStyle(color: Colors.black), - onChanged: (List x) { - setState(() { - roof = x; - }); - }, - options: const [ - 'Reinforced Concrete', - 'Tiles', - 'G.I Sheet', - 'Aluminum', - 'Asbestos', - 'Long Span', - 'Concrete Desk', - 'Nipa/Anahaw/Cogon' - ], - selectedValues: roof, - whenEmpty: 'Select Roof/s', - ), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'FLOORING', - textAlign: TextAlign.start, - ), - Row( - children: [ - const Text('Others'), - Checkbox( - checkColor: Colors.white, - value: flooringOthers, - onChanged: (bool? value) { - setState(() { - flooringOthers = value!; - }); - }, - ) - ], - ), - ]), - Padding( - padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), - child: Visibility( - visible: flooringOthers, - child: customTextField( - "Enter other flooring/s", "", "other_flooring"), - replacement: DropDownMultiSelect( - selected_values_style: TextStyle(color: Colors.black), - onChanged: (List x) { - setState(() { - flooring = x; - }); - }, - options: const [ - 'Reinforced Concrete', - 'Plain Cement', - 'Marble', - 'Wood', - 'Tiles' - ], - selectedValues: flooring, - whenEmpty: 'Select Flooring/s', - ), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'WALLS & PARTITIONS', - textAlign: TextAlign.start, - ), - Row( - children: [ - const Text('Others'), - Checkbox( - checkColor: Colors.white, - value: wpOthers, - onChanged: (bool? value) { - setState(() { - wpOthers = value!; - }); - }, - ) - ], - ), - ]), - Padding( - padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), - child: Visibility( - visible: wpOthers, - child: customTextField( - "Enter other walls & partition/s", "", "other_wp"), - replacement: DropDownMultiSelect( - selected_values_style: TextStyle(color: Colors.black), - onChanged: (List x) { - setState(() { - walls = x; - }); - }, - options: const [ - 'Reinforced Concrete', - 'Plain Concrete', - 'Wood', - 'CHIB', - 'G.I Sheet', - 'Build-a-wall', - 'Sawali', - 'Bamboo' - ], - selectedValues: walls, - whenEmpty: 'Select Walls & Partition/s', - ), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - CustomButton( - icon: const Icon(Icons.chevron_left_rounded, - color: Colors.white), - onPressed: () { - { - widget.PrevBtn(); - } - ; - }, - ), - CustomButton( - icon: const Icon(Icons.chevron_right_rounded, - color: Colors.white), - onPressed: () { - { - var strucMaterials = StructureMaterialsII( - id: widget.tempId, - foundation: foundation, - columns: column, - beams: beam, - trussFraming: truss_framing, - roof: roof, - flooring: flooring, - walls: walls, - others: ["Others"]); - context.read() - ..add( - UpdateStrucMaterials(data: strucMaterials)); - - widget.NextBtn(); - } - ; - }, - ) - ], - ) - ], - ), - ), - ], - ), - ); - } - if (state is StructuralMaterialsErrorState) { - return Text(state.error); - } - return Container(); - }); - } -} diff --git a/lib/screens/passo/Building/edit_building/structural_materials_edit.dart b/lib/screens/passo/Building/edit_building/structural_materials_edit.dart deleted file mode 100644 index 57f9d3c..0000000 --- a/lib/screens/passo/Building/edit_building/structural_materials_edit.dart +++ /dev/null @@ -1,481 +0,0 @@ -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:multiselect/multiselect.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/structural_material/structural_material_bloc.dart'; -import 'package:unit2/model/passo/structural_materials_ii.dart'; -import 'package:unit2/screens/passo/Building/add_building.dart'; -import 'package:unit2/widgets/passo/custom_button.dart'; -import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart'; - -class MaterialOption { - final String id; - final String label; - - MaterialOption(this.id, this.label); -} - -class StructuralMaterialsEditPage extends StatefulWidget { - final int tempId; - final VoidCallback NextBtn; - final VoidCallback PrevBtn; - - StructuralMaterialsEditPage(this.tempId, this.NextBtn, this.PrevBtn); - - @override - _StructuralMaterialsEditPage createState() => _StructuralMaterialsEditPage(); -} - -class _StructuralMaterialsEditPage extends State { - List foundation = []; - List column = []; - List beam = []; - List truss_framing = []; - List roof = []; - List flooring = []; - List walls = []; - bool foundationOthers = false; - bool columOthers = false; - bool beamsOthers = false; - bool tfOthers = false; - bool roofOthers = false; - bool flooringOthers = false; - bool wpOthers = false; - - List columnOptions = [ - MaterialOption('steel', 'Steel'), - MaterialOption('concrete', 'Reinforced Concrete'), - MaterialOption('wood', 'Wood'), - ]; - - List selectedColumnValues = []; - - @override - Widget build(BuildContext context) { - return Scaffold( - body: ProgressHUD( - padding: const EdgeInsets.all(24), - backgroundColor: Colors.black87, - indicatorWidget: const SpinKitFadingCircle(color: Colors.white), - child: BlocConsumer( - listener: (context, state) { - if (state is StructuralMaterialsLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - - if (state is StructuralMaterialsLoaded) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - setState(() { - foundation = state.structure.foundation!.split(','); - column = state.structure.columns!.split(','); - beam = state.structure.beams!.split(','); - truss_framing = state.structure.trussFraming!.split(','); - roof = state.structure.roof!.split(','); - flooring = state.structure.flooring!.split(','); - walls = state.structure.walls!.split(','); - // Update other local state variables here if needed - }); - } - if (state is StructuralMaterialsErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, builder: (context, state) { - return SingleChildScrollView( - padding: const EdgeInsets.all(30.0), - child: Column( - children: [ - Container( - margin: const EdgeInsets.only( - left: 0, top: 20, right: 0, bottom: 10), - child: const Text('STRUCTURAL MATERIALS', - style: - TextStyle(fontWeight: FontWeight.bold, fontSize: 18), - textAlign: TextAlign.left), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'FOUNDATION', - textAlign: TextAlign.start, - ), - Row( - children: [ - const Text('Others'), - Checkbox( - checkColor: Colors.white, - value: foundationOthers, - onChanged: (bool? value) { - setState(() { - foundationOthers = value!; - }); - }, - ) - ], - ), - ]), - Padding( - padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), - child: Visibility( - visible: foundationOthers, - child: customTextField( - "Enter other foundation", "", "other_foundation"), - replacement: DropDownMultiSelect( - selected_values_style: TextStyle(color: Colors.black), - onChanged: (List x) { - setState(() { - foundation = x; - }); - }, - options: const ['Reinforced Concrete', 'Plain Concrete'], - selectedValues: foundation, - whenEmpty: 'Select Foundations', - ), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'COLUMNS', - textAlign: TextAlign.start, - ), - Row( - children: [ - const Text('Others'), - Checkbox( - checkColor: Colors.white, - value: columOthers, - onChanged: (bool? value) { - setState(() { - columOthers = value!; - }); - }, - ) - ], - ), - ]), - Padding( - padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), - child: Visibility( - visible: columOthers, - child: customTextField( - "Enter other columns", "", "other_column"), - replacement: DropDownMultiSelect( - selected_values_style: TextStyle(color: Colors.black), - onChanged: (List x) { - setState(() { - column = x; - }); - }, - options: const ['Steel', 'Reinforced Concrete', 'Wood'], - selectedValues: column, - whenEmpty: 'Select Column/s', - ), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'BEAMS', - textAlign: TextAlign.start, - ), - Row( - children: [ - const Text('Others'), - Checkbox( - checkColor: Colors.white, - value: beamsOthers, - onChanged: (bool? value) { - setState(() { - beamsOthers = value!; - }); - }, - ) - ], - ), - ]), - Padding( - padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), - child: Visibility( - visible: beamsOthers, - child: - customTextField("Enter other beam/s", "", "other_beam"), - replacement: DropDownMultiSelect( - selected_values_style: TextStyle(color: Colors.black), - onChanged: (List x) { - setState(() { - beam = x; - }); - }, - options: const ['Steel', 'Reinforced Concrete', 'Wood'], - selectedValues: beam, - whenEmpty: 'Select Beam/s', - ), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'TRUSS FRAMING', - textAlign: TextAlign.start, - ), - Row( - children: [ - const Text('Others'), - Checkbox( - checkColor: Colors.white, - value: tfOthers, - onChanged: (bool? value) { - setState(() { - tfOthers = value!; - }); - }, - ) - ], - ), - ]), - Padding( - padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), - child: Visibility( - visible: tfOthers, - child: customTextField( - "Enter other truss framing/s", "", "other_tf"), - replacement: DropDownMultiSelect( - selected_values_style: TextStyle(color: Colors.black), - onChanged: (List x) { - setState(() { - truss_framing = x; - }); - }, - options: const ['Steel', 'Wood'], - selectedValues: truss_framing, - whenEmpty: 'Select Truss Framing/s', - ), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'ROOF', - textAlign: TextAlign.start, - ), - Row( - children: [ - const Text('Others'), - Checkbox( - checkColor: Colors.white, - value: roofOthers, - onChanged: (bool? value) { - setState(() { - roofOthers = value!; - }); - }, - ) - ], - ), - ]), - Padding( - padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), - child: Visibility( - visible: roofOthers, - child: - customTextField("Enter other roof/s", "", "other_roof"), - replacement: DropDownMultiSelect( - selected_values_style: TextStyle(color: Colors.black), - onChanged: (List x) { - setState(() { - roof = x; - }); - }, - options: const [ - 'Reinforced Concrete', - 'Tiles', - 'G.I Sheet', - 'Aluminum', - 'Asbestos', - 'Long Span', - 'Concrete Desk', - 'Nipa/Anahaw/Cogon' - ], - selectedValues: roof, - whenEmpty: 'Select Roof/s', - ), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'FLOORING', - textAlign: TextAlign.start, - ), - Row( - children: [ - const Text('Others'), - Checkbox( - checkColor: Colors.white, - value: flooringOthers, - onChanged: (bool? value) { - setState(() { - flooringOthers = value!; - }); - }, - ) - ], - ), - ]), - Padding( - padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), - child: Visibility( - visible: flooringOthers, - child: customTextField( - "Enter other flooring/s", "", "other_flooring"), - replacement: DropDownMultiSelect( - selected_values_style: TextStyle(color: Colors.black), - onChanged: (List x) { - setState(() { - flooring = x; - }); - }, - options: const [ - 'Reinforced Concrete', - 'Plain Cement', - 'Marble', - 'Wood', - 'Tiles' - ], - selectedValues: flooring, - whenEmpty: 'Select Flooring/s', - ), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'WALLS & PARTITIONS', - textAlign: TextAlign.start, - ), - Row( - children: [ - const Text('Others'), - Checkbox( - checkColor: Colors.white, - value: wpOthers, - onChanged: (bool? value) { - setState(() { - wpOthers = value!; - }); - }, - ) - ], - ), - ]), - Padding( - padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), - child: Visibility( - visible: wpOthers, - child: customTextField( - "Enter other walls & partition/s", "", "other_wp"), - replacement: DropDownMultiSelect( - selected_values_style: TextStyle(color: Colors.black), - onChanged: (List x) { - setState(() { - walls = x; - }); - }, - options: const [ - 'Reinforced Concrete', - 'Plain Concrete', - 'Wood', - 'CHIB', - 'G.I Sheet', - 'Build-a-wall', - 'Sawali', - 'Bamboo' - ], - selectedValues: walls, - whenEmpty: 'Select Walls & Partition/s', - ), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - CustomButton( - icon: const Icon(Icons.chevron_left_rounded, - color: Colors.white), - onPressed: () { - { - widget.NextBtn(); - } - ; - }, - ), - CustomButton( - icon: const Icon(Icons.chevron_right_rounded, - color: Colors.white), - onPressed: () async { - { - final tempID = await SharedPreferences.getInstance(); - var strucMaterials = StructureMaterialsII( - id: tempID.getInt('tempid')! - 1, - foundation: foundationOthers - ? formKey - .currentState!.value['other_foundation'] - .split(',') - : foundation, - columns: columOthers - ? formKey.currentState!.value['other_column'] - .split(',') - : column, - beams: beamsOthers - ? formKey.currentState!.value['other_beam'] - .split(',') - : beam, - trussFraming: tfOthers - ? formKey.currentState!.value['other_tf'] - .split(',') - : truss_framing, - roof: roofOthers - ? formKey.currentState!.value['other_roof'] - .split(',') - : roof, - flooring: flooringOthers - ? formKey - .currentState!.value['other_flooring'] - .split(',') - : flooring, - walls: wpOthers - ? formKey.currentState!.value['other_wp'] - .split(',') - : walls, - others: ["Others"]); - context.read() - ..add(UpdateStrucMaterials(data: strucMaterials)); - - widget.PrevBtn(); - } - ; - }, - ) - ], - ) - ], - ), - ); - }), - ), - ); - } -} diff --git a/lib/screens/passo/Building/edit_building_new/property_owner_info.dart b/lib/screens/passo/Building/edit_building_new/property_owner_info.dart deleted file mode 100644 index 33490b5..0000000 --- a/lib/screens/passo/Building/edit_building_new/property_owner_info.dart +++ /dev/null @@ -1,13 +0,0 @@ -import 'package:flutter/material.dart'; - -class PropertyOwnerPage extends StatefulWidget { - @override - _PropertyOwnerPage createState() => _PropertyOwnerPage(); -} - -class _PropertyOwnerPage extends State { - @override - Widget build(BuildContext context) { - return Scaffold(body: Container()); - } -} diff --git a/lib/screens/passo/Land/add_land.dart b/lib/screens/passo/Land/add_land.dart deleted file mode 100644 index da0c906..0000000 --- a/lib/screens/passo/Land/add_land.dart +++ /dev/null @@ -1,120 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_form_builder/flutter_form_builder.dart'; - -import 'package:im_stepper/stepper.dart'; -import 'package:unit2/screens/passo/Land/add_land/land_appraisal.dart'; -import 'package:unit2/screens/passo/Land/add_land/location_and_boundaries.dart'; -import 'package:unit2/screens/passo/Land/add_land/other_improvements.dart'; -import 'package:unit2/screens/passo/Land/add_land/property_assessment.dart'; -import 'package:unit2/screens/passo/Land/add_land/property_assessment_cont.dart'; -import 'package:unit2/screens/passo/Land/add_land/property_owner_info.dart'; -import 'package:unit2/screens/passo/Land/add_land/value_adjustments.dart'; -import 'package:unit2/theme-data.dart/colors.dart'; -import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart'; - -GlobalKey landKey = GlobalKey(); - -class AddLand extends StatefulWidget { - @override - _AddLand createState() => _AddLand(); -} - -class _AddLand extends State { - // THE FOLLOWING TWO VARIABLES ARE REQUIRED TO CONTROL THE STEPPER. - int activeStep = 0; // Initial step set to 5. - - int upperBound = 6; // upperBound MUST BE total number of icons minus 1. - - void PrevBtn() { - setState(() { - activeStep--; - }); - } - - void NextBtn() { - setState(() { - activeStep++; - }); - } - - void onSAveAll() { - return Navigator.of(context).pop(); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - centerTitle: true, - backgroundColor: primary, - title: const Text('Land FAAS'), - ), - body: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - children: [ - NumberStepper( - numbers: const [1, 2, 3, 4, 5, 6, 7], - activeStepColor: primary, - numberStyle: const TextStyle(color: Colors.white), - lineColor: primary, - // activeStep property set to activeStep variable defined above. - activeStep: activeStep, - activeStepBorderColor: Colors.white, - activeStepBorderWidth: 1, - // This ensures step-tapping updates the activeStep. - onStepReached: (index) { - setState(() { - activeStep = index; - }); - }, - ), - Expanded( - child: FormBuilder( - key: landKey, - - // enabled: false, - onChanged: () { - landKey.currentState?.save(); - - print(landKey.currentState?.value.toString()); - }, - autovalidateMode: AutovalidateMode.disabled, - skipDisabled: true, - child: Container( - child: content(PrevBtn, NextBtn, onSAveAll), - ), - ), - ), - ], - ), - ), - ); - } - - /// Returns the next button. - - // Returns the content widget based on the activeStep. - Widget content(PrevBtn, NextBtn, onSAveAll) { - switch (activeStep) { - case 0: - return LandPropertyOwnerInfo(NextBtn); - case 1: - return LandLocationAndBoundaries(PrevBtn, NextBtn); - case 2: - return LandAppraisal(PrevBtn, NextBtn); - case 3: - return OtherImprovementPage(PrevBtn, NextBtn); - case 4: - return ValueAdjustmentPage(PrevBtn, NextBtn); - case 5: - return LandPropertyAssessmentPage(PrevBtn, NextBtn); - case 6: - return LandSignatories(onSAveAll); - - default: - return LandPropertyOwnerInfo(NextBtn); - } - } -} diff --git a/lib/screens/passo/Land/add_land/AddLandAppraisal.dart b/lib/screens/passo/Land/add_land/AddLandAppraisal.dart deleted file mode 100644 index a271e40..0000000 --- a/lib/screens/passo/Land/add_land/AddLandAppraisal.dart +++ /dev/null @@ -1,448 +0,0 @@ -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:shared_preferences/shared_preferences.dart'; -import 'package:unit2/bloc/passo/bulding/additional_item/additional_item_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_appraisal/land_appraisal_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_classification/land_classification_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_subclassification/land_subclassification_bloc.dart'; -import 'package:unit2/bloc/passo/municipality/municipality_bloc.dart'; -import 'package:unit2/model/passo/additional_items.dart'; -import 'package:unit2/model/passo/city.dart'; -import 'package:unit2/model/passo/class_components.dart'; -import 'package:unit2/model/passo/land_appr.dart'; -import 'package:unit2/model/passo/land_classification.dart'; -import 'package:unit2/model/passo/land_subclassification.dart'; -import 'package:unit2/model/passo/unit_construct.dart'; -import 'package:unit2/screens/passo/Land/add_land.dart'; -import 'package:unit2/theme-data.dart/form-style.dart'; -import 'package:unit2/utils/text_container.dart'; -import 'package:unit2/widgets/error_state.dart'; -import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart'; - -class AddLandAppraisalModal extends StatefulWidget { - // final List unit; - // final List options; - // final int tempId; - - // AddLandAppraisalModal(this.unit, this.options, this.tempId); - - @override - _AddLandAppraisalModal createState() => _AddLandAppraisalModal(); -} - -class _AddLandAppraisalModal extends State { - final focus = FocusNode(); - bool isPainted = false; - bool isSecondHand = false; - TextEditingController textEditingController = TextEditingController(); - double _unitBase = 0; - int _areaValue = 0; - final double _depValue = 0; - double _unitValue = 0; - String _subClassDesc = ""; - int _classId = 0; - String _structureType = ""; - bool _withoutBUCC = false; - int _notPaintedUnitVal = 0; - int _secondHandUnitVal = 0; - String cityCode = ''; - String cityDesc = ''; - int classCode = 1; - String _classDesc = ''; - - GlobalKey appraisalLandKey = GlobalKey(); - - BoxDecoration box1() { - return const BoxDecoration(boxShadow: [ - BoxShadow(color: Colors.black12, spreadRadius: 5, blurRadius: 5) - ], color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(3))); - } - - double _amountofDepreciation(unitVal, unitBase, area, depreciation) { - return ((unitVal * unitBase) * area) * depreciation; - } - - double _totalMarketValue(unitBase, area) { - return unitBase * area; - } - - @override - Widget build(BuildContext context) { - return BlocBuilder( - buildWhen: (previous, current) { - return false; - }, builder: (context, state) { - if (state is ShowAddLandAppraisalScreen) { - return BlocConsumer( - listener: (context, state) { - // TODO: implement listener - }, - builder: (context, state) { - if (state is LandClassificationLoaded) { - final classification = state.land_classification; - return BlocConsumer( - listener: (context, state) { - // TODO: implement listener - }, - builder: (context, state) { - if (state is LandSubClassificationLoaded) { - final subclassification = state.land_subclassification; - return BlocConsumer( - listener: (context, state) { - // TODO: implement listener - }, - builder: (context, state) { - if (state is MunicipalityLoaded) { - return FormBuilder( - key: appraisalLandKey, - onChanged: () { - appraisalLandKey.currentState?.save(); - }, - autovalidateMode: AutovalidateMode.disabled, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - 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: Expanded( - flex: 1, - child: - FormBuilderDropdown( - name: - 'appraisal_municipality', - autofocus: false, - decoration: - normalTextFieldStyle( - cityDesc ?? - "Municipality", - ""), - items: state.municipality - .map((municipality) => - DropdownMenuItem< - City>( - value: municipality, - child: Text(municipality - .cityDescription!), // Use cityDescription instead of cityName - )) - .toList(), - onChanged: (selectedCity) { - if (selectedCity != null) { - final selectedCityCode = - selectedCity.cityCode; - setState(() { - cityCode = - selectedCityCode!; - cityDesc = selectedCity - .cityDescription!; - }); - final barangayBloc = - context.read< - LandSubClassificationBloc>(); - barangayBloc.add( - LoadLandSubClassification( - classCode: - classCode!, - cityCode: - selectedCityCode!)); // Use selectedCityCode directly - } - }, - )), - ), - Container( - margin: const EdgeInsets.only( - left: 0, - top: 10, - right: 0, - bottom: 0), - child: Expanded( - flex: 1, - child: FormBuilderDropdown< - LandClassification>( - name: 'classification', - autofocus: false, - decoration: - normalTextFieldStyle( - _classDesc - .toString() ?? - "Classification", - ""), - items: classification - .map((classification) => - DropdownMenuItem< - LandClassification>( - value: - classification, - child: Text( - classification - .description!), // Use cityDescription instead of cityName - )) - .toList(), - onChanged: (selectedClass) { - if (selectedClass != null) { - final selectedClassCode = - selectedClass.id; - setState(() { - classCode = - selectedClassCode!; - _classDesc = - selectedClass - .description!; - }); - final barangayBloc = - context.read< - LandSubClassificationBloc>(); - barangayBloc.add( - LoadLandSubClassification( - classCode: - selectedClassCode!, - cityCode: - cityCode)); // Use selectedCityCode directly - } - }, - )), - ), - Container( - margin: const EdgeInsets.only( - left: 0, - top: 10, - right: 0, - bottom: 0), - child: SizedBox( - height: 45, - child: SearchField( - itemHeight: 70, - suggestions: subclassification - .map((LandSubClassification - subclass) => - SearchFieldListItem( - '${subclass.subclassCode} - ${subclass.subclassDescription}', - item: subclass, - child: ListTile( - title: Text( - '${subclass.subclassCode} - ${subclass.subclassDescription!.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: (subclass) { - setState(() { - _unitBase = double.parse( - subclass.item! - .baseUnitMarketval!); - _subClassDesc = - '${subclass.item!.subclassCode} - ${subclass.item!.subclassDescription}'; - }); - focus.unfocus(); - }, - ), - ), - ), - const SizedBox(height: 10), - FormBuilderTextField( - name: 'land_appraisal_area', - decoration: normalTextFieldStyle( - "Area", ""), - validator: - FormBuilderValidators.compose( - []), - onChanged: (value) { - setState(() { - _areaValue = int.parse(value!); - }); - }, - ), - const SizedBox(height: 10), - const Text('Market Value'), - const SizedBox(height: 5), - Container( - height: 45.0, - width: double.infinity, - decoration: BoxDecoration( - color: Colors.white, - border: Border.all( - color: Colors.grey, - width: 1.0, - ), - borderRadius: - BorderRadius.circular(5.0), - ), - child: Align( - alignment: Alignment.center, - child: Text( - NumberFormat.currency( - locale: 'en-PH', - symbol: "₱") - .format( - _totalMarketValue( - _unitBase, - _areaValue)))), - ), - const SizedBox(height: 10), - Row( - children: [ - Container( - width: 120, - height: 60, - padding: - const EdgeInsets.all(8.0), - child: ElevatedButton( - onPressed: () async { - final tempID = - await SharedPreferences - .getInstance(); - print(tempID - .getInt('landid')); - var land_appraisal = LandAppr( - landapprDetailsId: - tempID.getInt( - 'landid')! - - 1, - classification: - _classDesc, - subClass: _subClassDesc, - area: _areaValue - .toString(), - unitValue: _unitBase - .toString(), - baseMarketval: - _totalMarketValue( - _unitBase, - _areaValue) - .toString()); - - context - .read< - LandAppraisalBloc>() - .add(AddLandAppraisal( - land_appr: - land_appraisal)); - }, - style: - ElevatedButton.styleFrom( - primary: Colors.black, - ), - child: const Text("Submit"), - ), - ), - const SizedBox( - width: - 5), // Use SizedBox for horizontal spacing in a Row - Container( - width: 120, - height: 60, - padding: - const EdgeInsets.all(8.0), - child: ElevatedButton( - onPressed: () { - context - .read< - LandAppraisalBloc>() - .add( - const LoadLandAppraisal()); - }, - style: - ElevatedButton.styleFrom( - primary: Colors.black, - ), - child: const Text("Cancel"), - ), - ), - ], - ), - ], - ), - ), - ))); - } - if (state is MunicipalityErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context - .read() - .add(LoadMunicipality()); - }, - ); - } - return Container(); - }, - ); - } - if (state is LandSubClassificationErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context.read().add( - const LoadLandSubClassification( - cityCode: '1', classCode: 1)); - }, - ); - } - return Container(); - }, - ); - } - if (state is LandClassificationErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context - .read() - .add(LoadLandClassification()); - }, - ); - } - return Container(); - }, - ); - } - if (state is LandAppraisalErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context.read().add(LoadLandAppraisal()); - }, - ); - } - return Container(); - }); - } -} diff --git a/lib/screens/passo/Land/add_land/AddLandValueAdjustmentModal.dart b/lib/screens/passo/Land/add_land/AddLandValueAdjustmentModal.dart deleted file mode 100644 index 09ecc48..0000000 --- a/lib/screens/passo/Land/add_land/AddLandValueAdjustmentModal.dart +++ /dev/null @@ -1,527 +0,0 @@ -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:intl/intl.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -import 'package:unit2/bloc/passo/land/land_appraisal/land_appraisal_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_value_adjustments/land_value_adjustments_bloc.dart'; -import 'package:unit2/bloc/passo/land/type_of_location/type_of_location_bloc.dart'; -import 'package:unit2/bloc/passo/land/type_of_road/type_of_road_bloc.dart'; -import 'package:unit2/model/passo/land_appr.dart'; -import 'package:unit2/model/passo/land_value_adjustment.dart'; -import 'package:unit2/model/passo/type_of_location.dart'; -import 'package:unit2/model/passo/type_of_road.dart'; -import 'package:unit2/theme-data.dart/form-style.dart'; -import 'package:unit2/utils/text_container.dart'; -import 'package:unit2/widgets/error_state.dart'; - -class AddLandValueAdjustmentModal extends StatefulWidget { - // final List unit; - // final List options; - // final int tempId; - - // AddLandAppraisalModal(this.unit, this.options, this.tempId); - - @override - _AddLandValueAdjustmentModal createState() => _AddLandValueAdjustmentModal(); -} - -class _AddLandValueAdjustmentModal extends State { - final focus = FocusNode(); - bool isPainted = false; - bool isSecondHand = false; - TextEditingController textEditingController = TextEditingController(); - double _unitBase = 0; - int _areaValue = 0; - final double _depValue = 0; - double _unitValue = 0; - String _subClassDesc = ""; - int _classId = 0; - String _structureType = ""; - int _notPaintedUnitVal = 0; - int _secondHandUnitVal = 0; - String cityCode = ''; - String cityDesc = ''; - int classCode = 1; - String _classDesc = ''; - String _treeType = ""; - bool _nonfruitBearing = false; - bool _fruitBearing = false; - int qty = 0; - int pr_qty = 0; - int nonpr_qty = 0; - double _roadTypeDeduction = 0; - double _locTypeRoad = 0; - double _locTypePob = 0; - String _roadType = ''; - String _distance = ''; - String _locRdDistance = ''; - String _locPobDistance = ''; - - GlobalKey otherImpKey = GlobalKey(); - - _calculateBaseMarketValue() { - double base = 0.00; - if (_fruitBearing) { - base = (pr_qty + nonpr_qty) * _unitValue; - } else { - base = qty * _unitValue; - } - return base; - } - - double calculateAdjustment() { - double adjustment = 0; - - if (_locPobDistance == '0 TO 1') { - adjustment = _locTypePob - (_roadTypeDeduction + _locTypeRoad); - } else { - adjustment = (_roadTypeDeduction + _locTypeRoad + _locTypePob) * -1; - } - - return adjustment; - } - - double calculateValueAdjustment() { - double adjustment = calculateAdjustment(); - double valueAdjustment = _unitValue * adjustment; - - return valueAdjustment; - } - - double calculateMarketValue() { - double marketValue = 0; - - marketValue = _unitValue + calculateValueAdjustment(); // Adding adjustment - - return marketValue; - } - - BoxDecoration box1() { - return const BoxDecoration(boxShadow: [ - BoxShadow(color: Colors.black12, spreadRadius: 5, blurRadius: 5) - ], color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(3))); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - body: ProgressHUD( - padding: const EdgeInsets.all(24), - backgroundColor: Colors.black87, - indicatorWidget: const SpinKitFadingCircle(color: Colors.white), - child: BlocBuilder( - buildWhen: (previous, current) { - return false; - }, builder: (context, state) { - if (state is ShowAddLandValueAdjustmentsScreen) { - return BlocConsumer( - listener: (context, state) { - // TODO: implement listener - }, builder: (context, state) { - if (state is LandAppraisalLoaded) { - final land_appr = state.land_appr; - return BlocConsumer( - listener: (context, state) { - // TODO: implement listener - }, - builder: (context, state) { - if (state is TypeOfRoadLoaded) { - final roadType = state.road_type; - return BlocConsumer( - listener: (context, state) { - // TODO: implement listener - }, - builder: (context, state) { - if (state is TypeOfLocationLoaded) { - return FormBuilder( - key: otherImpKey, - onChanged: () { - otherImpKey.currentState?.save(); - }, - autovalidateMode: AutovalidateMode.disabled, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - 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: Expanded( - flex: 1, - child: FormBuilderDropdown< - LandAppr?>( - name: 'land_appr_item', - autofocus: false, - decoration: - normalTextFieldStyle( - "Land Appraisal Items", - ""), - items: land_appr - .map((land_appr) => - DropdownMenuItem< - LandAppr?>( - value: land_appr, - child: Text((land_appr - .subClass ?? - "")), - )) - .toList(), - onChanged: - (selectedLandAppr) { - if (selectedLandAppr != - null) { - setState(() { - _unitValue = double.parse( - selectedLandAppr - .baseMarketval!); - }); - } - }, - )), - ), - SizedBox( - height: 10, - ), - Text("Adjustment Factors"), - Container( - margin: const EdgeInsets.only( - left: 0, - top: 10, - right: 0, - bottom: 0), - child: Expanded( - flex: 1, - child: FormBuilderDropdown< - TypeOfRoad?>( - name: 'road_type', - autofocus: false, - decoration: - normalTextFieldStyle( - "Type of Road", ""), - items: roadType - .map((roadType) => - DropdownMenuItem< - TypeOfRoad?>( - value: roadType, - child: Text((roadType - .roadType ?? - "")), - )) - .toList(), - onChanged: (selectedRoad) { - if (selectedRoad != null) { - setState(() { - _roadTypeDeduction = - double.parse( - selectedRoad - .deduction!); - _roadType = selectedRoad - .roadType!; - }); - } - }, - )), - ), - SizedBox( - height: 10, - ), - Text("Type of Location"), - Container( - margin: const EdgeInsets.only( - left: 0, - top: 10, - right: 0, - bottom: 0), - child: Expanded( - flex: 1, - child: FormBuilderDropdown< - TypeOfLocation?>( - name: 'loc_type_road', - autofocus: false, - decoration: - normalTextFieldStyle( - "Distance to Road", - ""), - items: state.loc_type - .map((locTypeRoad) => - DropdownMenuItem< - TypeOfLocation?>( - value: locTypeRoad, - child: Text((locTypeRoad - .distanceKm ?? - "")), - )) - .toList(), - onChanged: - (selectedLoadRoad) { - if (selectedLoadRoad != - null) { - setState(() { - _locTypeRoad = double - .parse(selectedLoadRoad - .allRoadTypes!); - _locRdDistance = - selectedLoadRoad - .distanceKm!; - }); - } - }, - )), - ), - Container( - margin: const EdgeInsets.only( - left: 0, - top: 10, - right: 0, - bottom: 0), - child: Expanded( - flex: 1, - child: FormBuilderDropdown< - TypeOfLocation?>( - name: 'loc_type_pob', - autofocus: false, - decoration: - normalTextFieldStyle( - "Distance to Poblacion", - ""), - items: state.loc_type - .map((locTypePob) => - DropdownMenuItem< - TypeOfLocation?>( - value: locTypePob, - child: Text((locTypePob - .distanceKm ?? - "")), - )) - .toList(), - onChanged: (selectedLocPob) { - if (selectedLocPob != - null) { - setState(() { - _locTypePob = double - .parse(selectedLocPob - .localTradingCenter!); - - _locPobDistance = - selectedLocPob - .distanceKm!; - }); - } - }, - )), - ), - const SizedBox(height: 10), - 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( - (calculateAdjustment() * 100) - .toString() + - '%'), - ), - ), - const SizedBox(height: 10), - 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( - calculateValueAdjustment())), - ), - ), - const SizedBox(height: 10), - 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(calculateMarketValue())), - ), - ), - const SizedBox(height: 10), - Row( - children: [ - Container( - width: 120, - height: 60, - padding: - const EdgeInsets.all(8.0), - child: ElevatedButton( - onPressed: () async { - final tempID = - await SharedPreferences - .getInstance(); - print(tempID - .getInt('landid')); - var adjustments = ValueAdjustments( - landapprDetailsId: - tempID.getInt( - 'landid')! - - 1, - baseMarketval: - _unitValue - .toString(), - adjustmentFactors: _roadType + - ' , ' + - _locPobDistance + - ' km from road , ' + - _locPobDistance + - ' km from poblacion', - adjustment: - calculateAdjustment() - .toString(), - valueAdjustment: - calculateValueAdjustment() - .toString(), - marketValue: - calculateMarketValue() - .toString()); - - context - .read< - LandValueAdjustmentsBloc>() - .add(AddLandValueAdjustments( - val_adj: - adjustments)); - }, - style: - ElevatedButton.styleFrom( - primary: Colors.black, - ), - child: const Text("Submit"), - ), - ), - const SizedBox( - width: - 5), // Use SizedBox for horizontal spacing in a Row - Container( - width: 120, - height: 60, - padding: - const EdgeInsets.all(8.0), - child: ElevatedButton( - onPressed: () { - context - .read< - LandValueAdjustmentsBloc>() - .add( - const LoadLandValueAdjustments()); - }, - style: - ElevatedButton.styleFrom( - primary: Colors.black, - ), - child: const Text("Cancel"), - ), - ), - ], - ) - ], - ), - ), - ), - )); - } - if (state is TypeOfLocationErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context - .read() - .add(LoadTypeOfLocation()); - }, - ); - } - return Container(); - }, - ); - } - if (state is LandAppraisalErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context - .read() - .add(LoadLandAppraisal()); - }, - ); - } - return Container(); - }, - ); - } - if (state is LandValueAdjustmentsErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context - .read() - .add(LoadLandValueAdjustments()); - }, - ); - } - return Container(); - }); - } - if (state is LandValueAdjustmentsErrorState) { - return Text(state.error); - } - return Container( - child: Text("Land Value Adjustment"), - ); - }), - ), - ); - } -} diff --git a/lib/screens/passo/Land/add_land/AddOtherImprovementModal.dart b/lib/screens/passo/Land/add_land/AddOtherImprovementModal.dart deleted file mode 100644 index a445d65..0000000 --- a/lib/screens/passo/Land/add_land/AddOtherImprovementModal.dart +++ /dev/null @@ -1,359 +0,0 @@ -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/bloc/passo/land/land_trees_improvements/land_trees_improvements_bloc.dart'; -import 'package:unit2/bloc/passo/land/other_improvements/other_improvements_bloc.dart'; -import 'package:unit2/model/passo/other_improvements.dart'; -import 'package:unit2/model/passo/trees_improvements.dart'; -import 'package:unit2/theme-data.dart/form-style.dart'; -import 'package:unit2/utils/text_container.dart'; -import 'package:unit2/widgets/error_state.dart'; - -class AddOtherImprovementModal extends StatefulWidget { - // final List unit; - // final List options; - // final int tempId; - - // AddLandAppraisalModal(this.unit, this.options, this.tempId); - - @override - _AddOtherImprovementModal createState() => _AddOtherImprovementModal(); -} - -class _AddOtherImprovementModal extends State { - final focus = FocusNode(); - bool isPainted = false; - bool isSecondHand = false; - TextEditingController textEditingController = TextEditingController(); - double _unitBase = 0; - int _areaValue = 0; - final double _depValue = 0; - double _unitValue = 0; - String _subClassDesc = ""; - int _classId = 0; - String _structureType = ""; - int _notPaintedUnitVal = 0; - int _secondHandUnitVal = 0; - String cityCode = ''; - String cityDesc = ''; - int classCode = 1; - String _classDesc = ''; - String _treeType = ""; - bool _nonfruitBearing = false; - bool _fruitBearing = false; - int qty = 0; - int pr_qty = 0; - int nonpr_qty = 0; - - GlobalKey otherImpKey = GlobalKey(); - - final typeOfTree = [ - "Non-Fruit Bearing", - "Fruit Bearing", - ]; - - _calculateBaseMarketValue() { - double base = 0.00; - if (_fruitBearing) { - base = (pr_qty + nonpr_qty) * _unitValue; - } else { - base = qty * _unitValue; - } - return base; - } - - BoxDecoration box1() { - return const BoxDecoration(boxShadow: [ - BoxShadow(color: Colors.black12, spreadRadius: 5, blurRadius: 5) - ], color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(3))); - } - - double _amountofDepreciation(unitVal, unitBase, area, depreciation) { - return ((unitVal * unitBase) * area) * depreciation; - } - - double _totalMarketValue(unitBase, area) { - return unitBase * area; - } - - @override - Widget build(BuildContext context) { - return BlocBuilder( - buildWhen: (previous, current) { - return false; - }, builder: (context, state) { - if (state is ShowAddOtherImprovementScreen) { - return BlocConsumer(listener: (context, state) { - // TODO: implement listener - }, builder: (context, state) { - if (state is LandTreesImprovementsLoaded) { - final trees = state.trees_imp; - return FormBuilder( - key: otherImpKey, - onChanged: () { - otherImpKey.currentState?.save(); - }, - autovalidateMode: AutovalidateMode.disabled, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - 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: Expanded( - flex: 1, - child: FormBuilderDropdown( - name: 'kinds_of_trees', - autofocus: false, - decoration: normalTextFieldStyle( - "Kinds of Trees", ""), - items: state.trees_imp - .map((trees) => - DropdownMenuItem( - value: trees, - child: Text( - (trees.improvement ?? "") + - " " + - (trees.subclassCode ?? ""), - ), - )) - .toList(), - onChanged: (selectedTree) { - if (selectedTree != null) { - setState(() { - _unitValue = double.parse( - selectedTree.pricePerTree!); - _treeType = selectedTree.improvement!; - }); - } - }, - )), - ), - Container( - child: Row( - children: [ - Row( - children: [ - Checkbox( - value: _fruitBearing, - onChanged: (bool? value) { - setState(() { - _fruitBearing = value!; - }); - }, - ), - Text('Fruit Bearing ?'), - ], - ), - ], - ), - ), - Visibility( - visible: !_fruitBearing, - child: Row( - children: [ - Expanded( - child: FormBuilderTextField( - name: 'subClass', - decoration: normalTextFieldStyle( - "SubClass/Age", ""), - validator: - FormBuilderValidators.compose([]), - onChanged: (value) { - setState(() { - _subClassDesc = value!; - }); - }, - ), - ), - SizedBox( - width: 10, - ), - Expanded( - child: FormBuilderTextField( - name: 'qty', - decoration: normalTextFieldStyle("No.", ""), - validator: - FormBuilderValidators.compose([]), - onChanged: (value) { - setState(() { - qty = int.parse(value!); - }); - }, - ), - ), - ], - ), - replacement: Column( - children: [ - FormBuilderTextField( - name: 'no_of_productive', - decoration: normalTextFieldStyle( - "No. of Productive", ""), - validator: FormBuilderValidators.compose([]), - onChanged: (value) { - setState(() { - pr_qty = int.parse(value!); - }); - }, - ), - const SizedBox(height: 10), - FormBuilderTextField( - name: 'no_of_nonproductive', - decoration: normalTextFieldStyle( - "No. of Non-Productive", ""), - validator: FormBuilderValidators.compose([]), - onChanged: (value) { - setState(() { - nonpr_qty = int.parse(value!); - }); - }, - ), - ], - ), - ), - const SizedBox(height: 10), - const Text('Market Value'), - const SizedBox(height: 5), - Container( - height: 45.0, - width: double.infinity, - decoration: BoxDecoration( - color: Colors.white, - border: Border.all( - color: Colors.grey, - width: 1.0, - ), - borderRadius: BorderRadius.circular(5.0), - ), - child: Align( - alignment: Alignment.center, - child: Text(NumberFormat.currency( - locale: 'en-PH', symbol: "₱") - .format(_unitValue))), - ), - const SizedBox(height: 10), - const Text('Base 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(_calculateBaseMarketValue().toString() == - "0.00" - ? "00.0" - : _calculateBaseMarketValue())), - ), - ), - const SizedBox(height: 10), - Row( - children: [ - Container( - width: 120, - height: 60, - padding: const EdgeInsets.all(8.0), - child: ElevatedButton( - onPressed: () async { - final tempID = - await SharedPreferences.getInstance(); - print(tempID.getInt('landid')); - var improvement = OtherImprovements( - landapprDetailsId: - tempID.getInt('landid')! - 1, - kindsOfTrees: _treeType, - subclassAge: _subClassDesc, - quantity: qty, - unitValue: _unitValue.toString(), - baseMarketval: - _calculateBaseMarketValue() - .toString(), - noOfProductive: pr_qty, - noOfNonproductive: nonpr_qty, - fruitBearing: - _fruitBearing == true ? '1' : '0'); - - context.read().add( - AddOtherImprovement( - other_imp: improvement)); - }, - style: ElevatedButton.styleFrom( - primary: Colors.black, - ), - child: const Text("Submit"), - ), - ), - const SizedBox( - width: - 5), // Use SizedBox for horizontal spacing in a Row - Container( - width: 120, - height: 60, - padding: const EdgeInsets.all(8.0), - child: ElevatedButton( - onPressed: () { - context - .read() - .add(const LoadOtherImprovement()); - }, - style: ElevatedButton.styleFrom( - primary: Colors.black, - ), - child: const Text("Cancel"), - ), - ), - ], - ) - ], - ), - ), - ), - )); - } - if (state is LandTreesImprovementsErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context - .read() - .add(LoadLandTreesImprovements()); - }, - ); - } - return Container(); - }); - } - if (state is OtherImprovementErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context.read().add(LoadOtherImprovement()); - }, - ); - } - return Container(); - }); - } -} diff --git a/lib/screens/passo/Land/add_land/AddPropertyAssessmentModal.dart b/lib/screens/passo/Land/add_land/AddPropertyAssessmentModal.dart deleted file mode 100644 index 248d9cd..0000000 --- a/lib/screens/passo/Land/add_land/AddPropertyAssessmentModal.dart +++ /dev/null @@ -1,352 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_form_builder/flutter_form_builder.dart'; -import 'package:intl/intl.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -import 'package:unit2/bloc/passo/land/land_property_assessment/land_property_assessment_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_value_adjustments/land_value_adjustments_bloc.dart'; -import 'package:unit2/model/passo/land_property_assessment.dart'; -import 'package:unit2/model/passo/land_value_adjustment.dart'; -import 'package:unit2/theme-data.dart/form-style.dart'; -import 'package:unit2/utils/text_container.dart'; -import 'package:unit2/widgets/error_state.dart'; - -class AddPropertyAssessmentModal extends StatefulWidget { - // final List unit; - // final List options; - // final int tempId; - - // AddLandAppraisalModal(this.unit, this.options, this.tempId); - - @override - _AddPropertyAssessmentModal createState() => _AddPropertyAssessmentModal(); -} - -class _AddPropertyAssessmentModal extends State { - final focus = FocusNode(); - bool isPainted = false; - bool isSecondHand = false; - TextEditingController textEditingController = TextEditingController(); - double _unitBase = 0; - int _areaValue = 0; - final double _depValue = 0; - double _unitValue = 0; - String _subClassDesc = ""; - int _classId = 0; - String _structureType = ""; - int _notPaintedUnitVal = 0; - int _secondHandUnitVal = 0; - String cityCode = ''; - String cityDesc = ''; - int classCode = 1; - String _classDesc = ''; - String _treeType = ""; - bool _nonfruitBearing = false; - bool _fruitBearing = false; - int qty = 0; - int pr_qty = 0; - int nonpr_qty = 0; - String _actualUse = "Residential"; - String _assessmentLevel = ""; - - GlobalKey assessmentKey = GlobalKey(); - - final typeOfTree = [ - "Non-Fruit Bearing", - "Fruit Bearing", - ]; - - final actual_use = [ - "Residential", - "Agricultural", - "Commercial", - "Industrial", - "Mineral", - "Timberland", - ]; - - calculateAssessmentValue() { - switch (_actualUse) { - case "Residential": - return (_unitValue * 0.20).ceil(); - case "Agricultural": - return (_unitValue * 0.40).ceil(); - case "Commercial": - return (_unitValue * 0.50).ceil(); - case "Industrial": - return (_unitValue * 0.50).ceil(); - case "Mineral": - return (_unitValue * 0.50).ceil(); - case "Timberland": - return (_unitValue * 0.20).ceil(); - default: - } - } - - BoxDecoration box1() { - return const BoxDecoration(boxShadow: [ - BoxShadow(color: Colors.black12, spreadRadius: 5, blurRadius: 5) - ], color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(3))); - } - - double _amountofDepreciation(unitVal, unitBase, area, depreciation) { - return ((unitVal * unitBase) * area) * depreciation; - } - - double _totalMarketValue(unitBase, area) { - return unitBase * area; - } - - @override - Widget build(BuildContext context) { - return BlocBuilder( - buildWhen: (previous, current) { - return false; - }, builder: (context, state) { - if (state is ShowAddLandPropertyAssessmentScreen) { - return BlocConsumer(listener: (context, state) { - // TODO: implement listener - }, builder: (context, state) { - if (state is LandValueAdjustmentsLoaded) { - final assessment = state.val_adj; - return FormBuilder( - key: assessmentKey, - onChanged: () { - assessmentKey.currentState?.save(); - }, - autovalidateMode: AutovalidateMode.disabled, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - 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: Expanded( - flex: 1, - child: FormBuilderDropdown( - name: 'value_adjustments', - autofocus: false, - decoration: normalTextFieldStyle( - "Value Adjustments", ""), - items: state.val_adj - .map((adj) => - DropdownMenuItem( - value: adj, - child: Text( - (adj.adjustmentFactors ?? ""), - ), - )) - .toList(), - onChanged: (selectedAdj) { - if (selectedAdj != null) { - setState(() { - _unitValue = double.parse( - selectedAdj.marketValue!); - }); - } - }, - )), - ), - SizedBox( - height: 10, - ), - FormBuilderDropdown( - name: "land_actual_use", - autofocus: false, - decoration: normalTextFieldStyle("Actual Use", ""), - items: actual_use - .map((item) => DropdownMenuItem( - value: item, - child: Text(item), - )) - .toList(), - onChanged: (value) { - setState(() { - _actualUse = value!; - - switch (value) { - case "Residential": - setState(() { - _assessmentLevel = '20'; - }); - - break; - case "Agricultural": - setState(() { - _assessmentLevel = '40'; - }); - - break; - case "Commercial": - setState(() { - _assessmentLevel = '50'; - }); - - break; - case "Industrial": - setState(() { - _assessmentLevel = '50'; - }); - - break; - case "Mineral": - setState(() { - _assessmentLevel = '50'; - }); - - break; - case "Timberland": - setState(() { - _assessmentLevel = '20'; - }); - - break; - default: - } - }); - }, - ), - SizedBox( - height: 10, - ), - Text('Assessment Level'), - 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(_assessmentLevel + '%'), - ), - ), - SizedBox( - height: 10, - ), - Text('Assessment Value'), - 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(calculateAssessmentValue().toString() == - "0.00" - ? "00.0" - : calculateAssessmentValue())), - ), - ), - const SizedBox(height: 10), - Row( - children: [ - Container( - width: 120, - height: 60, - padding: const EdgeInsets.all(8.0), - child: ElevatedButton( - onPressed: () async { - final tempID = - await SharedPreferences.getInstance(); - print(tempID.getInt('landid')! - 1); - var assessment = LandPropertyAssessment( - landapprDetailsId: - tempID.getInt('landid')! - 1, - actualUse: _actualUse, - marketval: _unitValue.toString(), - assessmentLevel: _assessmentLevel, - assessedValue: - calculateAssessmentValue() - .toString(), - totalMarketval: '0', - totalAssessedval: '0'); - - context - .read() - .add(AddLandPropertyAssessment( - assessment: assessment)); - }, - style: ElevatedButton.styleFrom( - primary: Colors.black, - ), - child: const Text("Submit"), - ), - ), - const SizedBox( - width: - 5), // Use SizedBox for horizontal spacing in a Row - Container( - width: 120, - height: 60, - padding: const EdgeInsets.all(8.0), - child: ElevatedButton( - onPressed: () { - context - .read() - .add( - const LoadLandPropertyAssessment()); - }, - style: ElevatedButton.styleFrom( - primary: Colors.black, - ), - child: const Text("Cancel"), - ), - ), - ], - ) - ], - ), - ), - ), - )); - } - if (state is LandValueAdjustmentsErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context - .read() - .add(const LoadLandValueAdjustments()); - }, - ); - } - return Container(); - }); - } - if (state is LandPropertyAssessmentErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context - .read() - .add(const LoadLandPropertyAssessment()); - }, - ); - } - return Container(); - }); - } -} diff --git a/lib/screens/passo/Land/add_land/land_appraisal.dart b/lib/screens/passo/Land/add_land/land_appraisal.dart deleted file mode 100644 index fd8e5e3..0000000 --- a/lib/screens/passo/Land/add_land/land_appraisal.dart +++ /dev/null @@ -1,282 +0,0 @@ -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:intl/intl.dart'; -import 'package:unit2/bloc/passo/land/land_appraisal/land_appraisal_bloc.dart'; -import 'package:unit2/model/passo/land_appr.dart'; -import 'package:unit2/screens/passo/Land/add_land/AddLandAppraisal.dart'; -import 'package:unit2/utils/alerts.dart'; -import 'package:unit2/utils/text_container.dart'; -import 'package:unit2/widgets/error_state.dart'; -import 'package:unit2/widgets/passo/custom_button.dart'; - -class LandAppraisal extends StatefulWidget { - Function PrevBtn; - Function NextBtn; - LandAppraisal(this.PrevBtn, this.NextBtn); - @override - _LandAppraisal createState() => _LandAppraisal(); -} - -class _LandAppraisal extends State { - // double _totalMarketValue(items) { - // double total = 0; - // items.forEach((row) { - // total += double.parse(row); - // }); - // return total; - // } - - void deleteItem(int itemId) { - context.read().add(DeleteLandAppraisal(id: itemId)); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - body: ProgressHUD( - padding: const EdgeInsets.all(24), - backgroundColor: Colors.black87, - indicatorWidget: const SpinKitFadingCircle(color: Colors.white), - child: BlocConsumer( - listener: (context, state) { - if (state is LandAppraisalLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - if (state is LandAppraisalLoaded) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - if (state is LandAppraisalErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, builder: (context, state) { - final state = context.watch().state; - if (state is LandAppraisalLoaded) { - return Column( - children: [ - Expanded( - child: SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - children: [ - Container( - margin: const EdgeInsets.only( - left: 0, top: 20, right: 0, bottom: 10), - child: const Text('LAND APPRAISAL', - 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(ShowLandAppraisal()); - }, - 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('Classification'), - ), - const DataColumn( - label: Text('Sub-Classification'), - ), - const DataColumn( - label: Text('Area'), - ), - const DataColumn( - label: Text('Unit Value'), - ), - const DataColumn( - label: Text('Base MArket Value'), - ), - const DataColumn( - label: Text('Action'), - ) - ], - rows: state.land_appr.map((dataRow) { - return DataRow( - cells: [ - DataCell(Text(dataRow.classification!)), - DataCell(Text(dataRow.subClass!)), - DataCell(Text(dataRow.area!)), - DataCell(Text( - ((double.parse(dataRow.unitValue!))) - .toString())), - DataCell(Text(((double.parse( - dataRow.baseMarketval!))) - .toString())), - DataCell(Row( - children: [ - InkWell( - child: Container( - height: 30, - width: 30, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.red, - ), - child: Icon( - Icons.delete, - color: Colors.white, - size: 20.0, - ), - ), - onTap: () { - deleteItem(dataRow.id!); - }, - ), - SizedBox( - width: 10, - ), - InkWell( - child: Container( - height: 30, - width: 30, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.red, - ), - child: Icon( - Icons.edit, - color: Colors.white, - size: 20.0, - ), - ), - onTap: () {}, - ), - ], - )) - ], - ); - }).toList())) - ], - ), - ), - )), - // Padding( - // padding: const EdgeInsets.only(left: 20.0, right: 20.0), - // child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // Text( - // 'Total', - // style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), - // ), - // Text( - // NumberFormat.currency(locale: 'en-PH', symbol: "₱") - // .format('1.0'), - // style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), - // ) - // ], - // ), - // ), - Padding( - padding: const EdgeInsets.all(15.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - CustomButton( - icon: const Icon(Icons.chevron_left_rounded, - color: Colors.white), - onPressed: () { - { - widget.PrevBtn(); - } - ; - }, - ), - CustomButton( - icon: const Icon(Icons.chevron_right_rounded, - color: Colors.white), - onPressed: () { - { - widget.NextBtn(); - } - ; - }, - ) - ], - ), - ), - ], - ); - } - if (state is LandAppraisalDeletedState) { - if (state.success) { - WidgetsBinding.instance.addPostFrameCallback((_) { - successAlert(context, "Deletion Successful", - "Extra item has been deleted successfully", () { - Navigator.of(context).pop(); - context - .read() - .add(const LoadLandAppraisal()); - }); - }); - } - } - if (state is ShowAddLandAppraisalScreen) { - return ConstrainedBox( - constraints: BoxConstraints(maxHeight: 1000.0), - child: AlertDialog( - insetPadding: EdgeInsets.symmetric( - horizontal: 20.0, - vertical: 10.0, - ), - title: Text( - 'ADD LAND APPRAISAL', - textAlign: TextAlign.center, - ), - content: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded(child: AddLandAppraisalModal()), - ], - ), - ), - ); - } - if (state is LandAppraisalErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context.read().add(LoadLandAppraisal()); - }, - ); - } - return Container(); - }), - ), - ); - } -} diff --git a/lib/screens/passo/Land/add_land/location_and_boundaries.dart b/lib/screens/passo/Land/add_land/location_and_boundaries.dart deleted file mode 100644 index 4c40f29..0000000 --- a/lib/screens/passo/Land/add_land/location_and_boundaries.dart +++ /dev/null @@ -1,143 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -import 'package:unit2/bloc/passo/land/land_property_owner_info/land_property_owner_info_bloc.dart'; -import 'package:unit2/model/passo/land_property_boundaries.dart'; -import 'package:unit2/model/passo/land_property_loc.dart'; -import 'package:unit2/screens/passo/Land/add_land.dart'; -import 'package:unit2/widgets/passo/custom_button.dart'; -import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart'; - -class LandLocationAndBoundaries extends StatefulWidget { - Function PrevBtn; - Function NextBtn; - LandLocationAndBoundaries(this.PrevBtn, this.NextBtn); - @override - _LandLocationAndBoundaries createState() => _LandLocationAndBoundaries(); -} - -class _LandLocationAndBoundaries extends State { - @override - Widget build(BuildContext context) { - return SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - margin: const EdgeInsets.only( - left: 0, top: 20, right: 0, bottom: 10), - child: const Text('PROPERTY LOCATION', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18), - textAlign: TextAlign.left), - ), - const SizedBox(height: 15), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Expanded( - // optional flex property if flex is 1 because the default flex is 1 - 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('PROPERTY BOUNDARIES', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18), - textAlign: TextAlign.left), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Expanded( - flex: 1, - child: customTextField("North", "", "north"), - ), - const SizedBox(width: 10.0), - Expanded( - // optional flex property if flex is 1 because the default flex is 1 - flex: 1, - child: customTextField("East", "", "east")) - ]), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Expanded( - flex: 1, - child: customTextField("South", "", "south"), - ), - const SizedBox(width: 10.0), - Expanded( - // optional flex property if flex is 1 because the default flex is 1 - flex: 1, - child: customTextField("West", "", "west")) - ]), - SizedBox( - height: 50, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - CustomButton( - icon: const Icon(Icons.chevron_left, color: Colors.white), - onPressed: () { - widget.PrevBtn(); - }), - CustomButton( - icon: - const Icon(Icons.chevron_right, color: Colors.white), - onPressed: () async { - final tempID = await SharedPreferences.getInstance(); - print(tempID.getInt('landid')); - var boundaries = LandPropertyBoundaries( - id: tempID.getInt('landid')! - 1, - north: landKey.currentState?.value['north'], - east: landKey.currentState?.value['east'], - west: landKey.currentState?.value['west'], - south: landKey.currentState?.value['south'], - ); - var location = LandPropertyLoc( - id: tempID.getInt('landid')! - 1, - street: landKey.currentState?.value['street'], - barangay: landKey.currentState?.value['brgy'], - municipality: - landKey.currentState?.value['municipality'], - province: landKey.currentState?.value['province'], - ); - - // context.read() - // ..add( - // UpdateLandBoundaries(land_boundaries: boundaries)) - // ..add(UpdateLandLoc(land_loc: location)); - - widget.NextBtn(); - }) - ], - ) - ]), - ), - ); - } -} diff --git a/lib/screens/passo/Land/add_land/other_improvements.dart b/lib/screens/passo/Land/add_land/other_improvements.dart deleted file mode 100644 index d84bcd2..0000000 --- a/lib/screens/passo/Land/add_land/other_improvements.dart +++ /dev/null @@ -1,285 +0,0 @@ -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/land/other_improvements/other_improvements_bloc.dart'; -import 'package:unit2/screens/passo/Land/add_land/AddOtherImprovementModal.dart'; -import 'package:unit2/utils/alerts.dart'; -import 'package:unit2/widgets/passo/custom_button.dart'; - -class OtherImprovementPage extends StatefulWidget { - Function PrevBtn; - Function NextBtn; - OtherImprovementPage(this.PrevBtn, this.NextBtn); - @override - _OtherImprovementPage createState() => _OtherImprovementPage(); -} - -class _OtherImprovementPage extends State { - // double _totalMarketValue(items) { - // double total = 0; - // items.forEach((row) { - // total += double.parse(row); - // }); - // return total; - // } - - void deleteItem(int itemId) { - context - .read() - .add(DeleteOtherImprovement(id: itemId)); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - body: ProgressHUD( - padding: const EdgeInsets.all(24), - backgroundColor: Colors.black87, - indicatorWidget: const SpinKitFadingCircle(color: Colors.white), - child: BlocConsumer( - listener: (context, state) { - if (state is OtherImprovementLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - if (state is OtherImprovementLoaded) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - if (state is OtherImprovementErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, builder: (context, state) { - final state = context.watch().state; - if (state is OtherImprovementLoaded) { - return Column( - children: [ - Expanded( - child: SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - children: [ - Container( - margin: const EdgeInsets.only( - left: 0, top: 20, right: 0, bottom: 10), - child: const Text('OTHER IMPROVEMENTS', - 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(ShowOtherImprovement()); - }, - child: const Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text('ADD ITEM'), // <-- Text - SizedBox( - width: 5, - ), - Icon( - // <-- Icon - Icons.add, - size: 24.0, - ), - ], - ), - ), - ), - SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: DataTable( - // ignore: prefer_const_literals_to_create_immutables - columns: [ - const DataColumn( - label: Text('Kinds of Tress'), - ), - const DataColumn( - label: Text('Sub-Class / Age'), - ), - const DataColumn( - label: Text('Type of Tree'), - ), - const DataColumn( - label: Text('No.'), - ), - const DataColumn( - label: Text('No. of Productive'), - ), - const DataColumn( - label: Text('No. of Non-Productive'), - ), - const DataColumn( - label: Text('Unit Value'), - ), - const DataColumn( - label: Text('Base Market Value'), - ), - const DataColumn( - label: Text('Action'), - ) - ], - rows: state.other_imp.map((dataRow) { - return DataRow( - cells: [ - DataCell(Text(dataRow.kindsOfTrees!)), - DataCell(Text(dataRow.subclassAge!)), - DataCell(Text(dataRow.fruitBearing == '1' - ? "Fruit Bearing" - : "Non-Fruit Bearing")), - DataCell( - Text(dataRow.quantity.toString()!)), - DataCell(Text( - dataRow.noOfProductive.toString()!)), - DataCell(Text(dataRow.noOfNonproductive - .toString()!)), - DataCell( - Text(dataRow.unitValue.toString()!)), - DataCell(Text( - dataRow.baseMarketval.toString()!)), - DataCell(Row( - children: [ - InkWell( - child: Container( - height: 30, - width: 30, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.red, - ), - child: Icon( - Icons.delete, - color: Colors.white, - size: 20.0, - ), - ), - onTap: () { - deleteItem(dataRow.id!); - }, - ), - SizedBox( - width: 10, - ), - InkWell( - child: Container( - height: 30, - width: 30, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.red, - ), - child: Icon( - Icons.edit, - color: Colors.white, - size: 20.0, - ), - ), - onTap: () {}, - ), - ], - )) - ], - ); - }).toList())) - ], - ), - ), - )), - // Padding( - // padding: const EdgeInsets.only(left: 20.0, right: 20.0), - // child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // Text( - // 'Total', - // style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), - // ), - // Text( - // NumberFormat.currency(locale: 'en-PH', symbol: "₱") - // .format('1.0'), - // style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), - // ) - // ], - // ), - // ), - Padding( - padding: const EdgeInsets.all(15.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - CustomButton( - icon: const Icon(Icons.chevron_left_rounded, - color: Colors.white), - onPressed: () { - { - widget.PrevBtn(); - } - ; - }, - ), - CustomButton( - icon: const Icon(Icons.chevron_right_rounded, - color: Colors.white), - onPressed: () { - { - widget.NextBtn(); - } - ; - }, - ) - ], - ), - ), - ], - ); - } - if (state is OtherImprovementDeletedState) { - if (state.success) { - WidgetsBinding.instance.addPostFrameCallback((_) { - successAlert(context, "Deletion Successful", - "Extra item has been deleted successfully", () { - Navigator.of(context).pop(); - context - .read() - .add(const LoadOtherImprovement()); - }); - }); - } - } - if (state is ShowAddOtherImprovementScreen) { - return ConstrainedBox( - constraints: BoxConstraints(maxHeight: 1000.0), - child: AlertDialog( - insetPadding: const EdgeInsets.symmetric( - horizontal: 20.0, - vertical: 10.0, - ), - title: const Text( - 'ADD OTHER IMPROVEMENTS', - textAlign: TextAlign.center, - ), - content: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [Expanded(child: AddOtherImprovementModal())], - ), - ), - ); - } - return Container(); - }), - ), - ); - } -} diff --git a/lib/screens/passo/Land/add_land/property_assessment.dart b/lib/screens/passo/Land/add_land/property_assessment.dart deleted file mode 100644 index 69f5a08..0000000 --- a/lib/screens/passo/Land/add_land/property_assessment.dart +++ /dev/null @@ -1,263 +0,0 @@ -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/land/land_property_assessment/land_property_assessment_bloc.dart'; -import 'package:unit2/screens/passo/Land/add_land/AddPropertyAssessmentModal.dart'; -import 'package:unit2/utils/alerts.dart'; -import 'package:unit2/widgets/passo/custom_button.dart'; - -class LandPropertyAssessmentPage extends StatefulWidget { - Function PrevBtn; - Function NextBtn; - LandPropertyAssessmentPage(this.PrevBtn, this.NextBtn); - @override - _LandPropertyAssessmentPage createState() => _LandPropertyAssessmentPage(); -} - -class _LandPropertyAssessmentPage extends State { - // double _totalMarketValue(items) { - // double total = 0; - // items.forEach((row) { - // total += double.parse(row); - // }); - // return total; - // } - - void deleteItem(int itemId) { - context - .read() - .add(DeleteLandPropertyAssessment(id: itemId)); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - body: ProgressHUD( - padding: const EdgeInsets.all(24), - backgroundColor: Colors.black87, - indicatorWidget: const SpinKitFadingCircle(color: Colors.white), - child: BlocConsumer(listener: (context, state) { - if (state is LandPropertyAssessmentLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - if (state is LandPropertyAssessmentLoaded) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - if (state is LandPropertyAssessmentErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, builder: (context, state) { - final state = context.watch().state; - if (state is LandPropertyAssessmentLoaded) { - return Column( - children: [ - Expanded( - child: SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - children: [ - Container( - margin: const EdgeInsets.only( - left: 0, top: 20, right: 0, bottom: 10), - child: const Text('PROPERTY ASSESSMENT', - 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(ShowLandPropertyAssessment()); - }, - 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('Actual Use'), - ), - const DataColumn( - label: Text('Market Value'), - ), - const DataColumn( - label: Text('Assessment Level'), - ), - const DataColumn( - label: Text('Assessed Value'), - ), - const DataColumn( - label: Text('Action'), - ) - ], - rows: state.assessment.map((dataRow) { - return DataRow( - cells: [ - DataCell(Text(dataRow.actualUse!)), - DataCell(Text(dataRow.marketval!)), - DataCell( - Text(dataRow.assessmentLevel! + '%')), - DataCell(Text(dataRow.assessedValue!)), - DataCell(Row( - children: [ - InkWell( - child: Container( - height: 30, - width: 30, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.red, - ), - child: Icon( - Icons.delete, - color: Colors.white, - size: 20.0, - ), - ), - onTap: () { - deleteItem(dataRow.id!); - }, - ), - SizedBox( - width: 10, - ), - InkWell( - child: Container( - height: 30, - width: 30, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.red, - ), - child: Icon( - Icons.edit, - color: Colors.white, - size: 20.0, - ), - ), - onTap: () {}, - ), - ], - )) - ], - ); - }).toList())) - ], - ), - ), - )), - // Padding( - // padding: const EdgeInsets.only(left: 20.0, right: 20.0), - // child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // Text( - // 'Total', - // style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), - // ), - // Text( - // NumberFormat.currency(locale: 'en-PH', symbol: "₱") - // .format('1.0'), - // style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), - // ) - // ], - // ), - // ), - Padding( - padding: const EdgeInsets.all(15.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - CustomButton( - icon: const Icon(Icons.chevron_left_rounded, - color: Colors.white), - onPressed: () { - { - widget.PrevBtn(); - } - ; - }, - ), - CustomButton( - icon: const Icon(Icons.chevron_right_rounded, - color: Colors.white), - onPressed: () { - { - widget.NextBtn(); - } - ; - }, - ) - ], - ), - ), - ], - ); - } - if (state is LandPropertyAssessmentDeletedState) { - if (state.success) { - WidgetsBinding.instance.addPostFrameCallback((_) { - successAlert(context, "Deletion Successful", - "Extra item has been deleted successfully", () { - Navigator.of(context).pop(); - context - .read() - .add(const LoadLandPropertyAssessment()); - }); - }); - } - } - if (state is ShowAddLandPropertyAssessmentScreen) { - return ConstrainedBox( - constraints: BoxConstraints(maxHeight: 1000.0), - child: AlertDialog( - insetPadding: EdgeInsets.symmetric( - horizontal: 20.0, - vertical: 10.0, - ), - title: Text( - 'ADD PROPERTY ASSESSMENT', - textAlign: TextAlign.center, - ), - content: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [Expanded(child: AddPropertyAssessmentModal())], - ), - ), - ); - } - return Container(); - }), - ), - ); - } -} diff --git a/lib/screens/passo/Land/add_land/property_assessment_cont.dart b/lib/screens/passo/Land/add_land/property_assessment_cont.dart deleted file mode 100644 index c44bd06..0000000 --- a/lib/screens/passo/Land/add_land/property_assessment_cont.dart +++ /dev/null @@ -1,621 +0,0 @@ -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:form_builder_validators/form_builder_validators.dart'; -import 'package:searchfield/searchfield.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -import 'package:unit2/bloc/passo/land/land_ext/land_ext_bloc.dart'; -import 'package:unit2/bloc/passo/memoranda/memoranda_bloc.dart'; -import 'package:unit2/bloc/passo/signatories/signatories_bloc.dart'; -import 'package:unit2/model/passo/land_ext.dart'; -import 'package:unit2/model/passo/memoranda.dart'; -import 'package:unit2/model/passo/signatories.dart'; -import 'package:unit2/screens/passo/Land/add_land.dart'; -import 'package:unit2/theme-data.dart/colors.dart'; -import 'package:unit2/utils/text_container.dart'; -import 'package:unit2/widgets/error_state.dart'; - -class LandSignatories extends StatefulWidget { - Function onSAve; - LandSignatories(this.onSAve); - - @override - _LandSignatories createState() => _LandSignatories(); -} - -class _LandSignatories extends State { - bool isTaxable = false; - bool isExempt = false; - final focus = FocusNode(); - String _memoranda = ""; - @override - Widget build(BuildContext context) { - return Scaffold( - body: ProgressHUD( - padding: const EdgeInsets.all(24), - backgroundColor: Colors.black87, - indicatorWidget: const SpinKitFadingCircle(color: Colors.white), - child: BlocConsumer( - listener: (context, state) { - if (state is LandExtLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - - if (state is LandExtErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, - builder: (context, state) { - if (state is LandExtLoaded) { - return BlocConsumer( - listener: (context, state) { - if (state is SignatoriesLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - - if (state is SignatoriesErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, - builder: (context, state) { - if (state is SignatoriesLoaded) { - final signatories = state.signatories; - return BlocConsumer( - listener: (context, state) { - if (state is MemorandaLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - if (state is MemorandaLoaded) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - if (state is MemorandaErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, - builder: (context, state) { - if (state is MemorandaLoaded) { - return SingleChildScrollView( - child: Column( - children: [ - Container( - margin: const EdgeInsets.only( - left: 0, top: 20, right: 0, bottom: 10), - child: const Text('PROPERTY ASSESSMENT cont..', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18), - textAlign: TextAlign.left), - ), - 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: 'land_qtr', - validator: - FormBuilderValidators.compose([]), - ), - ), - const SizedBox( - width: 20, - ), - const Text('Yr.'), - SizedBox( - width: 70, - height: 25, - child: FormBuilderTextField( - name: 'land_yr', - validator: - FormBuilderValidators.compose([]), - ), - ), - ], - ), - ], - ), - Container( - margin: const EdgeInsets.only( - left: 0, top: 40, right: 0, bottom: 10), - child: const Text('SIGNATORIES', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18), - textAlign: TextAlign.left), - ), - 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_land', - autofocus: false, - items: signatories - .map((signatories) => - DropdownMenuItem( - value: signatories, - child: Text( - '${signatories.firstname} ${signatories.middlename} ${signatories.lastname}'), - )) - .toList()), - ), - Text('Name'), - ], - ), - const SizedBox( - width: 15, - ), - Column( - children: [ - SizedBox( - width: 100, - child: FormBuilderDateTimePicker( - name: 'app_date_land', - initialEntryMode: - DatePickerEntryMode.calendarOnly, - initialValue: DateTime.now(), - inputType: InputType.date, - - initialTime: const TimeOfDay( - hour: 8, minute: 0), - // locale: const Locale.fromSubtags(languageCode: 'fr'), - ), - ), - Text('Date'), - ], - ), - ], - ), - const SizedBox( - height: 30, - ), - const Align( - alignment: Alignment.centerLeft, - child: Text( - 'RECOMMENDING APPROVAL:', - style: - TextStyle(fontWeight: FontWeight.bold), - )), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - children: [ - Column( - children: [ - SizedBox( - width: 200, - child: FormBuilderDropdown( - name: 'rec_approval_land', - autofocus: false, - items: signatories - .map((signatories) => - DropdownMenuItem( - value: signatories, - child: Text( - '${signatories.firstname} ${signatories.middlename} ${signatories.lastname}'), - )) - .toList()), - ), - Text('Name'), - ], - ), - const SizedBox( - width: 15, - ), - Column( - children: [ - SizedBox( - width: 100, - child: FormBuilderDateTimePicker( - name: 'rec_date_land', - initialEntryMode: - DatePickerEntryMode.calendarOnly, - initialValue: DateTime.now(), - inputType: InputType.date, - - initialTime: const TimeOfDay( - hour: 8, minute: 0), - // locale: const Locale.fromSubtags(languageCode: 'fr'), - ), - ), - Text('Date'), - ], - ), - ], - ), - const SizedBox( - height: 30, - ), - const Align( - alignment: Alignment.centerLeft, - child: Text( - 'APPROVED BY:', - style: TextStyle( - fontWeight: FontWeight.bold, - ), - )), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Column( - children: [ - SizedBox( - width: 200, - child: FormBuilderDropdown( - name: 'apprvd_by_land', - autofocus: false, - items: signatories - .map((signatories) => - DropdownMenuItem( - value: signatories, - child: Text( - '${signatories.firstname} ${signatories.middlename} ${signatories.lastname}'), - )) - .toList()), - ), - Text('Name'), - ], - ), - const SizedBox( - width: 15, - ), - Column( - children: [ - SizedBox( - width: 100, - child: FormBuilderDateTimePicker( - name: 'apprvd_by_date_land', - initialEntryMode: - DatePickerEntryMode.calendarOnly, - initialValue: DateTime.now(), - inputType: InputType.date, - - initialTime: const TimeOfDay( - hour: 8, minute: 0), - // locale: const Locale.fromSubtags(languageCode: 'fr'), - ), - ), - Text('Date'), - ], - ), - ], - ), - const SizedBox( - height: 50, - ), - const Align( - alignment: Alignment.centerLeft, - child: Text( - 'MEMORANDA: ', - style: TextStyle( - fontWeight: FontWeight.bold, - ), - )), - SizedBox( - height: 50, - ), - SizedBox( - width: 500, - height: 100, - child: SearchField( - suggestions: state.memorada - .map((Memoranda memoranda) => - SearchFieldListItem( - '${memoranda.memoranda}', - item: - memoranda, // Change: Use individual Memoranda object - child: ListTile( - title: Text( - '${memoranda.memoranda}', - overflow: - TextOverflow.ellipsis, - ), - ), - )) - .toList(), - validator: FormBuilderValidators.required( - errorText: "This field is required"), - // searchInputDecoration: - // normalTextFieldStyle( - // "Memoranda", "") - // .copyWith( - // suffixIcon: const Icon( - // Icons.arrow_drop_down), - // ), - // focusNode: focus, - suggestionState: Suggestion.expand, - onSuggestionTap: (memoranda) { - setState(() { - _memoranda = memoranda.item!.memoranda!; - }); - focus.unfocus(); - }, - )), - SizedBox( - height: 30, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text('Sworn Statement No. :'), - SizedBox( - width: 150, - height: 20, - child: FormBuilderTextField( - name: 'sworn_statement_land', - decoration: InputDecoration(), - validator: - FormBuilderValidators.compose([]), - ), - ), - ], - ), - SizedBox( - height: 30, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text('Date Received:'), - SizedBox( - width: 150, - height: 20, - child: FormBuilderDateTimePicker( - name: 'date_received_land', - initialEntryMode: - DatePickerEntryMode.calendarOnly, - initialValue: DateTime.now(), - inputType: InputType.date, - - initialTime: - const TimeOfDay(hour: 8, minute: 0), - // locale: const Locale.fromSubtags(languageCode: 'fr'), - ), - ), - ], - ), - SizedBox( - height: 30, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text('Date of Entry in the Rec. of Ass. :'), - SizedBox( - width: 100, - height: 20, - child: FormBuilderDateTimePicker( - name: 'date_of_entry_land', - initialEntryMode: - DatePickerEntryMode.calendarOnly, - initialValue: DateTime.now(), - inputType: InputType.date, - - initialTime: - const TimeOfDay(hour: 8, minute: 0), - // locale: const Locale.fromSubtags(languageCode: 'fr'), - ), - ), - ], - ), - SizedBox( - height: 30, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text('By:'), - SizedBox( - width: 150, - height: 20, - child: FormBuilderTextField( - name: 'by_land', - decoration: InputDecoration(), - validator: - FormBuilderValidators.compose([]), - ), - ), - ], - ), - SizedBox( - height: 30, - ), - ElevatedButton( - onPressed: () async { - final tempID = - await SharedPreferences.getInstance(); - var ext = LandExt( - landapprDetailsId: - tempID.getInt('landid')! - 1, - taxable: isTaxable == true ? '1' : '0', - exempt: isExempt == true ? '1' : '0', - qtr: landKey - .currentState!.value['land_qtr'], - yr: landKey - .currentState!.value['land_yr'], - appraisedbyName: landKey.currentState!.value['appraised_by_land'].firstname + - ' ' + - landKey - .currentState! - .value['appraised_by_land'] - .middlename + - ' ' + - landKey - .currentState! - .value['appraised_by_land'] - .lastname, - appraisedbyDate: landKey - .currentState!.value['app_date_land'], - recommendapprName: landKey.currentState!.value['rec_approval_land'].firstname + - ' ' + - landKey - .currentState! - .value['rec_approval_land'] - .middlename + - ' ' + - landKey - .currentState! - .value['rec_approval_land'] - .lastname, - recommendapprDate: landKey - .currentState!.value['rec_date_land'], - approvedbyName: landKey.currentState!.value['apprvd_by_land'].firstname + - ' ' + - landKey.currentState!.value['apprvd_by_land'].middlename + - ' ' + - landKey.currentState!.value['apprvd_by_land'].lastname, - approvedbyDate: landKey.currentState!.value['apprvd_by_date_land'], - memoranda: _memoranda, - swornstatementNo: landKey.currentState!.value['sworn_statement_land'], - dateReceived: landKey.currentState!.value['date_received_land'], - entryDateAssessment: landKey.currentState!.value['date_of_entry_land'], - entryDateBy: landKey.currentState!.value['by_land']); - - print(ext.toJson()); - context.read() - ..add(UpdateLandExt(landext: ext)); - // widget.onSAve(); - }, - style: ElevatedButton.styleFrom( - backgroundColor: primary, - foregroundColor: Colors.red), - child: SizedBox( - width: 250, - height: 50, - child: Align( - alignment: Alignment.center, - child: Text( - 'Save', - style: TextStyle( - color: Colors.white, - ), - textAlign: TextAlign.center, - ), - ), - ), - ), - SizedBox( - height: 30, - ), - ], - )); - } - if (state is MemorandaErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context - .read() - .add(LoadMemoranda()); - }, - ); - } - return Container(); - }, - ); - } - if (state is SignatoriesErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context.read().add(LoadSignatories()); - }, - ); - } - return Container(); - }, - ); - } - if (state is LandExtErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context.read().add(LoadLandExt()); - }, - ); - } - return Container(); - }, - ), - ), - ); - } -} diff --git a/lib/screens/passo/Land/add_land/property_owner_info.dart b/lib/screens/passo/Land/add_land/property_owner_info.dart deleted file mode 100644 index f8fea59..0000000 --- a/lib/screens/passo/Land/add_land/property_owner_info.dart +++ /dev/null @@ -1,170 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_property_owner_info/land_property_owner_info_bloc.dart'; -import 'package:unit2/model/passo/land_property_owner.dart'; -import 'package:unit2/screens/passo/Land/add_land.dart'; -import 'package:unit2/widgets/passo/custom_button.dart'; -import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart'; - -class LandPropertyOwnerInfo extends StatefulWidget { - Function NextBtn; - LandPropertyOwnerInfo(this.NextBtn); - @override - _LandPropertyOwnerInfo createState() => _LandPropertyOwnerInfo(); -} - -class _LandPropertyOwnerInfo extends State { - final transaction_codes = ['New', 'Revision']; - @override - Widget build(BuildContext context) { - return SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.all(15.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), - customTextField("ARP No./ TD No.", "", "td_no"), - customTextField("Owner", "", "owner"), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Expanded(flex: 1, child: customTextField("PIN", "", "pin")), - 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("OCT/TCT CLOA No.", "", "cloa_no"), - ), - const SizedBox(width: 10.0), - Expanded( - // optional flex property if flex is 1 because the default flex is 1 - flex: 1, - child: customDatTimePicker("Dated", "", "dated")) - ]), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Expanded( - flex: 1, - child: customTextField("Survey No.", "", "survey_no"), - ), - const SizedBox(width: 10.0), - Expanded( - // optional flex property if flex is 1 because the default flex is 1 - 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", "", "blk")), - ]), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Expanded( - flex: 1, - child: customTextField("Address", "", "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.", "", "tel_no")) - ]), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Expanded( - flex: 1, - child: customTextField( - "Administrator/Beneficial User", "", "admin"), - ), - const SizedBox(width: 10.0), - Expanded( - // optional flex property if flex is 1 because the default flex is 1 - flex: 1, - child: customTextField("TIN", "", "admin_tin")) - ]), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Expanded( - flex: 1, - child: customTextField("Address", "", "admin_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.", "", "admin_telno")) - ]), - SizedBox( - height: 30, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - CustomButton( - icon: const Icon(Icons.chevron_right, color: Colors.white), - onPressed: () { - var land = LandPropertyOwner( - id: 1, - transCode: landKey - .currentState!.value['transaction_code'] - .toString(), - tdn: landKey.currentState!.value['td_no'], - cloaNo: landKey.currentState!.value['cloa_no'], - dated: landKey.currentState!.value['dated'], - assessedById: "1", - assessedByName: "cyril", - dateCreated: landKey.currentState!.value['dated'], - dateModified: landKey.currentState!.value['dated'], - pin: landKey.currentState!.value['pin'], - surveyNo: landKey.currentState!.value['survey_no'], - lotNo: landKey.currentState!.value['lot_no'], - blkNo: landKey.currentState!.value['blk'], - owner: landKey.currentState!.value['owner'], - address: landKey.currentState!.value['address'], - telno: landKey.currentState!.value['tel_no'], - tin: landKey.currentState!.value['tin'], - adminUser: landKey.currentState!.value['admin'], - adminAddress: - landKey.currentState!.value['admin_address'], - adminTin: landKey.currentState!.value['admin_tin'], - // faasType: "LAND", - adminTelno: landKey.currentState!.value['admin_telno']); - - context - .read() - .add(AddPropertyOwnerLand(land: land)); - - widget.NextBtn(); - }, - ) - ], - ), - const SizedBox( - height: 20, - ), - ]), - )); - } -} diff --git a/lib/screens/passo/Land/add_land/value_adjustments.dart b/lib/screens/passo/Land/add_land/value_adjustments.dart deleted file mode 100644 index b4e3321..0000000 --- a/lib/screens/passo/Land/add_land/value_adjustments.dart +++ /dev/null @@ -1,260 +0,0 @@ -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/land/land_value_adjustments/land_value_adjustments_bloc.dart'; -import 'package:unit2/screens/passo/Land/add_land/AddLandValueAdjustmentModal.dart'; -import 'package:unit2/utils/alerts.dart'; -import 'package:unit2/widgets/passo/custom_button.dart'; - -class ValueAdjustmentPage extends StatefulWidget { - Function PrevBtn; - Function NextBtn; - ValueAdjustmentPage(this.PrevBtn, this.NextBtn); - @override - _ValueAdjustmentPage createState() => _ValueAdjustmentPage(); -} - -class _ValueAdjustmentPage extends State { - void deleteItem(int itemId) { - context - .read() - .add(DeleteLandValueAdjustments(id: itemId)); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - body: ProgressHUD( - padding: const EdgeInsets.all(24), - backgroundColor: Colors.black87, - indicatorWidget: const SpinKitFadingCircle(color: Colors.white), - child: - BlocConsumer( - listener: (context, state) { - if (state is LandValueAdjustmentsLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - if (state is LandValueAdjustmentsLoaded) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - if (state is LandValueAdjustmentsErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, builder: (context, state) { - final state = context.watch().state; - if (state is LandValueAdjustmentsLoaded) { - return Column( - children: [ - Expanded( - child: SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - children: [ - Container( - margin: const EdgeInsets.only( - left: 0, top: 20, right: 0, bottom: 10), - child: const Text('VALUE ADJUSTMENTS', - 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(ShowLandValueAdjustments()); - }, - 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('Base Market Value'), - ), - const DataColumn( - label: Text('Adjustment Factors'), - ), - const DataColumn( - label: Text('% Adjustment'), - ), - const DataColumn( - label: Text('Value Adjustment'), - ), - const DataColumn( - label: Text('Market Value'), - ), - const DataColumn( - label: Text('Action'), - ) - ], - rows: state.val_adj.map((dataRow) { - return DataRow( - cells: [ - DataCell(Text(dataRow.baseMarketval!)), - DataCell( - Text(dataRow.adjustmentFactors!)), - DataCell(Text(dataRow.adjustment!)), - DataCell(Text(dataRow.valueAdjustment!)), - DataCell(Text(dataRow.marketValue!)), - DataCell(Row( - children: [ - InkWell( - child: Container( - height: 30, - width: 30, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.red, - ), - child: Icon( - Icons.delete, - color: Colors.white, - size: 20.0, - ), - ), - onTap: () { - deleteItem(dataRow.id!); - }, - ), - SizedBox( - width: 10, - ), - InkWell( - child: Container( - height: 30, - width: 30, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.red, - ), - child: Icon( - Icons.edit, - color: Colors.white, - size: 20.0, - ), - ), - onTap: () {}, - ), - ], - )) - ], - ); - }).toList())) - ], - ), - ), - )), - // Padding( - // padding: const EdgeInsets.only(left: 20.0, right: 20.0), - // child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // Text( - // 'Total', - // style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), - // ), - // Text( - // NumberFormat.currency(locale: 'en-PH', symbol: "₱") - // .format('1.0'), - // style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), - // ) - // ], - // ), - // ), - Padding( - padding: const EdgeInsets.all(15.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - CustomButton( - icon: const Icon(Icons.chevron_left_rounded, - color: Colors.white), - onPressed: () { - { - widget.PrevBtn(); - } - ; - }, - ), - CustomButton( - icon: const Icon(Icons.chevron_right_rounded, - color: Colors.white), - onPressed: () { - { - widget.NextBtn(); - } - ; - }, - ) - ], - ), - ), - ], - ); - } - if (state is LandValueAdjustmentsDeletedState) { - if (state.success) { - WidgetsBinding.instance.addPostFrameCallback((_) { - successAlert(context, "Deletion Successful", - "Extra item has been deleted successfully", () { - Navigator.of(context).pop(); - context - .read() - .add(const LoadLandValueAdjustments()); - }); - }); - } - } - if (state is ShowAddLandValueAdjustmentsScreen) { - return ConstrainedBox( - constraints: BoxConstraints(maxHeight: 1000.0), - child: AlertDialog( - insetPadding: EdgeInsets.symmetric( - horizontal: 20.0, - vertical: 10.0, - ), - title: Text( - 'ADD VALUE ADJUSTMENTS', - textAlign: TextAlign.center, - ), - content: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [Expanded(child: AddLandValueAdjustmentModal())], - ), - ), - ); - } - return Container(); - }), - ), - ); - } -} diff --git a/lib/screens/passo/Land/edit_land.dart b/lib/screens/passo/Land/edit_land.dart deleted file mode 100644 index 2491dce..0000000 --- a/lib/screens/passo/Land/edit_land.dart +++ /dev/null @@ -1,117 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_form_builder/flutter_form_builder.dart'; - -import 'package:im_stepper/stepper.dart'; -import 'package:unit2/model/passo/land_property_owner.dart'; -import 'package:unit2/screens/passo/Land/edit_land/land_appraisal.dart'; -import 'package:unit2/screens/passo/Land/edit_land/location_and_boundaries_edit.dart'; -import 'package:unit2/screens/passo/Land/edit_land/other_improvements_edit.dart'; -import 'package:unit2/screens/passo/Land/edit_land/property_assessment_cont_edit.dart'; -import 'package:unit2/screens/passo/Land/edit_land/property_assessment_edit.dart'; -import 'package:unit2/screens/passo/Land/edit_land/property_owner_info_edit.dart'; -import 'package:unit2/screens/passo/Land/edit_land/value_adjustments_edit.dart'; -import 'package:unit2/theme-data.dart/colors.dart'; - -GlobalKey landKey = GlobalKey(); - -class EditLand extends StatefulWidget { - final int index; - final LandPropertyOwner faas; - final String title; - - const EditLand( - {super.key, - required this.title, - required this.index, - required this.faas}); - @override - _EditLand createState() => _EditLand(); -} - -class _EditLand extends State { - // THE FOLLOWING TWO VARIABLES ARE REQUIRED TO CONTROL THE STEPPER. - int activeStep = 0; // Initial step set to 5. - - int upperBound = 6; // upperBound MUST BE total number of icons minus 1. - - void PrevBtn() { - setState(() { - activeStep--; - }); - } - - void NextBtn() { - setState(() { - activeStep++; - }); - } - - void onSAveAll() { - return Navigator.of(context).pop(); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - centerTitle: true, - backgroundColor: primary, - title: Text('Land FAAS'), - ), - body: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - children: [ - NumberStepper( - numbers: [1, 2, 3, 4, 5, 6, 7], - activeStepColor: primary, - numberStyle: TextStyle(color: Colors.white), - lineColor: primary, - // activeStep property set to activeStep variable defined above. - activeStep: activeStep, - activeStepBorderColor: Colors.white, - activeStepBorderWidth: 1, - // This ensures step-tapping updates the activeStep. - onStepReached: (index) { - setState(() { - activeStep = index; - }); - }, - ), - Expanded( - child: Container( - child: content(PrevBtn, NextBtn, onSAveAll), - ), - ), - ], - ), - ), - ); - } - - /// Returns the next button. - - // Returns the content widget based on the activeStep. - Widget content(PrevBtn, NextBtn, onSAveAll) { - switch (activeStep) { - case 0: - return LandPropertyOwnerInfoEdit(NextBtn, widget.faas!); - case 1: - return LandLocationAndBoundariesEdit(PrevBtn, NextBtn, widget.faas!); - case 2: - return LandAppraisalEdit(PrevBtn, NextBtn, widget.faas.id!); - case 3: - return OtherImprovementEditPage(PrevBtn, NextBtn, widget.faas.id!); - case 4: - return ValueAdjustmentEditPage(PrevBtn, NextBtn, widget.faas.id!); - case 5: - return LandPropertyAssessmentEditPage( - PrevBtn, NextBtn, widget.faas.id!); - case 6: - return LandSignatoriesEdit(onSAveAll, widget.faas.id!); - - default: - return LandPropertyOwnerInfoEdit(NextBtn, widget.faas!); - } - } -} diff --git a/lib/screens/passo/Land/edit_land/AddLandAppraisalEdit.dart b/lib/screens/passo/Land/edit_land/AddLandAppraisalEdit.dart deleted file mode 100644 index 10da057..0000000 --- a/lib/screens/passo/Land/edit_land/AddLandAppraisalEdit.dart +++ /dev/null @@ -1,464 +0,0 @@ -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:form_builder_validators/form_builder_validators.dart'; -import 'package:intl/intl.dart'; -import 'package:searchfield/searchfield.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -import 'package:unit2/bloc/passo/bulding/additional_item/additional_item_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_appraisal/land_appraisal_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_classification/land_classification_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_subclassification/land_subclassification_bloc.dart'; -import 'package:unit2/bloc/passo/municipality/municipality_bloc.dart'; -import 'package:unit2/model/passo/additional_items.dart'; -import 'package:unit2/model/passo/city.dart'; -import 'package:unit2/model/passo/class_components.dart'; -import 'package:unit2/model/passo/land_appr.dart'; -import 'package:unit2/model/passo/land_classification.dart'; -import 'package:unit2/model/passo/land_subclassification.dart'; -import 'package:unit2/model/passo/unit_construct.dart'; -import 'package:unit2/screens/passo/Land/add_land.dart'; -import 'package:unit2/theme-data.dart/form-style.dart'; -import 'package:unit2/utils/text_container.dart'; -import 'package:unit2/widgets/error_state.dart'; -import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart'; - -class AddLandAppraisalEditModal extends StatefulWidget { - // final List unit; - // final List options; - final int tempId; - - AddLandAppraisalEditModal(this.tempId); - - @override - _AddLandAppraisalEditModal createState() => _AddLandAppraisalEditModal(); -} - -class _AddLandAppraisalEditModal extends State { - final focus = FocusNode(); - bool isPainted = false; - bool isSecondHand = false; - TextEditingController textEditingController = TextEditingController(); - double _unitBase = 0; - int _areaValue = 0; - final double _depValue = 0; - double _unitValue = 0; - String _subClassDesc = ""; - int _classId = 0; - String _structureType = ""; - bool _withoutBUCC = false; - int _notPaintedUnitVal = 0; - int _secondHandUnitVal = 0; - String cityCode = ''; - String cityDesc = ''; - int classCode = 1; - String _classDesc = ''; - - GlobalKey appraisalLandKey = GlobalKey(); - - BoxDecoration box1() { - return const BoxDecoration(boxShadow: [ - BoxShadow(color: Colors.black12, spreadRadius: 5, blurRadius: 5) - ], color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(3))); - } - - double _amountofDepreciation(unitVal, unitBase, area, depreciation) { - return ((unitVal * unitBase) * area) * depreciation; - } - - double _totalMarketValue(unitBase, area) { - return unitBase * area; - } - - @override - Widget build(BuildContext context) { - return BlocConsumer( - listener: (context, state) { - if (state is LandAppraisalLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - if (state is LandAppraisalLoaded) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - if (state is LandAppraisalErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, buildWhen: (previous, current) { - return false; - }, builder: (context, state) { - if (state is ShowAddLandAppraisalScreen) { - return BlocConsumer( - listener: (context, state) { - // TODO: implement listener - }, - builder: (context, state) { - if (state is LandClassificationLoaded) { - final classification = state.land_classification; - return BlocConsumer( - listener: (context, state) { - // TODO: implement listener - }, - builder: (context, state) { - if (state is LandSubClassificationLoaded) { - final subclassification = state.land_subclassification; - return BlocConsumer( - listener: (context, state) { - // TODO: implement listener - }, - builder: (context, state) { - if (state is MunicipalityLoaded) { - return FormBuilder( - key: appraisalLandKey, - onChanged: () { - appraisalLandKey.currentState?.save(); - }, - autovalidateMode: AutovalidateMode.disabled, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - 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: Expanded( - flex: 1, - child: - FormBuilderDropdown( - name: - 'appraisal_municipality', - autofocus: false, - decoration: - normalTextFieldStyle( - cityDesc ?? - "Municipality", - ""), - items: state.municipality - .map((municipality) => - DropdownMenuItem< - City>( - value: municipality, - child: Text(municipality - .cityDescription!), // Use cityDescription instead of cityName - )) - .toList(), - onChanged: (selectedCity) { - if (selectedCity != null) { - final selectedCityCode = - selectedCity.cityCode; - setState(() { - cityCode = - selectedCityCode!; - cityDesc = selectedCity - .cityDescription!; - }); - final barangayBloc = - context.read< - LandSubClassificationBloc>(); - barangayBloc.add( - LoadLandSubClassification( - classCode: - classCode!, - cityCode: - selectedCityCode!)); // Use selectedCityCode directly - } - }, - )), - ), - Container( - margin: const EdgeInsets.only( - left: 0, - top: 10, - right: 0, - bottom: 0), - child: Expanded( - flex: 1, - child: FormBuilderDropdown< - LandClassification>( - name: 'classification', - autofocus: false, - decoration: - normalTextFieldStyle( - _classDesc - .toString() ?? - "Classification", - ""), - items: classification - .map((classification) => - DropdownMenuItem< - LandClassification>( - value: - classification, - child: Text( - classification - .description!), // Use cityDescription instead of cityName - )) - .toList(), - onChanged: (selectedClass) { - if (selectedClass != null) { - final selectedClassCode = - selectedClass.id; - setState(() { - classCode = - selectedClassCode!; - _classDesc = - selectedClass - .description!; - }); - final barangayBloc = - context.read< - LandSubClassificationBloc>(); - barangayBloc.add( - LoadLandSubClassification( - classCode: - selectedClassCode!, - cityCode: - cityCode)); // Use selectedCityCode directly - } - }, - )), - ), - Container( - margin: const EdgeInsets.only( - left: 0, - top: 10, - right: 0, - bottom: 0), - child: SizedBox( - height: 45, - child: SearchField( - itemHeight: 70, - suggestions: subclassification - .map((LandSubClassification - subclass) => - SearchFieldListItem( - '${subclass.subclassCode} - ${subclass.subclassDescription}', - item: subclass, - child: ListTile( - title: Text( - '${subclass.subclassCode} - ${subclass.subclassDescription!.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: (subclass) { - setState(() { - _unitBase = double.parse( - subclass.item! - .baseUnitMarketval!); - _subClassDesc = - '${subclass.item!.subclassCode} - ${subclass.item!.subclassDescription}'; - }); - focus.unfocus(); - }, - ), - ), - ), - const SizedBox(height: 10), - FormBuilderTextField( - name: 'land_appraisal_area', - decoration: normalTextFieldStyle( - "Area", ""), - validator: - FormBuilderValidators.compose( - []), - onChanged: (value) { - setState(() { - _areaValue = int.parse(value!); - }); - }, - ), - const SizedBox(height: 10), - const Text('Market Value'), - const SizedBox(height: 5), - Container( - height: 45.0, - width: double.infinity, - decoration: BoxDecoration( - color: Colors.white, - border: Border.all( - color: Colors.grey, - width: 1.0, - ), - borderRadius: - BorderRadius.circular(5.0), - ), - child: Align( - alignment: Alignment.center, - child: Text( - NumberFormat.currency( - locale: 'en-PH', - symbol: "₱") - .format( - _totalMarketValue( - _unitBase, - _areaValue)))), - ), - const SizedBox(height: 10), - Row( - children: [ - Container( - width: 120, - height: 60, - padding: - const EdgeInsets.all(8.0), - child: ElevatedButton( - onPressed: () async { - final tempID = - await SharedPreferences - .getInstance(); - print(tempID - .getInt('landid')); - var land_appraisal = LandAppr( - landapprDetailsId: - widget.tempId, - classification: - _classDesc, - subClass: _subClassDesc, - area: _areaValue - .toString(), - unitValue: _unitBase - .toString(), - baseMarketval: - _totalMarketValue( - _unitBase, - _areaValue) - .toString()); - - context - .read< - LandAppraisalBloc>() - .add(AddLandAppraisal( - land_appr: - land_appraisal)); - }, - style: - ElevatedButton.styleFrom( - primary: Colors.black, - ), - child: const Text("Submit"), - ), - ), - const SizedBox( - width: - 5), // Use SizedBox for horizontal spacing in a Row - Container( - width: 120, - height: 60, - padding: - const EdgeInsets.all(8.0), - child: ElevatedButton( - onPressed: () { - context - .read< - LandAppraisalBloc>() - .add( - LoadLandAppraisalEdit( - land_appr: < - LandAppr>[], - id: widget.tempId, - )); - }, - style: - ElevatedButton.styleFrom( - primary: Colors.black, - ), - child: const Text("Cancel"), - ), - ), - ], - ), - ], - ), - ), - ))); - } - if (state is MunicipalityErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context - .read() - .add(LoadMunicipality()); - }, - ); - } - return Container(); - }, - ); - } - if (state is LandSubClassificationErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context.read().add( - const LoadLandSubClassification( - cityCode: '1', classCode: 1)); - }, - ); - } - return Container(); - }, - ); - } - if (state is LandClassificationErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context - .read() - .add(LoadLandClassification()); - }, - ); - } - return Container(); - }, - ); - } - if (state is LandAppraisalErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context.read().add(LoadLandAppraisal()); - }, - ); - } - return Container(); - }); - } -} diff --git a/lib/screens/passo/Land/edit_land/AddOtherImprovementEditModal.dart b/lib/screens/passo/Land/edit_land/AddOtherImprovementEditModal.dart deleted file mode 100644 index 65582a8..0000000 --- a/lib/screens/passo/Land/edit_land/AddOtherImprovementEditModal.dart +++ /dev/null @@ -1,358 +0,0 @@ -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/bloc/passo/land/land_trees_improvements/land_trees_improvements_bloc.dart'; -import 'package:unit2/bloc/passo/land/other_improvements/other_improvements_bloc.dart'; -import 'package:unit2/model/passo/other_improvements.dart'; -import 'package:unit2/model/passo/trees_improvements.dart'; -import 'package:unit2/theme-data.dart/form-style.dart'; -import 'package:unit2/utils/text_container.dart'; -import 'package:unit2/widgets/error_state.dart'; - -class AddOtherImprovementEditModal extends StatefulWidget { - // final List unit; - // final List options; - final int tempId; - - AddOtherImprovementEditModal(this.tempId); - - @override - _AddOtherImprovementEditModal createState() => - _AddOtherImprovementEditModal(); -} - -class _AddOtherImprovementEditModal - extends State { - final focus = FocusNode(); - bool isPainted = false; - bool isSecondHand = false; - TextEditingController textEditingController = TextEditingController(); - double _unitBase = 0; - int _areaValue = 0; - final double _depValue = 0; - double _unitValue = 0; - String _subClassDesc = ""; - int _classId = 0; - String _structureType = ""; - int _notPaintedUnitVal = 0; - int _secondHandUnitVal = 0; - String cityCode = ''; - String cityDesc = ''; - int classCode = 1; - String _classDesc = ''; - String _treeType = ""; - bool _nonfruitBearing = false; - bool _fruitBearing = false; - int qty = 0; - int pr_qty = 0; - int nonpr_qty = 0; - - GlobalKey otherImpKey = GlobalKey(); - - final typeOfTree = [ - "Non-Fruit Bearing", - "Fruit Bearing", - ]; - - _calculateBaseMarketValue() { - double base = 0.00; - if (_fruitBearing) { - base = (pr_qty + nonpr_qty) * _unitValue; - } else { - base = qty * _unitValue; - } - return base; - } - - BoxDecoration box1() { - return const BoxDecoration(boxShadow: [ - BoxShadow(color: Colors.black12, spreadRadius: 5, blurRadius: 5) - ], color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(3))); - } - - double _amountofDepreciation(unitVal, unitBase, area, depreciation) { - return ((unitVal * unitBase) * area) * depreciation; - } - - double _totalMarketValue(unitBase, area) { - return unitBase * area; - } - - @override - Widget build(BuildContext context) { - return BlocBuilder( - buildWhen: (previous, current) { - return false; - }, builder: (context, state) { - if (state is ShowAddOtherImprovementScreen) { - return BlocConsumer(listener: (context, state) { - // TODO: implement listener - }, builder: (context, state) { - if (state is LandTreesImprovementsLoaded) { - final trees = state.trees_imp; - return FormBuilder( - key: otherImpKey, - onChanged: () { - otherImpKey.currentState?.save(); - }, - autovalidateMode: AutovalidateMode.disabled, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - 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: Expanded( - flex: 1, - child: FormBuilderDropdown( - name: 'kinds_of_trees', - autofocus: false, - decoration: normalTextFieldStyle( - "Kinds of Trees", ""), - items: state.trees_imp - .map((trees) => - DropdownMenuItem( - value: trees, - child: Text( - (trees.improvement ?? "") + - " " + - (trees.subclassCode ?? ""), - ), - )) - .toList(), - onChanged: (selectedTree) { - if (selectedTree != null) { - setState(() { - _unitValue = double.parse( - selectedTree.pricePerTree!); - _treeType = selectedTree.improvement!; - }); - } - }, - )), - ), - Container( - child: Row( - children: [ - Row( - children: [ - Checkbox( - value: _fruitBearing, - onChanged: (bool? value) { - setState(() { - _fruitBearing = value!; - }); - }, - ), - Text('Fruit Bearing ?'), - ], - ), - ], - ), - ), - Visibility( - visible: !_fruitBearing, - child: Row( - children: [ - Expanded( - child: FormBuilderTextField( - name: 'subClass', - decoration: normalTextFieldStyle( - "SubClass/Age", ""), - validator: - FormBuilderValidators.compose([]), - onChanged: (value) { - setState(() { - _subClassDesc = value!; - }); - }, - ), - ), - SizedBox( - width: 10, - ), - Expanded( - child: FormBuilderTextField( - name: 'qty', - decoration: normalTextFieldStyle("No.", ""), - validator: - FormBuilderValidators.compose([]), - onChanged: (value) { - setState(() { - qty = int.parse(value!); - }); - }, - ), - ), - ], - ), - replacement: Column( - children: [ - FormBuilderTextField( - name: 'no_of_productive', - decoration: normalTextFieldStyle( - "No. of Productive", ""), - validator: FormBuilderValidators.compose([]), - onChanged: (value) { - setState(() { - pr_qty = int.parse(value!); - }); - }, - ), - const SizedBox(height: 10), - FormBuilderTextField( - name: 'no_of_nonproductive', - decoration: normalTextFieldStyle( - "No. of Non-Productive", ""), - validator: FormBuilderValidators.compose([]), - onChanged: (value) { - setState(() { - nonpr_qty = int.parse(value!); - }); - }, - ), - ], - ), - ), - const SizedBox(height: 10), - const Text('Market Value'), - const SizedBox(height: 5), - Container( - height: 45.0, - width: double.infinity, - decoration: BoxDecoration( - color: Colors.white, - border: Border.all( - color: Colors.grey, - width: 1.0, - ), - borderRadius: BorderRadius.circular(5.0), - ), - child: Align( - alignment: Alignment.center, - child: Text(NumberFormat.currency( - locale: 'en-PH', symbol: "₱") - .format(_unitValue))), - ), - const SizedBox(height: 10), - const Text('Base 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(_calculateBaseMarketValue().toString() == - "0.00" - ? "00.0" - : _calculateBaseMarketValue())), - ), - ), - const SizedBox(height: 10), - Row( - children: [ - Container( - width: 120, - height: 60, - padding: const EdgeInsets.all(8.0), - child: ElevatedButton( - onPressed: () async { - var improvement = OtherImprovements( - landapprDetailsId: widget.tempId, - kindsOfTrees: _treeType, - subclassAge: _subClassDesc, - quantity: qty, - unitValue: _unitValue.toString(), - baseMarketval: - _calculateBaseMarketValue() - .toString(), - noOfProductive: pr_qty, - noOfNonproductive: nonpr_qty, - fruitBearing: - _fruitBearing == true ? "1" : "0"); - - context.read().add( - AddOtherImprovement( - other_imp: improvement)); - }, - style: ElevatedButton.styleFrom( - primary: Colors.black, - ), - child: const Text("Submit"), - ), - ), - const SizedBox( - width: - 5), // Use SizedBox for horizontal spacing in a Row - Container( - width: 120, - height: 60, - padding: const EdgeInsets.all(8.0), - child: ElevatedButton( - onPressed: () { - context.read().add( - LoadOtherImprovementEdit( - other_imps: [], - ids: widget.tempId)); - }, - style: ElevatedButton.styleFrom( - primary: Colors.black, - ), - child: const Text("Cancel"), - ), - ), - ], - ) - ], - ), - ), - ), - )); - } - if (state is LandTreesImprovementsErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context - .read() - .add(LoadLandTreesImprovements()); - }, - ); - } - return Container(); - }); - } - if (state is OtherImprovementErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context.read().add(LoadOtherImprovement()); - }, - ); - } - return Container(); - }); - } -} diff --git a/lib/screens/passo/Land/edit_land/AddPropertyAssessmentEditModal.dart b/lib/screens/passo/Land/edit_land/AddPropertyAssessmentEditModal.dart deleted file mode 100644 index dfe078d..0000000 --- a/lib/screens/passo/Land/edit_land/AddPropertyAssessmentEditModal.dart +++ /dev/null @@ -1,356 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_form_builder/flutter_form_builder.dart'; -import 'package:intl/intl.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -import 'package:unit2/bloc/passo/land/land_property_assessment/land_property_assessment_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_value_adjustments/land_value_adjustments_bloc.dart'; -import 'package:unit2/model/passo/land_property_assessment.dart'; -import 'package:unit2/model/passo/land_value_adjustment.dart'; -import 'package:unit2/theme-data.dart/form-style.dart'; -import 'package:unit2/utils/text_container.dart'; -import 'package:unit2/widgets/error_state.dart'; - -class AddPropertyAssessmentEditModal extends StatefulWidget { - // final List unit; - // final List options; - final int tempId; - - AddPropertyAssessmentEditModal(this.tempId); - - @override - _AddPropertyAssessmentEditModal createState() => - _AddPropertyAssessmentEditModal(); -} - -class _AddPropertyAssessmentEditModal - extends State { - final focus = FocusNode(); - bool isPainted = false; - bool isSecondHand = false; - TextEditingController textEditingController = TextEditingController(); - double _unitBase = 0; - int _areaValue = 0; - final double _depValue = 0; - double _unitValue = 0; - String _subClassDesc = ""; - int _classId = 0; - String _structureType = ""; - int _notPaintedUnitVal = 0; - int _secondHandUnitVal = 0; - String cityCode = ''; - String cityDesc = ''; - int classCode = 1; - String _classDesc = ''; - String _treeType = ""; - bool _nonfruitBearing = false; - bool _fruitBearing = false; - int qty = 0; - int pr_qty = 0; - int nonpr_qty = 0; - String _actualUse = "Residential"; - String _assessmentLevel = ""; - - GlobalKey assessmentKey = GlobalKey(); - - final typeOfTree = [ - "Non-Fruit Bearing", - "Fruit Bearing", - ]; - - final actual_use = [ - "Residential", - "Agricultural", - "Commercial", - "Industrial", - "Mineral", - "Timberland", - ]; - - calculateAssessmentValue() { - switch (_actualUse) { - case "Residential": - return (_unitValue * 0.20).ceil(); - break; - case "Agricultural": - return (_unitValue * 0.40).ceil(); - break; - case "Commercial": - return (_unitValue * 0.50).ceil(); - break; - case "Industrial": - return (_unitValue * 0.50).ceil(); - break; - case "Mineral": - return (_unitValue * 0.50).ceil(); - break; - case "Timberland": - return (_unitValue * 0.20).ceil(); - break; - default: - } - } - - BoxDecoration box1() { - return const BoxDecoration(boxShadow: [ - BoxShadow(color: Colors.black12, spreadRadius: 5, blurRadius: 5) - ], color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(3))); - } - - double _amountofDepreciation(unitVal, unitBase, area, depreciation) { - return ((unitVal * unitBase) * area) * depreciation; - } - - double _totalMarketValue(unitBase, area) { - return unitBase * area; - } - - @override - Widget build(BuildContext context) { - return BlocBuilder( - buildWhen: (previous, current) { - return false; - }, builder: (context, state) { - if (state is ShowAddLandPropertyAssessmentScreen) { - return BlocConsumer(listener: (context, state) { - // TODO: implement listener - }, builder: (context, state) { - if (state is LandValueAdjustmentsLoaded) { - final assessment = state.val_adj; - return FormBuilder( - key: assessmentKey, - onChanged: () { - assessmentKey.currentState?.save(); - }, - autovalidateMode: AutovalidateMode.disabled, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - 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: Expanded( - flex: 1, - child: FormBuilderDropdown( - name: 'value_adjustments', - autofocus: false, - decoration: normalTextFieldStyle( - "Value Adjustments", ""), - items: state.val_adj - .map((adj) => - DropdownMenuItem( - value: adj, - child: Text( - (adj.adjustmentFactors ?? ""), - ), - )) - .toList(), - onChanged: (selectedAdj) { - if (selectedAdj != null) { - setState(() { - _unitValue = double.parse( - selectedAdj.marketValue!); - }); - } - }, - )), - ), - SizedBox( - height: 10, - ), - FormBuilderDropdown( - name: "land_actual_use", - autofocus: false, - decoration: normalTextFieldStyle("Actual Use", ""), - items: actual_use - .map((item) => DropdownMenuItem( - value: item, - child: Text(item), - )) - .toList(), - onChanged: (value) { - setState(() { - _actualUse = value!; - - switch (value) { - case "Residential": - setState(() { - _assessmentLevel = '20'; - }); - - break; - case "Agricultural": - setState(() { - _assessmentLevel = '40'; - }); - - break; - case "Commercial": - setState(() { - _assessmentLevel = '50'; - }); - - break; - case "Industrial": - setState(() { - _assessmentLevel = '50'; - }); - - break; - case "Mineral": - setState(() { - _assessmentLevel = '50'; - }); - - break; - case "Timberland": - setState(() { - _assessmentLevel = '20'; - }); - - break; - default: - } - }); - }, - ), - SizedBox( - height: 10, - ), - Text('Assessment Level'), - 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(_assessmentLevel + '%'), - ), - ), - SizedBox( - height: 10, - ), - Text('Assessment Value'), - 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(calculateAssessmentValue().toString() == - "0.00" - ? "00.0" - : calculateAssessmentValue())), - ), - ), - const SizedBox(height: 10), - Row( - children: [ - Container( - width: 120, - height: 60, - padding: const EdgeInsets.all(8.0), - child: ElevatedButton( - onPressed: () async { - var assessment = LandPropertyAssessment( - landapprDetailsId: 35, - actualUse: _actualUse, - marketval: _unitValue.toString(), - assessmentLevel: _assessmentLevel, - assessedValue: - calculateAssessmentValue() - .toString(), - totalMarketval: '0', - totalAssessedval: '0'); - print(assessment.toJson()); - context - .read() - .add(AddLandPropertyAssessment( - assessment: assessment)); - }, - style: ElevatedButton.styleFrom( - primary: Colors.black, - ), - child: const Text("Submit"), - ), - ), - const SizedBox( - width: - 5), // Use SizedBox for horizontal spacing in a Row - Container( - width: 120, - height: 60, - padding: const EdgeInsets.all(8.0), - child: ElevatedButton( - onPressed: () { - context - .read() - .add( - const LoadLandPropertyAssessment()); - }, - style: ElevatedButton.styleFrom( - primary: Colors.black, - ), - child: const Text("Cancel"), - ), - ), - ], - ) - ], - ), - ), - ), - )); - } - if (state is LandValueAdjustmentsErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context - .read() - .add(LoadLandValueAdjustments()); - }, - ); - } - return Container(); - }); - } - if (state is LandPropertyAssessmentErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context - .read() - .add(LoadLandPropertyAssessment()); - }, - ); - } - return Container(); - }); - } -} diff --git a/lib/screens/passo/Land/edit_land/land_appraisal.dart b/lib/screens/passo/Land/edit_land/land_appraisal.dart deleted file mode 100644 index 47bb838..0000000 --- a/lib/screens/passo/Land/edit_land/land_appraisal.dart +++ /dev/null @@ -1,292 +0,0 @@ -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:intl/intl.dart'; -import 'package:unit2/bloc/passo/land/land_appraisal/land_appraisal_bloc.dart'; -import 'package:unit2/model/passo/land_appr.dart'; -import 'package:unit2/screens/passo/Land/edit_land/AddLandAppraisalEdit.dart'; - -import 'package:unit2/utils/alerts.dart'; -import 'package:unit2/utils/text_container.dart'; -import 'package:unit2/widgets/error_state.dart'; -import 'package:unit2/widgets/passo/custom_button.dart'; - -class LandAppraisalEdit extends StatefulWidget { - Function PrevBtn; - Function NextBtn; - final int faasId; - LandAppraisalEdit(this.PrevBtn, this.NextBtn, this.faasId); - @override - _LandAppraisalEdit createState() => _LandAppraisalEdit(); -} - -class _LandAppraisalEdit extends State { - // double _totalMarketValue(items) { - // double total = 0; - // items.forEach((row) { - // total += double.parse(row); - // }); - // return total; - // } - - void deleteItem(int itemId) { - context.read().add(DeleteLandAppraisal(id: itemId)); - } - - @override - Widget build(BuildContext context) { - return ProgressHUD( - padding: const EdgeInsets.all(24), - backgroundColor: Colors.black87, - indicatorWidget: const SpinKitFadingCircle(color: Colors.white), - child: BlocConsumer( - listener: (context, state) { - if (state is LandAppraisalLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - if (state is LandAppraisalLoaded) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - if (state is LandAppraisalErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, builder: (context, state) { - final state = context.watch().state; - if (state is LandAppraisalLoaded) { - return Column( - children: [ - Expanded( - child: SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - children: [ - Container( - margin: const EdgeInsets.only( - left: 0, top: 20, right: 0, bottom: 10), - child: const Text('LAND APPRAISAL', - 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(ShowLandAppraisal()); - }, - 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('Classification'), - ), - const DataColumn( - label: Text('Sub-Classification'), - ), - const DataColumn( - label: Text('Area'), - ), - const DataColumn( - label: Text('Unit Value'), - ), - const DataColumn( - label: Text('Base MArket Value'), - ), - const DataColumn( - label: Text('Action'), - ) - ], - rows: state.land_appr.map((dataRow) { - return DataRow( - cells: [ - DataCell(Text(dataRow.classification!)), - DataCell(Text(dataRow.subClass!)), - DataCell(Text(dataRow.area!)), - DataCell(Text( - ((double.parse(dataRow.unitValue!))) - .toString())), - DataCell(Text( - ((double.parse(dataRow.baseMarketval!))) - .toString())), - DataCell(Row( - children: [ - InkWell( - child: Container( - height: 30, - width: 30, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.red, - ), - child: Icon( - Icons.delete, - color: Colors.white, - size: 20.0, - ), - ), - onTap: () { - deleteItem(dataRow.id!); - }, - ), - SizedBox( - width: 10, - ), - InkWell( - child: Container( - height: 30, - width: 30, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.red, - ), - child: Icon( - Icons.edit, - color: Colors.white, - size: 20.0, - ), - ), - onTap: () {}, - ), - ], - )) - ], - ); - }).toList())) - ], - ), - ), - )), - // Padding( - // padding: const EdgeInsets.only(left: 20.0, right: 20.0), - // child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // Text( - // 'Total', - // style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), - // ), - // Text( - // NumberFormat.currency(locale: 'en-PH', symbol: "₱") - // .format('1.0'), - // style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), - // ) - // ], - // ), - // ), - Padding( - padding: const EdgeInsets.all(15.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - CustomButton( - icon: const Icon(Icons.chevron_left_rounded, - color: Colors.white), - onPressed: () { - { - widget.PrevBtn(); - } - ; - }, - ), - CustomButton( - icon: const Icon(Icons.chevron_right_rounded, - color: Colors.white), - onPressed: () { - { - widget.NextBtn(); - } - ; - }, - ) - ], - ), - ), - ], - ); - } - if (state is LandAppraisalDeletedState) { - if (state.success) { - WidgetsBinding.instance.addPostFrameCallback((_) { - successAlert(context, "Deletion Successful", - "Extra item has been deleted successfully", () { - Navigator.of(context).pop(); - context.read().add(LoadLandAppraisalEdit( - land_appr: const [], id: widget.faasId!)); - }); - }); - } - } - if (state is ShowAddLandAppraisalScreen) { - return ConstrainedBox( - constraints: const BoxConstraints( - maxHeight: 700.0, - ), - child: AlertDialog( - insetPadding: const EdgeInsets.symmetric( - horizontal: 20.0, - vertical: 10.0, - ), - title: const Text( - 'ADD LAND APPRAISAL', - textAlign: TextAlign.center, - ), - content: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Align( - alignment: Alignment.topCenter, - child: Container( - child: ConstrainedBox( - constraints: const BoxConstraints(maxHeight: 500), - child: AddLandAppraisalEditModal(widget.faasId), - ), - ), - ), - ], - ), - ), - ); - } - if (state is LandAppraisalErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context.read().add(LoadLandAppraisalEdit( - land_appr: const [], id: widget.faasId!)); - }, - ); - } - return Container(); - }), - ); - } -} diff --git a/lib/screens/passo/Land/edit_land/location_and_boundaries_edit.dart b/lib/screens/passo/Land/edit_land/location_and_boundaries_edit.dart deleted file mode 100644 index 658720b..0000000 --- a/lib/screens/passo/Land/edit_land/location_and_boundaries_edit.dart +++ /dev/null @@ -1,270 +0,0 @@ -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/land/land_boundaries_edit/land_boundaries_edit_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_location_edit/land_location_edit_bloc.dart'; -import 'package:unit2/model/passo/land_property_boundaries.dart'; -import 'package:unit2/model/passo/land_property_loc.dart'; -import 'package:unit2/model/passo/land_property_owner.dart'; -import 'package:unit2/screens/passo/Land/edit_land/property_owner_info_edit.dart'; -import 'package:unit2/utils/text_container.dart'; -import 'package:unit2/widgets/error_state.dart'; -import 'package:unit2/widgets/passo/custom_button.dart'; -import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart'; - -class LandLocationAndBoundariesEdit extends StatefulWidget { - Function PrevBtn; - Function NextBtn; - LandPropertyOwner land; - LandLocationAndBoundariesEdit(this.PrevBtn, this.NextBtn, this.land); - @override - _LandLocationAndBoundariesEdit createState() => - _LandLocationAndBoundariesEdit(); -} - -class _LandLocationAndBoundariesEdit - extends State { - @override - Widget build(BuildContext context) { - return Scaffold( - body: ProgressHUD( - padding: const EdgeInsets.all(24), - backgroundColor: Colors.black87, - indicatorWidget: const SpinKitFadingCircle(color: Colors.white), - child: BlocConsumer( - listener: (context, state) { - if (state is LandLocationEditLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - - if (state is LandLocationEditErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, - builder: (context, state) { - if (state is LandLocationEditLoaded) { - final landLoc = state.land_loc_edit; - return BlocConsumer( - listener: (context, state) { - if (state is LandBoundariesEditLoaded) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - if (state is LandBoundariesEditErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, - builder: (context, state) { - if (state is LandBoundariesEditLoaded) { - return FormBuilder( - key: landEditKey, - initialValue: { - 'street': landLoc.street, - 'brgy': landLoc.barangay, - 'municipality': landLoc.municipality, - 'province': landLoc.province, - 'north': state.land_boundaries_edit.north, - 'south': state.land_boundaries_edit.south, - 'east': state.land_boundaries_edit.east, - 'west': state.land_boundaries_edit.west - }, - enabled: true, - onChanged: () { - landEditKey.currentState!.save(); - debugPrint(landEditKey.currentState!.value.toString()); - }, - autovalidateMode: AutovalidateMode.disabled, - skipDisabled: true, - child: SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - margin: const EdgeInsets.only( - left: 0, top: 20, right: 0, bottom: 10), - child: const Text('PROPERTY LOCATION', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18), - textAlign: TextAlign.left), - ), - const SizedBox(height: 15), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - children: [ - Expanded( - // optional flex property if flex is 1 because the default flex is 1 - 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('PROPERTY BOUNDARIES', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18), - textAlign: TextAlign.left), - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - children: [ - Expanded( - flex: 1, - child: customTextField( - "North", "", "north"), - ), - const SizedBox(width: 10.0), - Expanded( - // optional flex property if flex is 1 because the default flex is 1 - flex: 1, - child: customTextField( - "East", "", "east")) - ]), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - children: [ - Expanded( - flex: 1, - child: customTextField( - "South", "", "south"), - ), - const SizedBox(width: 10.0), - Expanded( - // optional flex property if flex is 1 because the default flex is 1 - flex: 1, - child: customTextField( - "West", "", "west")) - ]), - const SizedBox( - height: 50, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - children: [ - CustomButton( - icon: const Icon(Icons.chevron_left, - color: Colors.white), - onPressed: () { - widget.PrevBtn(); - }), - CustomButton( - icon: const Icon(Icons.chevron_right, - color: Colors.white), - onPressed: () { - print(widget.land.id); - var boundaries = - LandPropertyBoundaries( - id: widget.land.id, - north: landEditKey - .currentState?.value['north'], - east: landEditKey - .currentState?.value['east'], - west: landEditKey - .currentState?.value['west'], - south: landEditKey - .currentState?.value['south'], - ); - var location = LandPropertyLoc( - id: widget.land.id, - street: landEditKey - .currentState?.value['street'], - barangay: landEditKey - .currentState?.value['brgy'], - municipality: landEditKey - .currentState - ?.value['municipality'], - province: landEditKey.currentState - ?.value['province'], - ); - - context - .read() - .add(UpdateLandLocationEdit( - land_loc_edit: location, - id: widget.land.id!)); - - context - .read() - .add(UpdateLandBoundariesEdit( - land_boundaries_edit: - boundaries, - id: widget.land.id!)); - - widget.NextBtn(); - }) - ], - ) - ]), - ), - ), - ); - } - if (state is LandBoundariesEditErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context.read().add( - LoadLandBoundariesEdit( - land_boundaries_edit: LandPropertyBoundaries(), - id: widget.land.id!)); - }, - ); - } - return Container(); - }, - ); - } - ; - if (state is LandLocationEditErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context.read().add(LoadLandLocationEdit( - land_loc_edit: LandPropertyLoc(), id: widget.land.id!)); - }, - ); - } - return Container(); - }, - ), - ), - ); - } -} diff --git a/lib/screens/passo/Land/edit_land/other_improvements_edit.dart b/lib/screens/passo/Land/edit_land/other_improvements_edit.dart deleted file mode 100644 index 4d814e0..0000000 --- a/lib/screens/passo/Land/edit_land/other_improvements_edit.dart +++ /dev/null @@ -1,313 +0,0 @@ -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/land/other_improvements/other_improvements_bloc.dart'; -import 'package:unit2/model/passo/other_improvements.dart'; -import 'package:unit2/screens/passo/Land/add_land/AddOtherImprovementModal.dart'; -import 'package:unit2/screens/passo/Land/edit_land/AddOtherImprovementEditModal.dart'; -import 'package:unit2/utils/alerts.dart'; -import 'package:unit2/utils/text_container.dart'; -import 'package:unit2/widgets/error_state.dart'; -import 'package:unit2/widgets/passo/custom_button.dart'; - -class OtherImprovementEditPage extends StatefulWidget { - Function PrevBtn; - Function NextBtn; - final int faasId; - OtherImprovementEditPage(this.PrevBtn, this.NextBtn, this.faasId); - @override - _OtherImprovementEditPage createState() => _OtherImprovementEditPage(); -} - -class _OtherImprovementEditPage extends State { - // double _totalMarketValue(items) { - // double total = 0; - // items.forEach((row) { - // total += double.parse(row); - // }); - // return total; - // } - - void deleteItem(int itemId) { - context - .read() - .add(DeleteOtherImprovement(id: itemId)); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - body: ProgressHUD( - padding: const EdgeInsets.all(24), - backgroundColor: Colors.black87, - indicatorWidget: const SpinKitFadingCircle(color: Colors.white), - child: BlocConsumer( - listener: (context, state) { - if (state is OtherImprovementLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - if (state is OtherImprovementLoaded) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - if (state is OtherImprovementErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, builder: (context, state) { - final state = context.watch().state; - if (state is OtherImprovementLoaded) { - return Column( - children: [ - Expanded( - child: SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - children: [ - Container( - margin: const EdgeInsets.only( - left: 0, top: 20, right: 0, bottom: 10), - child: const Text('OTHER IMPROVEMENTS', - 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(ShowOtherImprovement()); - }, - 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('Kinds of Tress'), - ), - const DataColumn( - label: Text('Sub-Class / Age'), - ), - const DataColumn( - label: Text('Type of Tree'), - ), - const DataColumn( - label: Text('No.'), - ), - const DataColumn( - label: Text('No. of Productive'), - ), - const DataColumn( - label: Text('No. of Non-Productive'), - ), - const DataColumn( - label: Text('Unit Value'), - ), - const DataColumn( - label: Text('Base Market Value'), - ), - const DataColumn( - label: Text('Action'), - ) - ], - rows: state.other_imp.map((dataRow) { - return DataRow( - cells: [ - DataCell(Text(dataRow.kindsOfTrees!)), - DataCell(Text(dataRow.subclassAge!)), - DataCell(Text(dataRow.fruitBearing == '1' - ? "Fruit Bearing" - : "Non-Fruit Bearing")), - DataCell( - Text(dataRow.quantity.toString()!)), - DataCell(Text( - dataRow.noOfProductive.toString()!)), - DataCell(Text(dataRow.noOfNonproductive - .toString()!)), - DataCell( - Text(dataRow.unitValue.toString()!)), - DataCell(Text( - dataRow.baseMarketval.toString()!)), - DataCell(Row( - children: [ - InkWell( - child: Container( - height: 30, - width: 30, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.red, - ), - child: Icon( - Icons.delete, - color: Colors.white, - size: 20.0, - ), - ), - onTap: () { - deleteItem(dataRow.id!); - }, - ), - SizedBox( - width: 10, - ), - InkWell( - child: Container( - height: 30, - width: 30, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.red, - ), - child: Icon( - Icons.edit, - color: Colors.white, - size: 20.0, - ), - ), - onTap: () {}, - ), - ], - )) - ], - ); - }).toList())) - ], - ), - ), - )), - // Padding( - // padding: const EdgeInsets.only(left: 20.0, right: 20.0), - // child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // Text( - // 'Total', - // style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), - // ), - // Text( - // NumberFormat.currency(locale: 'en-PH', symbol: "₱") - // .format('1.0'), - // style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), - // ) - // ], - // ), - // ), - Padding( - padding: const EdgeInsets.all(15.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - CustomButton( - icon: const Icon(Icons.chevron_left_rounded, - color: Colors.white), - onPressed: () { - { - widget.PrevBtn(); - } - ; - }, - ), - CustomButton( - icon: const Icon(Icons.chevron_right_rounded, - color: Colors.white), - onPressed: () { - { - widget.NextBtn(); - } - ; - }, - ) - ], - ), - ), - ], - ); - } - if (state is OtherImprovementDeletedState) { - if (state.success) { - WidgetsBinding.instance.addPostFrameCallback((_) { - successAlert(context, "Deletion Successful", - "Extra item has been deleted successfully", () { - Navigator.of(context).pop(); - context - .read() - .add(const LoadOtherImprovement()); - }); - }); - } - } - if (state is ShowAddOtherImprovementScreen) { - return ConstrainedBox( - constraints: BoxConstraints(maxHeight: 1000.0), - child: AlertDialog( - insetPadding: EdgeInsets.symmetric( - horizontal: 20.0, - vertical: 10.0, - ), - title: Text( - 'ADD OTHER IMPROVEMENTS', - textAlign: TextAlign.center, - ), - content: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Align( - alignment: Alignment.topCenter, - child: Container( - child: ConstrainedBox( - constraints: BoxConstraints(maxHeight: 500), - child: Container( - child: AddOtherImprovementEditModal(widget.faasId), - ), - ), - ), - ), - ], - ), - ), - ); - } - if (state is OtherImprovementErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context.read().add( - LoadOtherImprovementEdit( - other_imps: const [], - ids: widget.faasId)); - }, - ); - } - return Container(); - }), - ), - ); - } -} diff --git a/lib/screens/passo/Land/edit_land/property_assessment_cont_edit.dart b/lib/screens/passo/Land/edit_land/property_assessment_cont_edit.dart deleted file mode 100644 index 3885c4d..0000000 --- a/lib/screens/passo/Land/edit_land/property_assessment_cont_edit.dart +++ /dev/null @@ -1,672 +0,0 @@ -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:form_builder_validators/form_builder_validators.dart'; -import 'package:searchfield/searchfield.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -import 'package:unit2/bloc/passo/land/land_ext_bloc/land_ext_edit_bloc.dart'; -import 'package:unit2/bloc/passo/memoranda/memoranda_bloc.dart'; -import 'package:unit2/bloc/passo/signatories/signatories_bloc.dart'; -import 'package:unit2/model/passo/land_ext.dart'; -import 'package:unit2/model/passo/memoranda.dart'; -import 'package:unit2/model/passo/signatories.dart'; -import 'package:unit2/screens/passo/Land/edit_land/property_owner_info_edit.dart'; -import 'package:unit2/theme-data.dart/colors.dart'; -import 'package:unit2/utils/text_container.dart'; -import 'package:unit2/widgets/error_state.dart'; - -class LandSignatoriesEdit extends StatefulWidget { - Function onSAve; - final int faasId; - LandSignatoriesEdit(this.onSAve, this.faasId); - - @override - _LandSignatoriesEdit createState() => _LandSignatoriesEdit(); -} - -class _LandSignatoriesEdit extends State { - bool isTaxable = false; - bool isExempt = false; - final focus = FocusNode(); - String _memoranda = ""; - @override - Widget build(BuildContext context) { - return Scaffold( - body: ProgressHUD( - padding: const EdgeInsets.all(24), - backgroundColor: Colors.black87, - indicatorWidget: const SpinKitFadingCircle(color: Colors.white), - child: BlocConsumer( - listener: (context, state) { - if (state is LandExtEditLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - - if (state is LandExtEditErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, - builder: (context, state) { - if (state is LandExtEditLoaded) { - final landext = state.land_ext_edit; - return BlocConsumer( - listener: (context, state) { - if (state is SignatoriesErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, - builder: (context, state) { - if (state is SignatoriesLoaded) { - final signatories = state.signatories; - return BlocConsumer( - listener: (context, state) { - if (state is MemorandaLoaded) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - if (state is MemorandaErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, - builder: (context, state) { - if (state is MemorandaLoaded) { - return FormBuilder( - key: landEditKey, - initialValue: { - 'land_qtr': landext.qtr.toString(), - 'land_yr': landext.yr.toString(), - 'app_date_land': landext.appraisedbyDate, - 'rec_date_land': landext.recommendapprDate, - 'apprvd_by_date_land': landext.approvedbyDate, - 'sworn_statement_land': landext.swornstatementNo, - 'date_received_land': landext.dateReceived, - 'date_of_entry_land': landext.entryDateAssessment, - 'by_land': landext.entryDateBy - }, - enabled: true, - onChanged: () { - landEditKey.currentState!.save(); - debugPrint( - landEditKey.currentState!.value.toString()); - }, - autovalidateMode: AutovalidateMode.disabled, - skipDisabled: true, - child: SingleChildScrollView( - child: Column( - children: [ - Container( - margin: const EdgeInsets.only( - left: 0, top: 20, right: 0, bottom: 10), - child: const Text( - 'PROPERTY ASSESSMENT cont..', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18), - textAlign: TextAlign.left), - ), - 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: 'land_qtr', - validator: - FormBuilderValidators.compose( - []), - ), - ), - const SizedBox( - width: 20, - ), - const Text('Yr.'), - SizedBox( - width: 70, - height: 25, - child: FormBuilderTextField( - name: 'land_yr', - validator: - FormBuilderValidators.compose( - []), - ), - ), - ], - ), - ], - ), - Container( - margin: const EdgeInsets.only( - left: 0, top: 40, right: 0, bottom: 10), - child: const Text('SIGNATORIES', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18), - textAlign: TextAlign.left), - ), - const SizedBox( - height: 30, - ), - const Align( - alignment: Alignment.centerLeft, - child: Text( - 'APPRAISED/ASSESSED BY:', - style: - TextStyle(fontWeight: FontWeight.bold), - textAlign: TextAlign.start, - ), - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - children: [ - Column( - children: [ - SizedBox( - width: 200, - child: - FormBuilderDropdown( - name: 'appraised_by_land', - decoration: InputDecoration( - labelText: landext - .appraisedbyName!, - labelStyle: const TextStyle( - color: Colors.black), - ), - autofocus: false, - items: signatories - .map((signatories) => - DropdownMenuItem( - value: signatories, - child: Text( - '${signatories.firstname} ${signatories.middlename} ${signatories.lastname}'), - )) - .toList()), - ), - const Text('Name'), - ], - ), - const SizedBox( - width: 15, - ), - Column( - children: [ - SizedBox( - width: 100, - child: FormBuilderDateTimePicker( - name: 'app_date_land', - initialEntryMode: - DatePickerEntryMode - .calendarOnly, - initialValue: DateTime.now(), - inputType: InputType.date, - - initialTime: const TimeOfDay( - hour: 8, minute: 0), - // locale: const Locale.fromSubtags(languageCode: 'fr'), - ), - ), - const Text('Date'), - ], - ), - ], - ), - const SizedBox( - height: 30, - ), - const Align( - alignment: Alignment.centerLeft, - child: Text( - 'RECOMMENDING APPROVAL:', - style: TextStyle( - fontWeight: FontWeight.bold), - )), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - children: [ - Column( - children: [ - SizedBox( - width: 200, - child: - FormBuilderDropdown( - name: 'rec_approval_land', - decoration: InputDecoration( - labelText: landext - .recommendapprName!, - labelStyle: const TextStyle( - color: Colors.black), - ), - autofocus: false, - items: signatories - .map((signatories) => - DropdownMenuItem( - value: signatories, - child: Text( - '${signatories.firstname} ${signatories.middlename} ${signatories.lastname}'), - )) - .toList()), - ), - const Text('Name'), - ], - ), - const SizedBox( - width: 15, - ), - Column( - children: [ - SizedBox( - width: 100, - child: FormBuilderDateTimePicker( - name: 'rec_date_land', - initialEntryMode: - DatePickerEntryMode - .calendarOnly, - initialValue: DateTime.now(), - inputType: InputType.date, - - initialTime: const TimeOfDay( - hour: 8, minute: 0), - // locale: const Locale.fromSubtags(languageCode: 'fr'), - ), - ), - const Text('Date'), - ], - ), - ], - ), - const SizedBox( - height: 30, - ), - const Align( - alignment: Alignment.centerLeft, - child: Text( - 'APPROVED BY:', - style: TextStyle( - fontWeight: FontWeight.bold, - ), - )), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Column( - children: [ - SizedBox( - width: 200, - child: - FormBuilderDropdown( - name: 'apprvd_by_land', - decoration: InputDecoration( - labelText: - landext.approvedbyName!, - labelStyle: const TextStyle( - color: Colors.black), - ), - autofocus: false, - items: signatories - .map((signatories) => - DropdownMenuItem( - value: signatories, - child: Text( - '${signatories.firstname} ${signatories.middlename} ${signatories.lastname}'), - )) - .toList()), - ), - const Text('Name'), - ], - ), - const SizedBox( - width: 15, - ), - Column( - children: [ - SizedBox( - width: 100, - child: FormBuilderDateTimePicker( - name: 'apprvd_by_date_land', - initialEntryMode: - DatePickerEntryMode - .calendarOnly, - initialValue: DateTime.now(), - inputType: InputType.date, - - initialTime: const TimeOfDay( - hour: 8, minute: 0), - // locale: const Locale.fromSubtags(languageCode: 'fr'), - ), - ), - Text('Date'), - ], - ), - ], - ), - const SizedBox( - height: 50, - ), - const Align( - alignment: Alignment.centerLeft, - child: Text( - 'MEMORANDA: ', - style: TextStyle( - fontWeight: FontWeight.bold, - ), - )), - const SizedBox( - height: 50, - ), - SizedBox( - width: 500, - height: 100, - child: SearchField( - suggestions: state.memorada - .map((Memoranda memoranda) => - SearchFieldListItem( - '${memoranda.memoranda}', - item: - memoranda, // Change: Use individual Memoranda object - child: ListTile( - title: Text( - '${memoranda.memoranda}', - overflow: - TextOverflow.ellipsis, - ), - ), - )) - .toList(), - validator: FormBuilderValidators.required( - errorText: "This field is required"), - // searchInputDecoration: - // normalTextFieldStyle( - // "Memoranda", "") - // .copyWith( - // suffixIcon: const Icon( - // Icons.arrow_drop_down), - // ), - // focusNode: focus, - suggestionState: Suggestion.expand, - onSuggestionTap: (memoranda) { - setState(() { - _memoranda = - memoranda.item!.memoranda!; - }); - focus.unfocus(); - }, - )), - const SizedBox( - height: 30, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text('Sworn Statement No. :'), - SizedBox( - width: 150, - height: 20, - child: FormBuilderTextField( - name: 'sworn_statement_land', - decoration: InputDecoration(), - validator: - FormBuilderValidators.compose([]), - ), - ), - ], - ), - const SizedBox( - height: 30, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text('Date Received:'), - SizedBox( - width: 150, - height: 20, - child: FormBuilderDateTimePicker( - name: 'date_received_land', - initialEntryMode: - DatePickerEntryMode.calendarOnly, - initialValue: DateTime.now(), - inputType: InputType.date, - - initialTime: - const TimeOfDay(hour: 8, minute: 0), - // locale: const Locale.fromSubtags(languageCode: 'fr'), - ), - ), - ], - ), - const SizedBox( - height: 30, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - const Text( - 'Date of Entry in the Rec. of Ass. :'), - SizedBox( - width: 100, - height: 20, - child: FormBuilderDateTimePicker( - name: 'date_of_entry_land', - initialEntryMode: - DatePickerEntryMode.calendarOnly, - initialValue: DateTime.now(), - inputType: InputType.date, - - initialTime: - const TimeOfDay(hour: 8, minute: 0), - // locale: const Locale.fromSubtags(languageCode: 'fr'), - ), - ), - ], - ), - const SizedBox( - height: 30, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - const Text('By:'), - SizedBox( - width: 150, - height: 20, - child: FormBuilderTextField( - name: 'by_land', - decoration: const InputDecoration(), - validator: - FormBuilderValidators.compose([]), - ), - ), - ], - ), - const SizedBox( - height: 30, - ), - ElevatedButton( - onPressed: () async { - final tempID = - await SharedPreferences.getInstance(); - var ext = LandExt( - landapprDetailsId: - tempID.getInt('landid')! - 1, - taxable: isTaxable == true ? '1' : '0', - exempt: isExempt == true ? '1' : '0', - qtr: landEditKey - .currentState!.value['land_qtr'], - yr: landEditKey - .currentState!.value['land_yr'], - appraisedbyName: landEditKey - .currentState! - .value['appraised_by_land'] - .firstname + - ' ' + - landEditKey - .currentState! - .value['appraised_by_land'] - .middlename + - ' ' + - landEditKey - .currentState! - .value['appraised_by_land'] - .lastname, - appraisedbyDate: landEditKey - .currentState! - .value['app_date_land'], - recommendapprName: landEditKey - .currentState! - .value['rec_approval_land'] - .firstname + - ' ' + - landEditKey - .currentState! - .value['rec_approval_land'] - .middlename + - ' ' + - landEditKey - .currentState! - .value['rec_approval_land'] - .lastname, - recommendapprDate: landEditKey.currentState!.value['rec_date_land'], - approvedbyName: landEditKey.currentState!.value['apprvd_by_land'].firstname + ' ' + landEditKey.currentState!.value['apprvd_by_land'].middlename + ' ' + landEditKey.currentState!.value['apprvd_by_land'].lastname, - approvedbyDate: landEditKey.currentState!.value['apprvd_by_date_land'], - memoranda: _memoranda, - swornstatementNo: landEditKey.currentState!.value['sworn_statement_land'], - dateReceived: landEditKey.currentState!.value['date_received_land'], - entryDateAssessment: landEditKey.currentState!.value['date_of_entry_land'], - entryDateBy: landEditKey.currentState!.value['by_land']); - - context.read().add( - UpdateLandExtEdit( - land_ext_edit: ext, - id: widget.faasId)); - widget.onSAve(); - }, - style: ElevatedButton.styleFrom( - backgroundColor: primary, - foregroundColor: Colors.red), - child: const SizedBox( - width: 250, - height: 50, - child: Align( - alignment: Alignment.center, - child: Text( - 'Save', - style: TextStyle( - color: Colors.white, - ), - textAlign: TextAlign.center, - ), - ), - ), - ), - const SizedBox( - height: 30, - ), - ], - )), - ); - } - if (state is MemorandaErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context - .read() - .add(const LoadMemoranda()); - }, - ); - } - return Container(); - }, - ); - } - if (state is SignatoriesErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context - .read() - .add(const LoadSignatories()); - }, - ); - } - return Container(); - }, - ); - } - if (state is LandExtEditErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context.read().add(LoadLandExtEdit( - land_ext_edit: LandExt(), id: widget.faasId)); - }, - ); - } - return Container(); - }, - ), - ), - ); - } -} diff --git a/lib/screens/passo/Land/edit_land/property_assessment_edit.dart b/lib/screens/passo/Land/edit_land/property_assessment_edit.dart deleted file mode 100644 index 097dabe..0000000 --- a/lib/screens/passo/Land/edit_land/property_assessment_edit.dart +++ /dev/null @@ -1,287 +0,0 @@ -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/bulding/property_assessment_edit/property_assessment_edit_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_property_assessment/land_property_assessment_bloc.dart'; -import 'package:unit2/model/passo/land_property_assessment.dart'; -import 'package:unit2/screens/passo/Land/add_land/AddPropertyAssessmentModal.dart'; -import 'package:unit2/screens/passo/Land/edit_land/AddPropertyAssessmentEditModal.dart'; -import 'package:unit2/utils/alerts.dart'; -import 'package:unit2/utils/text_container.dart'; -import 'package:unit2/widgets/error_state.dart'; -import 'package:unit2/widgets/passo/custom_button.dart'; - -class LandPropertyAssessmentEditPage extends StatefulWidget { - Function PrevBtn; - Function NextBtn; - final int faasId; - LandPropertyAssessmentEditPage(this.PrevBtn, this.NextBtn, this.faasId); - @override - _LandPropertyAssessmentEditPage createState() => - _LandPropertyAssessmentEditPage(); -} - -class _LandPropertyAssessmentEditPage - extends State { - // double _totalMarketValue(items) { - // double total = 0; - // items.forEach((row) { - // total += double.parse(row); - // }); - // return total; - // } - - void deleteItem(int itemId) { - context - .read() - .add(DeleteLandPropertyAssessment(id: itemId)); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - body: ProgressHUD( - padding: const EdgeInsets.all(24), - backgroundColor: Colors.black87, - indicatorWidget: const SpinKitFadingCircle(color: Colors.white), - child: BlocConsumer(listener: (context, state) { - if (state is LandPropertyAssessmentLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - if (state is LandPropertyAssessmentLoaded) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - if (state is LandPropertyAssessmentErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, builder: (context, state) { - final state = context.watch().state; - if (state is LandPropertyAssessmentLoaded) { - return Column( - children: [ - Expanded( - child: SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - children: [ - Container( - margin: const EdgeInsets.only( - left: 0, top: 20, right: 0, bottom: 10), - child: const Text('PROPERTY ASSESSMENT', - 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(ShowLandPropertyAssessment()); - }, - 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('Actual Use'), - ), - const DataColumn( - label: Text('Market Value'), - ), - const DataColumn( - label: Text('Assessment Level'), - ), - const DataColumn( - label: Text('Assessed Value'), - ), - const DataColumn( - label: Text('Action'), - ) - ], - rows: state.assessment.map((dataRow) { - return DataRow( - cells: [ - DataCell(Text(dataRow.actualUse!)), - DataCell(Text(dataRow.marketval!)), - DataCell( - Text(dataRow.assessmentLevel! + '%')), - DataCell(Text(dataRow.assessedValue!)), - DataCell(Row( - children: [ - InkWell( - child: Container( - height: 30, - width: 30, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.red, - ), - child: Icon( - Icons.delete, - color: Colors.white, - size: 20.0, - ), - ), - onTap: () { - deleteItem(dataRow.id!); - }, - ), - SizedBox( - width: 10, - ), - InkWell( - child: Container( - height: 30, - width: 30, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.red, - ), - child: Icon( - Icons.edit, - color: Colors.white, - size: 20.0, - ), - ), - onTap: () {}, - ), - ], - )) - ], - ); - }).toList())) - ], - ), - ), - )), - // Padding( - // padding: const EdgeInsets.only(left: 20.0, right: 20.0), - // child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // Text( - // 'Total', - // style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), - // ), - // Text( - // NumberFormat.currency(locale: 'en-PH', symbol: "₱") - // .format('1.0'), - // style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), - // ) - // ], - // ), - // ), - Padding( - padding: const EdgeInsets.all(15.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - CustomButton( - icon: const Icon(Icons.chevron_left_rounded, - color: Colors.white), - onPressed: () { - { - widget.PrevBtn(); - } - ; - }, - ), - CustomButton( - icon: const Icon(Icons.chevron_right_rounded, - color: Colors.white), - onPressed: () { - { - widget.NextBtn(); - } - ; - }, - ) - ], - ), - ), - ], - ); - } - if (state is LandPropertyAssessmentDeletedState) { - if (state.success) { - WidgetsBinding.instance.addPostFrameCallback((_) { - successAlert(context, "Deletion Successful", - "Extra item has been deleted successfully", () { - Navigator.of(context).pop(); - context.read().add( - LoadLandPropertyAssessmentEdit( - assessment: [], - id: widget.faasId)); - }); - }); - } - } - if (state is ShowAddLandPropertyAssessmentScreen) { - return ConstrainedBox( - constraints: BoxConstraints(maxHeight: 1000.0), - child: AlertDialog( - insetPadding: EdgeInsets.symmetric( - horizontal: 20.0, - vertical: 10.0, - ), - title: Text( - 'ADD PROPERTY ASSESSMENT', - textAlign: TextAlign.center, - ), - content: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - child: AddPropertyAssessmentEditModal(widget.faasId)) - ], - ), - ), - ); - } - if (state is LandPropertyAssessmentErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context.read().add( - LoadLandPropertyAssessmentEdit( - assessment: const [], - id: widget.faasId)); - }, - ); - } - - return Container(); - }), - ), - ); - } -} diff --git a/lib/screens/passo/Land/edit_land/property_owner_info_edit.dart b/lib/screens/passo/Land/edit_land/property_owner_info_edit.dart deleted file mode 100644 index 73fddbf..0000000 --- a/lib/screens/passo/Land/edit_land/property_owner_info_edit.dart +++ /dev/null @@ -1,223 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_form_builder/flutter_form_builder.dart'; -import 'package:unit2/bloc/passo/land/land_property_owner_info/land_property_owner_info_bloc.dart'; -import 'package:unit2/model/passo/land_property_owner.dart'; -import 'package:unit2/screens/passo/Land/add_land.dart'; -import 'package:unit2/widgets/passo/custom_button.dart'; -import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart'; - -GlobalKey landEditKey = GlobalKey(); - -class LandPropertyOwnerInfoEdit extends StatefulWidget { - Function NextBtn; - LandPropertyOwner land; - LandPropertyOwnerInfoEdit(this.NextBtn, this.land); - @override - _LandPropertyOwnerInfoEdit createState() => _LandPropertyOwnerInfoEdit(); -} - -class _LandPropertyOwnerInfoEdit extends State { - final transaction_codes = ['New', 'Revision']; - @override - Widget build(BuildContext context) { - return BlocConsumer( - listener: (context, state) { - // TODO: implement listener - }, - builder: (context, state) { - return FormBuilder( - key: landEditKey, - initialValue: { - 'transaction_code': widget.land.transCode ?? '', - 'td_no': widget.land.tdn ?? '', - 'owner': widget.land.owner ?? '', - 'pin': widget.land.pin ?? '', - 'tin': widget.land.tin ?? '', - 'cloa_no': widget.land.cloaNo ?? '', - 'dated': widget.land.dated ?? '', - 'survey_no': widget.land.surveyNo ?? '', - 'lot_no': widget.land.lotNo ?? '', - 'blk': widget.land.blkNo ?? '', - 'address': widget.land.address ?? '', - 'tel_no': widget.land.telno ?? '', - 'admin': widget.land.adminUser ?? '', - 'admin_tin': widget.land.adminTin ?? '', - 'admin_address': widget.land.adminAddress ?? '', - 'admin_telno': widget.land.adminTelno ?? '', - }, - enabled: true, - onChanged: () { - landEditKey.currentState!.save(); - debugPrint(landEditKey.currentState!.value.toString()); - }, - autovalidateMode: AutovalidateMode.disabled, - skipDisabled: true, - child: SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.all(15.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), - customTextField("ARP No./ TD No.", "", "td_no"), - customTextField("Owner", "", "owner"), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Expanded( - flex: 1, child: customTextField("PIN", "", "pin")), - 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( - "OCT/TCT CLOA No.", "", "cloa_no"), - ), - const SizedBox(width: 10.0), - Expanded( - // optional flex property if flex is 1 because the default flex is 1 - flex: 1, - child: customDatTimePicker("Dated", "", "dated")) - ]), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Expanded( - flex: 1, - child: customTextField("Survey No.", "", "survey_no"), - ), - const SizedBox(width: 10.0), - Expanded( - // optional flex property if flex is 1 because the default flex is 1 - 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", "", "blk")), - ]), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Expanded( - flex: 1, - child: customTextField("Address", "", "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.", "", "tel_no")) - ]), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Expanded( - flex: 1, - child: customTextField( - "Administrator/Beneficial User", "", "admin"), - ), - const SizedBox(width: 10.0), - Expanded( - // optional flex property if flex is 1 because the default flex is 1 - flex: 1, - child: customTextField("TIN", "", "admin_tin")) - ]), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Expanded( - flex: 1, - child: - customTextField("Address", "", "admin_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.", "", "admin_telno")) - ]), - SizedBox( - height: 30, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - CustomButton( - icon: const Icon(Icons.chevron_right, - color: Colors.white), - onPressed: () { - var land = LandPropertyOwner( - id: widget.land.id, - transCode: landEditKey - .currentState!.value['transaction_code'] - .toString(), - tdn: landEditKey.currentState!.value['td_no'], - cloaNo: - landEditKey.currentState!.value['cloa_no'], - dated: landEditKey.currentState!.value['dated'], - assessedById: "1", - assessedByName: "cyril", - dateCreated: - landEditKey.currentState!.value['dated'], - dateModified: - landEditKey.currentState!.value['dated'], - pin: landEditKey.currentState!.value['pin'], - surveyNo: - landEditKey.currentState!.value['survey_no'], - lotNo: landEditKey.currentState!.value['lot_no'], - blkNo: landEditKey.currentState!.value['blk'], - owner: landEditKey.currentState!.value['owner'], - address: - landEditKey.currentState!.value['address'], - telno: landEditKey.currentState!.value['tel_no'], - tin: landEditKey.currentState!.value['tin'], - adminUser: - landEditKey.currentState!.value['admin'], - adminAddress: landEditKey - .currentState!.value['admin_address'], - adminTin: - landEditKey.currentState!.value['admin_tin'], - // faasType: "LAND", - adminTelno: landEditKey - .currentState!.value['admin_telno']); - - context.read().add( - UpdateLandPropertyOwner( - land_edit: land, id: widget.land.id!)); - - widget.NextBtn(); - }, - ) - ], - ), - const SizedBox( - height: 20, - ), - ]), - )), - ); - }, - ); - } -} diff --git a/lib/screens/passo/Land/edit_land/value_adjustments_edit.dart b/lib/screens/passo/Land/edit_land/value_adjustments_edit.dart deleted file mode 100644 index d969ca8..0000000 --- a/lib/screens/passo/Land/edit_land/value_adjustments_edit.dart +++ /dev/null @@ -1,283 +0,0 @@ -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/land/land_value_adjustments/land_value_adjustments_bloc.dart'; -import 'package:unit2/model/passo/land_value_adjustment.dart'; -import 'package:unit2/screens/passo/Land/add_land/AddLandValueAdjustmentModal.dart'; -import 'package:unit2/utils/alerts.dart'; -import 'package:unit2/utils/text_container.dart'; -import 'package:unit2/widgets/error_state.dart'; -import 'package:unit2/widgets/passo/custom_button.dart'; - -class ValueAdjustmentEditPage extends StatefulWidget { - Function PrevBtn; - Function NextBtn; - final int faasId; - ValueAdjustmentEditPage(this.PrevBtn, this.NextBtn, this.faasId); - @override - _ValueAdjustmentEditPage createState() => _ValueAdjustmentEditPage(); -} - -class _ValueAdjustmentEditPage extends State { - // double _totalMarketValue(items) { - // double total = 0; - // items.forEach((row) { - // total += double.parse(row); - // }); - // return total; - // } - - void deleteItem(int itemId) { - context - .read() - .add(DeleteLandValueAdjustments(id: itemId)); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - body: ProgressHUD( - padding: const EdgeInsets.all(24), - backgroundColor: Colors.black87, - indicatorWidget: const SpinKitFadingCircle(color: Colors.white), - child: - BlocConsumer( - listener: (context, state) { - if (state is LandValueAdjustmentsLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - if (state is LandValueAdjustmentsLoaded) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - if (state is LandValueAdjustmentsErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, builder: (context, state) { - final state = context.watch().state; - if (state is LandValueAdjustmentsLoaded) { - return Column( - children: [ - Expanded( - child: SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - children: [ - Container( - margin: const EdgeInsets.only( - left: 0, top: 20, right: 0, bottom: 10), - child: const Text('VALUE ADJUSTMENTS', - 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(ShowLandValueAdjustments()); - }, - 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('Base Market Value'), - ), - const DataColumn( - label: Text('Adjustment Factors'), - ), - const DataColumn( - label: Text('% Adjustment'), - ), - const DataColumn( - label: Text('Value Adjustment'), - ), - const DataColumn( - label: Text('Market Value'), - ), - const DataColumn( - label: Text('Action'), - ) - ], - rows: state.val_adj.map((dataRow) { - return DataRow( - cells: [ - DataCell(Text(dataRow.baseMarketval!)), - DataCell( - Text(dataRow.adjustmentFactors!)), - DataCell(Text(dataRow.adjustment!)), - DataCell(Text(dataRow.valueAdjustment!)), - DataCell(Text(dataRow.marketValue!)), - DataCell(Row( - children: [ - InkWell( - child: Container( - height: 30, - width: 30, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.red, - ), - child: Icon( - Icons.delete, - color: Colors.white, - size: 20.0, - ), - ), - onTap: () { - deleteItem(dataRow.id!); - }, - ), - SizedBox( - width: 10, - ), - InkWell( - child: Container( - height: 30, - width: 30, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.red, - ), - child: Icon( - Icons.edit, - color: Colors.white, - size: 20.0, - ), - ), - onTap: () {}, - ), - ], - )) - ], - ); - }).toList())) - ], - ), - ), - )), - // Padding( - // padding: const EdgeInsets.only(left: 20.0, right: 20.0), - // child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // Text( - // 'Total', - // style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), - // ), - // Text( - // NumberFormat.currency(locale: 'en-PH', symbol: "₱") - // .format('1.0'), - // style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), - // ) - // ], - // ), - // ), - Padding( - padding: const EdgeInsets.all(15.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - CustomButton( - icon: const Icon(Icons.chevron_left_rounded, - color: Colors.white), - onPressed: () { - { - widget.PrevBtn(); - } - ; - }, - ), - CustomButton( - icon: const Icon(Icons.chevron_right_rounded, - color: Colors.white), - onPressed: () { - { - widget.NextBtn(); - } - ; - }, - ) - ], - ), - ), - ], - ); - } - if (state is LandValueAdjustmentsDeletedState) { - if (state.success) { - WidgetsBinding.instance.addPostFrameCallback((_) { - successAlert(context, "Deletion Successful", - "Extra item has been deleted successfully", () { - Navigator.of(context).pop(); - context.read().add( - LoadLandValueAdjustmentsEdit( - val_adj: [], id: widget.faasId)); - }); - }); - } - } - if (state is ShowAddLandValueAdjustmentsScreen) { - return ConstrainedBox( - constraints: BoxConstraints(maxHeight: 1000.0), - child: AlertDialog( - insetPadding: EdgeInsets.symmetric( - horizontal: 20.0, - vertical: 10.0, - ), - title: Text( - 'ADD VALUE ADJUSTMENTS', - textAlign: TextAlign.center, - ), - content: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [Expanded(child: AddLandValueAdjustmentModal())], - ), - ), - ); - } - if (state is LandValueAdjustmentsErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context.read().add( - LoadLandValueAdjustmentsEdit( - val_adj: const [], - id: widget.faasId)); - }, - ); - } - return Container(); - }), - ), - ); - } -} diff --git a/lib/screens/passo/Test Envi/multi_dropdown.dart b/lib/screens/passo/Test Envi/multi_dropdown.dart deleted file mode 100644 index 61a88e4..0000000 --- a/lib/screens/passo/Test Envi/multi_dropdown.dart +++ /dev/null @@ -1,94 +0,0 @@ -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 deleted file mode 100644 index 7d4c1c9..0000000 --- a/lib/screens/passo/Test Envi/speed_dial.dart +++ /dev/null @@ -1,529 +0,0 @@ -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/building_home.dart b/lib/screens/passo/building_home.dart deleted file mode 100644 index 8901e3d..0000000 --- a/lib/screens/passo/building_home.dart +++ /dev/null @@ -1,450 +0,0 @@ -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/offline/offline_passo/building/building_and_structure/building_and_structure_bloc.dart'; - -import 'package:unit2/bloc/passo/barangay/barangay_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/additional_item/additional_item_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/additional_items_edit/additional_items_edit_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/class_components/class_components_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/general_description/general_description_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/landref/landref_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/location/location_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/property_appraisal/property_appraisal_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/property_appraisal_edit/property_appraisal_edit_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/property_assessment/property_assessment_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/property_assessment_edit/property_assessment_edit_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/structural_material/structural_material_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/unit_construct/unit_construct_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_appraisal/land_appraisal_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_classification/land_classification_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_ext/land_ext_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_property_assessment/land_property_assessment_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_property_owner_info/land_property_owner_info_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_subclassification/land_subclassification_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_trees_improvements/land_trees_improvements_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_value_adjustments/land_value_adjustments_bloc.dart'; -import 'package:unit2/bloc/passo/land/other_improvements/other_improvements_bloc.dart'; -import 'package:unit2/bloc/passo/land/type_of_location/type_of_location_bloc.dart'; -import 'package:unit2/bloc/passo/land/type_of_road/type_of_road_bloc.dart'; - -import 'package:unit2/bloc/passo/memoranda/memoranda_bloc.dart'; -import 'package:unit2/bloc/passo/municipality/municipality_bloc.dart'; - -import 'package:unit2/bloc/passo/signatories/signatories_bloc.dart'; - -import 'package:unit2/bloc/user/user_bloc.dart'; -import 'package:unit2/model/passo/additional_items.dart'; -import 'package:unit2/model/passo/general_description.dart'; -import 'package:unit2/model/passo/land_ref.dart'; -import 'package:unit2/model/passo/property_appraisal.dart'; -import 'package:unit2/model/passo/property_appraisal_edit.dart'; -import 'package:unit2/model/passo/property_assessment_edit.dart'; -import 'package:unit2/model/passo/property_info.dart'; -import 'package:unit2/model/passo/structureMaterial.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/Building/edit_building.dart'; -import 'package:unit2/screens/passo/Land/add_land.dart'; -import 'package:unit2/theme-data.dart/colors.dart'; -import 'package:unit2/utils/text_container.dart'; -import 'package:unit2/widgets/empty_data.dart'; -import 'package:unit2/widgets/error_state.dart'; -import 'package:flutter_speed_dial/flutter_speed_dial.dart'; - -import '../../model/passo/bldg_loc.dart'; -import '../../utils/alerts.dart'; - -class BuildingHome extends StatelessWidget { - const BuildingHome({super.key}); - - @override - Widget build(BuildContext context) { - int? profileId; - String? token; - Profile profile; - - void deleteItem(int itemId) { - context.read().add(DeleteBuildingFaas(id: itemId)); - } - - void triggerBlocEvent() { - final myBloc = BlocProvider.of(context); - myBloc.add(LoadPropertyInfo()); - } - - return Scaffold( - body: ProgressHUD( - 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) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - if (state is PropertyInfoErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, - builder: (context, state) { - if (state is PropertyInfoLoaded) { - if (state.property_info.isNotEmpty) { - List propertyList = state.property_info; - return Container( - padding: const EdgeInsets.symmetric(horizontal: 12), - child: Column( - children: [ - Expanded( - child: ListView.builder( - shrinkWrap: true, - itemCount: propertyList.length, - itemBuilder: (BuildContext context, int index) { - return _listCard(propertyList[index], context, - index, deleteItem); - }, - ), - ), - ], - ), - ); - } else { - return const EmptyData( - message: - "You don't have any building faas added. Please click + to add"); - } - } - if (state is PropertyInfoErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context - .read() - .add(LoadPropertyInfo()); - }, - ); - } - if (state is BuildingFaasDeletedState) { - if (state.success) { - WidgetsBinding.instance.addPostFrameCallback((_) { - successAlert(context, "Deletion Successful", - "Building FAAS Data has been deleted successfully", - () { - Navigator.of(context).pop(); - context - .read() - .add(const LoadPropertyInfo()); - }); - }); - } - } - return Container(); - }, - ); - } - return Container(); - })), - floatingActionButton: SpeedDial( - -//provide here features of your parent FAB - icon: Icons.add, - backgroundColor: primary, - heroTag: null, - useRotationAnimation: true, - activeIcon: Icons.close, - animationCurve: Curves.elasticInOut, - children: [ - SpeedDialChild( - child: const Icon( - Icons.maps_home_work_rounded, - color: primary, - ), - label: 'Building & Other Structure', - onTap: () { - Navigator.push(context, - MaterialPageRoute(builder: (BuildContext context) { - return MultiBlocProvider(providers: [ - BlocProvider( - create: (context) => - PropertyInfoBloc()..add(LoadPropertyInfo()), - ), - BlocProvider( - create: (context) => - ClassComponentsBloc()..add(LoadClassComponents()), - ), - BlocProvider( - create: (context) => BuildingAndStructureBloc(), - ), - BlocProvider( - create: (context) => - UnitConstructBloc()..add(LoadUnitConstruct()), - ), - BlocProvider( - create: (context) => - AdditionalItemBloc()..add(LoadAdditionalItems()), - ), - BlocProvider( - create: (context) => PropertyAppraisalBloc() - ..add(LoadPropertyAppraisal( - appraisal: PropertyAppraisal())), - ), - BlocProvider( - create: (context) => PropertyAssessmentBloc() - ..add(LoadPropertyAssessment())), - BlocProvider( - create: (context) => - SignatoriesBloc()..add(LoadSignatories())), - BlocProvider( - create: (context) => - MunicipalityBloc()..add(LoadMunicipality())), - BlocProvider( - create: (context) => - BarangayBloc()..add(LoadBarangay(id: '01'))), - BlocProvider( - create: (context) => - MemorandaBloc()..add(LoadMemoranda())), - ], child: AddBuilding(triggerBlocEvent)); - })); - }), - SpeedDialChild( - child: const Icon( - Icons.forest_rounded, - color: primary, - ), - label: 'Land/Other Improvements', - onTap: () { - Navigator.push(context, - MaterialPageRoute(builder: (BuildContext context) { - return MultiBlocProvider(providers: [ - BlocProvider( - create: (context) => - LandPropertyOwnerInfoBloc()..add(LoadLand())), - BlocProvider( - create: (context) => LandClassificationBloc() - ..add(LoadLandClassification())), - BlocProvider( - create: (context) => LandSubClassificationBloc() - ..add(LoadLandSubClassification( - cityCode: "1", classCode: 1))), - BlocProvider( - create: (context) => - LandAppraisalBloc()..add(LoadLandAppraisal())), - BlocProvider( - create: (context) => - MunicipalityBloc()..add(LoadMunicipality())), - BlocProvider( - create: (context) => - BarangayBloc()..add(LoadBarangay(id: '01'))), - BlocProvider( - create: (context) => OtherImprovementsBloc() - ..add(LoadOtherImprovement())), - BlocProvider( - create: (context) => LandTreesImprovementsBloc() - ..add(LoadLandTreesImprovements())), - BlocProvider( - create: (context) => LandValueAdjustmentsBloc() - ..add(LoadLandValueAdjustments())), - BlocProvider( - create: (context) => - TypeOfLocationBloc()..add(LoadTypeOfLocation())), - BlocProvider( - create: (context) => - TypeOfRoadBloc()..add(LoadTypeOfRoad())), - BlocProvider( - create: (context) => LandPropertyAssessmentBloc() - ..add(LoadLandPropertyAssessment())), - BlocProvider( - create: (context) => - SignatoriesBloc()..add(LoadSignatories())), - BlocProvider( - create: (context) => LandExtBloc()..add(LoadLandExt())), - BlocProvider( - create: (context) => - MemorandaBloc()..add(LoadMemoranda())), - ], child: AddLand()); - })); - }, - ), - SpeedDialChild( - child: const Icon( - Icons.precision_manufacturing_rounded, - color: primary, - ), - label: 'Machinery', - onTap: () {}, - ), - // SpeedDialChild( - // child: const Icon( - // Icons.report_problem_rounded, - // color: primary, - // ), - // label: 'Testing Screen', - // onTap: () { - // Navigator.of(context) - // .push(MaterialPageRoute(builder: (ctx) => Multi_Select())); - // }, - // ), - ]), - ); - } -} - -Card _listCard(PropertyInfo property_info, context, index, deleteItem) { - return Card( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - //set border radius more than 50% of height and width to make circle - ), - margin: const EdgeInsets.all(5.0), - elevation: 5, - shadowColor: Colors.grey, - child: Padding( - padding: const EdgeInsets.all(15.0), - child: InkWell( - onTap: () async { - Navigator.push(context, - MaterialPageRoute(builder: (BuildContext context) { - return MultiBlocProvider( - providers: [ - BlocProvider( - create: (context) => - PropertyInfoBloc()..add(LoadPropertyInfo()), - ), - BlocProvider( - create: (context) => - UnitConstructBloc()..add(LoadUnitConstruct()), - ), - BlocProvider( - create: (context) => - ClassComponentsBloc()..add(LoadClassComponents()), - ), - BlocProvider( - create: (context) => - SignatoriesBloc()..add(LoadSignatories())), - BlocProvider( - create: (context) => LocationBloc() - ..add( - LoadLocation(bldgloc: BldgLoc(), id: property_info.id)), - ), - BlocProvider( - create: (context) => LandrefBloc() - ..add( - LoadLandref(landRef: LandRef(), id: property_info.id)), - ), - BlocProvider( - create: (context) => GeneralDescriptionBloc() - ..add(LoadGenDesc( - gendesc: GeneralDesc(), id: property_info.id)), - ), - BlocProvider( - create: (context) => AdditionalItemsEditBloc() - ..add(LoadAdditionalItemsEdit( - items: const [], - id: property_info.id)), - ), - BlocProvider( - create: (context) => PropertyAssessmentEditBloc() - ..add(LoadPropertyAssessmentEdit( - assessmentsEdit: PropertyAssessmentEdit(), - id: property_info.id)), - ), - BlocProvider( - create: (context) => PropertyAppraisalEditBloc() - ..add(LoadPropertyAppraisalEdit( - appraisalEdit: PropertyAppraisalEdit(), - id: property_info.id)), - ), - BlocProvider( - create: (context) => - MunicipalityBloc()..add(LoadMunicipality())), - BlocProvider( - create: (context) => - BarangayBloc()..add(LoadBarangay(id: '01'))), - BlocProvider( - create: (context) => MemorandaBloc()..add(LoadMemoranda())), - BlocProvider( - create: (context) => StructuralMaterialBloc() - ..add(LoadStructuralMaterial( - structure: StructureMaterials(), - id: property_info.id))), - ], - child: EditBuilding( - index: index, - faas: property_info, - title: 'Bldg & Structure Edit', - ), - ); - })); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 40, // Adjust this to your desired size - height: 40, // Adjust this to your desired size - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all( - color: primary, // Border color - width: 2, // Border width - ), - ), - child: Icon( - Icons.maps_home_work_rounded, - color: primary, // Icon color - ), - ), - SizedBox( - width: 20, - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - '${property_info.owner}', - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.bold, - ), - textAlign: TextAlign.left, - ), - SizedBox(height: 5), - Text( - '${property_info.tdn}', - style: TextStyle( - fontSize: 13, - ), - textAlign: TextAlign.left, - ), - ], - ), - ), - IconButton( - onPressed: () { - deleteItem(property_info.id); - }, - icon: const Icon(Icons.delete_rounded), - color: primary, - ), - ], - ), - ), - ), - ); -} diff --git a/lib/screens/passo/land_home .dart b/lib/screens/passo/land_home .dart deleted file mode 100644 index 8a5d6e5..0000000 --- a/lib/screens/passo/land_home .dart +++ /dev/null @@ -1,443 +0,0 @@ -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/barangay/barangay_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/additional_item/additional_item_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/class_components/class_components_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/property_appraisal/property_appraisal_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/property_assessment/property_assessment_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/unit_construct/unit_construct_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_appraisal/land_appraisal_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_boundaries_edit/land_boundaries_edit_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_classification/land_classification_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_ext/land_ext_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_ext_bloc/land_ext_edit_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_location_edit/land_location_edit_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_property_assessment/land_property_assessment_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_property_owner_info/land_property_owner_info_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_subclassification/land_subclassification_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_trees_improvements/land_trees_improvements_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_value_adjustments/land_value_adjustments_bloc.dart'; -import 'package:unit2/bloc/passo/land/other_improvements/other_improvements_bloc.dart'; -import 'package:unit2/bloc/passo/land/type_of_location/type_of_location_bloc.dart'; -import 'package:unit2/bloc/passo/land/type_of_road/type_of_road_bloc.dart'; - -import 'package:unit2/bloc/passo/memoranda/memoranda_bloc.dart'; -import 'package:unit2/bloc/passo/municipality/municipality_bloc.dart'; - -import 'package:unit2/bloc/passo/signatories/signatories_bloc.dart'; - -import 'package:unit2/bloc/user/user_bloc.dart'; -import 'package:unit2/model/passo/land_appr.dart'; -import 'package:unit2/model/passo/land_ext.dart'; -import 'package:unit2/model/passo/land_property_assessment.dart'; -import 'package:unit2/model/passo/land_property_boundaries.dart'; -import 'package:unit2/model/passo/land_property_loc.dart'; -import 'package:unit2/model/passo/land_property_owner.dart'; -import 'package:unit2/model/passo/land_value_adjustment.dart'; -import 'package:unit2/model/passo/other_improvements.dart'; -import 'package:unit2/model/passo/property_appraisal.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/Land/add_land.dart'; -import 'package:unit2/screens/passo/Land/edit_land.dart'; -import 'package:unit2/theme-data.dart/colors.dart'; -import 'package:unit2/utils/alerts.dart'; -import 'package:unit2/utils/text_container.dart'; -import 'package:unit2/widgets/empty_data.dart'; -import 'package:unit2/widgets/error_state.dart'; -import 'package:flutter_speed_dial/flutter_speed_dial.dart'; - -class LandHome extends StatelessWidget { - const LandHome({super.key}); - - @override - Widget build(BuildContext context) { - void deleteItem(int itemId) { - context.read().add(DeleteLandFaas(id: itemId)); - } - - void triggerBlocEvent() { - final myBloc = BlocProvider.of(context); - myBloc.add(LoadPropertyInfo()); - } - - int? profileId; - String? token; - Profile profile; - return Scaffold( - body: ProgressHUD( - padding: const EdgeInsets.only(left: 24, right: 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 LandLoading) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Please wait..."); - } - if (state is LandLoaded || state is LandErrorState) { - final progress = ProgressHUD.of(context); - progress?.dismiss(); - } - }, - builder: (context, state) { - if (state is LandLoaded) { - if (state.land.isNotEmpty) { - List propertyList = state.land; - return Container( - padding: const EdgeInsets.symmetric(horizontal: 12), - child: Column( - children: [ - Expanded( - child: ListView.builder( - shrinkWrap: true, - itemCount: propertyList.length, - itemBuilder: (BuildContext context, int index) { - return _listCard(propertyList[index], context, - index, deleteItem); - }, - ), - ), - ], - ), - ); - } else { - return const EmptyData( - message: - "You don't have any land faas added. Please click + to add"); - } - } - if (state is LandErrorState) { - return SomethingWentWrong( - message: onError, - onpressed: () { - context - .read() - .add(const LoadLand()); - }, - ); - } - - if (state is LandFaasDeletedState) { - if (state.success) { - WidgetsBinding.instance.addPostFrameCallback((_) { - successAlert(context, "Deletion Successful", - "Land FAAS Data has been deleted successfully", () { - Navigator.of(context).pop(); - context - .read() - .add(const LoadLand()); - }); - }); - } - } - return Container(); - }, - ); - } - return Container(); - })), - floatingActionButton: SpeedDial( - -//provide here features of your parent FAB - icon: Icons.add, - backgroundColor: primary, - heroTag: null, - useRotationAnimation: true, - activeIcon: Icons.close, - animationCurve: Curves.elasticInOut, - children: [ - SpeedDialChild( - child: const Icon( - Icons.maps_home_work_rounded, - color: primary, - ), - label: 'Building & Other Structure', - onTap: () { - Navigator.push(context, - MaterialPageRoute(builder: (BuildContext context) { - return MultiBlocProvider(providers: [ - BlocProvider( - create: (context) => - PropertyInfoBloc()..add(LoadPropertyInfo()), - ), - BlocProvider( - create: (context) => - ClassComponentsBloc()..add(LoadClassComponents()), - ), - BlocProvider( - create: (context) => - UnitConstructBloc()..add(LoadUnitConstruct()), - ), - BlocProvider( - create: (context) => - AdditionalItemBloc()..add(LoadAdditionalItems()), - ), - BlocProvider( - create: (context) => PropertyAppraisalBloc() - ..add(LoadPropertyAppraisal( - appraisal: PropertyAppraisal())), - ), - BlocProvider( - create: (context) => PropertyAssessmentBloc() - ..add(LoadPropertyAssessment())), - BlocProvider( - create: (context) => - SignatoriesBloc()..add(LoadSignatories())), - BlocProvider( - create: (context) => - MunicipalityBloc()..add(LoadMunicipality())), - BlocProvider( - create: (context) => - BarangayBloc()..add(LoadBarangay(id: '01'))), - BlocProvider( - create: (context) => - MemorandaBloc()..add(LoadMemoranda())), - ], child: AddBuilding(triggerBlocEvent)); - })); - }), - SpeedDialChild( - child: const Icon( - Icons.forest_rounded, - color: primary, - ), - label: 'Land/Other Improvements', - onTap: () { - Navigator.push(context, - MaterialPageRoute(builder: (BuildContext context) { - return MultiBlocProvider(providers: [ - BlocProvider( - create: (context) => - LandPropertyOwnerInfoBloc()..add(LoadLand())), - BlocProvider( - create: (context) => LandClassificationBloc() - ..add(LoadLandClassification())), - BlocProvider( - create: (context) => LandSubClassificationBloc() - ..add(LoadLandSubClassification( - cityCode: "1", classCode: 1))), - BlocProvider( - create: (context) => - LandAppraisalBloc()..add(LoadLandAppraisal())), - BlocProvider( - create: (context) => - MunicipalityBloc()..add(LoadMunicipality())), - BlocProvider( - create: (context) => - BarangayBloc()..add(LoadBarangay(id: '01'))), - BlocProvider( - create: (context) => OtherImprovementsBloc() - ..add(LoadOtherImprovement())), - BlocProvider( - create: (context) => LandTreesImprovementsBloc() - ..add(LoadLandTreesImprovements())), - BlocProvider( - create: (context) => LandValueAdjustmentsBloc() - ..add(LoadLandValueAdjustments())), - BlocProvider( - create: (context) => - TypeOfLocationBloc()..add(LoadTypeOfLocation())), - BlocProvider( - create: (context) => - TypeOfRoadBloc()..add(LoadTypeOfRoad())), - BlocProvider( - create: (context) => LandPropertyAssessmentBloc() - ..add(LoadLandPropertyAssessment())), - BlocProvider( - create: (context) => - SignatoriesBloc()..add(LoadSignatories())), - BlocProvider( - create: (context) => LandExtBloc()..add(LoadLandExt())), - BlocProvider( - create: (context) => - MemorandaBloc()..add(LoadMemoranda())), - ], child: AddLand()); - })); - }, - ), - SpeedDialChild( - child: const Icon( - Icons.precision_manufacturing_rounded, - color: primary, - ), - label: 'Machinery', - onTap: () {}, - ), - // SpeedDialChild( - // child: const Icon( - // Icons.report_problem_rounded, - // color: primary, - // ), - // label: 'Testing Screen', - // onTap: () { - // Navigator.of(context) - // .push(MaterialPageRoute(builder: (ctx) => Multi_Select())); - // }, - // ), - ]), - ); - } -} - -Card _listCard(LandPropertyOwner property_info, context, index, deleteItem) { - return Card( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - //set border radius more than 50% of height and width to make circle - ), - margin: const EdgeInsets.all(5.0), - elevation: 5, - shadowColor: Colors.grey, - child: Padding( - padding: const EdgeInsets.all(15.0), - child: InkWell( - onTap: () async { - Navigator.push(context, - MaterialPageRoute(builder: (BuildContext context) { - return MultiBlocProvider( - providers: [ - BlocProvider( - create: (context) => - LandPropertyOwnerInfoBloc()..add(LoadLand())), - BlocProvider( - create: (context) => LandLocationEditBloc() - ..add(LoadLandLocationEdit( - land_loc_edit: LandPropertyLoc(), - id: property_info.id))), - BlocProvider( - create: (context) => LandExtEditBloc() - ..add(LoadLandExtEdit( - land_ext_edit: LandExt(), id: property_info.id))), - BlocProvider( - create: (context) => LandBoundariesEditBloc() - ..add(LoadLandBoundariesEdit( - land_boundaries_edit: LandPropertyBoundaries(), - id: property_info.id))), - BlocProvider( - create: (context) => LandAppraisalBloc() - ..add(LoadLandAppraisalEdit( - land_appr: const [], - id: property_info.id!))), - BlocProvider( - create: (context) => LandClassificationBloc() - ..add(LoadLandClassification())), - BlocProvider( - create: (context) => LandSubClassificationBloc() - ..add(LoadLandSubClassification( - cityCode: "1", classCode: 1))), - BlocProvider( - create: (context) => OtherImprovementsBloc() - ..add(LoadOtherImprovementEdit( - other_imps: const [], - ids: property_info.id!))), - BlocProvider( - create: (context) => - TypeOfLocationBloc()..add(LoadTypeOfLocation())), - BlocProvider( - create: (context) => - TypeOfRoadBloc()..add(LoadTypeOfRoad())), - BlocProvider( - create: (context) => LandPropertyAssessmentBloc() - ..add(LoadLandPropertyAssessmentEdit( - assessment: [], - id: property_info.id!))), - BlocProvider( - create: (context) => LandTreesImprovementsBloc() - ..add(LoadLandTreesImprovements())), - BlocProvider( - create: (context) => LandExtBloc()..add(LoadLandExt())), - BlocProvider( - create: (context) => LandValueAdjustmentsBloc() - ..add(LoadLandValueAdjustmentsEdit( - val_adj: [], - id: property_info.id!))), - BlocProvider( - create: (context) => - SignatoriesBloc()..add(LoadSignatories())), - BlocProvider( - create: (context) => - MunicipalityBloc()..add(LoadMunicipality())), - BlocProvider( - create: (context) => - BarangayBloc()..add(LoadBarangay(id: '01'))), - BlocProvider( - create: (context) => MemorandaBloc()..add(LoadMemoranda())), - ], - child: EditLand( - index: index, - faas: property_info, - title: 'Bldg & Structure Edit', - ), - ); - })); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 40, // Adjust this to your desired size - height: 40, // Adjust this to your desired size - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all( - color: primary, // Border color - width: 2, // Border width - ), - ), - child: Icon( - Icons.forest_rounded, - color: primary, // Icon color - ), - ), - SizedBox( - width: 20, - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - '${property_info.owner}', - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.bold, - ), - textAlign: TextAlign.left, - ), - SizedBox(height: 5), - Text( - '${property_info.tdn}', - style: TextStyle( - fontSize: 13, - ), - textAlign: TextAlign.left, - ), - ], - ), - ), - IconButton( - onPressed: () { - deleteItem(property_info.id); - }, - icon: const Icon(Icons.delete_rounded), - color: primary, - ), - ], - ), - ), - ), - ); -} diff --git a/lib/screens/passo/passo_dashboard.dart b/lib/screens/passo/passo_dashboard.dart deleted file mode 100644 index ee11660..0000000 --- a/lib/screens/passo/passo_dashboard.dart +++ /dev/null @@ -1,61 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart'; -import 'package:unit2/bloc/passo/land/land_property_owner_info/land_property_owner_info_bloc.dart'; -import 'package:unit2/screens/passo/building_home.dart'; -import 'package:unit2/screens/passo/land_home%20.dart'; -import 'package:unit2/theme-data.dart/colors.dart'; -import 'package:unit2/widgets/empty_data.dart'; - -class PassoDashBoard extends StatefulWidget { - @override - _PassoDashBoard createState() => _PassoDashBoard(); -} - -class _PassoDashBoard extends State { - @override - Widget build(BuildContext context) { - return DefaultTabController( - length: 3, - child: Scaffold( - body: NestedScrollView( - headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { - return [ - const SliverAppBar( - backgroundColor: primary, - title: Text('Faas Dashboard'), - centerTitle: true, - pinned: true, - floating: true, - bottom: TabBar( - isScrollable: true, - tabs: [ - Tab(child: Text('Building')), - Tab(child: Text('Land')), - Tab(child: Text('Machineries')), - ], - ), - ), - ]; - }, - body: TabBarView( - children: [ - BlocProvider( - create: (context) => - PropertyInfoBloc()..add(const LoadPropertyInfo()), - child: const BuildingHome(), - ), - BlocProvider( - create: (context) => - LandPropertyOwnerInfoBloc()..add(const LoadLand()), - child: const LandHome(), - ), - EmptyData( - message: "Sorry, this page is under construction.", - ) - ], - ), - )), - ); - } -} diff --git a/lib/sevices/offline/offline_passo/admin/api_services/class_components_api_services.dart b/lib/sevices/offline/offline_passo/admin/api_services/class_components_api_services.dart index 04b476d..b2e5fe3 100644 --- a/lib/sevices/offline/offline_passo/admin/api_services/class_components_api_services.dart +++ b/lib/sevices/offline/offline_passo/admin/api_services/class_components_api_services.dart @@ -23,7 +23,7 @@ class ClassComponentAdminApiServices { http.Response response = await Request.instance .getRequest(param: {}, path: path, headers: headers); - print(response.statusCode); + print(response.body); if (response.statusCode == 200) { final List result = jsonDecode(response.body)['data']; print(result); diff --git a/lib/sevices/offline/offline_passo/admin/api_services/memoranda_api_services.dart b/lib/sevices/offline/offline_passo/admin/api_services/memoranda_api_services.dart index 057a7cd..b437c8a 100644 --- a/lib/sevices/offline/offline_passo/admin/api_services/memoranda_api_services.dart +++ b/lib/sevices/offline/offline_passo/admin/api_services/memoranda_api_services.dart @@ -24,7 +24,7 @@ class MemorandaAdminApiServices { http.Response response = await Request.instance .getRequest(param: {}, path: path, headers: headers); - print(response.statusCode); + print(response.body); if (response.statusCode == 200) { final List result = jsonDecode(response.body)['data']; print(result); diff --git a/lib/sevices/offline/offline_passo/admin/sql_services/sql_services.dart b/lib/sevices/offline/offline_passo/admin/sql_services/sql_services.dart index 20d4ba9..cea6f76 100644 --- a/lib/sevices/offline/offline_passo/admin/sql_services/sql_services.dart +++ b/lib/sevices/offline/offline_passo/admin/sql_services/sql_services.dart @@ -95,8 +95,7 @@ class SQLServices { maxSpacing TEXT NOT NULL, roughFinish TEXT NOT NULL, highFinish TEXT NOT NULL, - withoutBucc INTEGER NOT NULL, - gen_code TEXT + withoutBucc INTEGER NOT NULL ) '''); @@ -117,7 +116,7 @@ class SQLServices { firstname TEXT NOT NULL, middlename TEXT NOT NULL, lastname TEXT NOT NULL, - gen_code TEXT + designation TEXT ) '''); @@ -125,8 +124,7 @@ class SQLServices { CREATE TABLE memoranda ( id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, code TEXT NOT NULL, - memoranda TEXT NOT NULL, - gen_code TEXT + memoranda TEXT NOT NULL ) '''); @@ -167,7 +165,7 @@ class SQLServices { distanceKm TEXT NOT NULL, allRoadTypes TEXT NOT NULL, localTradingCenter TEXT NOT NULL, - gen_code TEXT + gen_code TEXT ) '''); @@ -199,7 +197,10 @@ class SQLServices { transCode TEXT NOT NULL, tdn TEXT NOT NULL, pin TEXT NOT NULL, - owner TEXT NOT NULL, + fname TEXT NOT NULL, + mname TEXT NOT NULL, + lname TEXT NOT NULL, + bday TEXT NOT NULL, address TEXT NOT NULL, telno TEXT NOT NULL, tin TEXT NOT NULL, @@ -365,16 +366,20 @@ class SQLServices { qtr TEXT NOT NULL, yr TEXT NOT NULL, appraisedbyName TEXT NOT NULL, - appraisedbyDate TEXT NOT NULL, + appraisedbyDate TEXT NOT NULL, + appraisedby_designation TEXT, recommendapprName TEXT NOT NULL, recommendapprDate TEXT NOT NULL, + recommendappr_designation TEXT, approvedbyName TEXT NOT NULL, + approvedby_designation TEXT, memoranda TEXT NOT NULL, swornstatementNo TEXT NOT NULL, dateReceived TEXT NOT NULL, entryDateAssessment TEXT NOT NULL, entryDateBy TEXT NOT NULL, - gen_code TEXT + gen_code TEXT, + note TEXT ) '''); @@ -397,7 +402,7 @@ class SQLServices { paintedUnitval TEXT NOT NULL, secondhandUnitval TEXT NOT NULL, actualUse TEXT NOT NULL, - + gen_code TEXT ) '''); @@ -645,7 +650,8 @@ class SQLServices { final data = { "bldgType": unit.bldgType, "building": unit.building, - "unitValue": unit.unitValue + "unitValue": unit.unitValue, + "gen_code": unit.genCode }; final id = await db.insert('unit_construction', data); return unit.copy(id: id); @@ -670,7 +676,8 @@ class SQLServices { "signatoryId": signatories.signatoryId, "firstname": signatories.firstname, "middlename": signatories.middlename, - "lastname": signatories.lastname + "lastname": signatories.lastname, + "designation": signatories.designation, }; final id = await db.insert('signatories', data); return signatories.copy(id: id); @@ -870,7 +877,10 @@ class SQLServices { "transCode": propertyInfo.transCode, "tdn": propertyInfo.tdn, "pin": propertyInfo.pin, - "owner": propertyInfo.owner, + "lname": propertyInfo.lname, + "mname": propertyInfo.mname, + "fname": propertyInfo.fname, + "bday": propertyInfo.bday, "address": propertyInfo.address, "telno": propertyInfo.telno, "tin": propertyInfo.tin, @@ -905,7 +915,10 @@ class SQLServices { "transCode": propertyInfo.transCode, "tdn": propertyInfo.tdn, "pin": propertyInfo.pin, - "owner": propertyInfo.owner, + "bday": propertyInfo.bday, + "fname": propertyInfo.fname, + "mname": propertyInfo.mname, + "lname": propertyInfo.lname, "address": propertyInfo.address, "telno": propertyInfo.telno, "tin": propertyInfo.tin, @@ -1181,6 +1194,11 @@ class SQLServices { "roof": materials.roof!.join(', ').splitMapJoin(', '), "flooring": materials.flooring!.join(', ').splitMapJoin(', '), "walls": materials.walls!.join(', ').splitMapJoin(', '), + "assessedById": materials.assessedById, + "assessedByName": materials.assessedByName, + "dateCreated": materials.dateCreated, + "dateModified": materials.dateModified, + "gen_code": materials.genCode }; final id = await db.insert('structural_materials', data); print('strct Mat test idcopy'); @@ -1246,7 +1264,8 @@ class SQLServices { "secondhand": addItems.secondhand == true ? '1' : 0, "paintedUnitval": addItems.paintedUnitval, "secondhandUnitval": addItems.secondhandUnitval, - "actualUse": addItems.actualUse + "actualUse": addItems.actualUse, + "gen_code": addItems.genCode }; final id = await db.insert('additionalitems', data); return addItems.copy(id: id); @@ -1290,12 +1309,12 @@ class SQLServices { final data = { // "id": bldgAndStructure.id, "bldgapprDetailsId": bldgAndStructure.bldgapprDetailsId, - "assessedById": bldgAndStructure.assessedById, - "assessedByName": bldgAndStructure.assessedByName, - "dateCreated": bldgAndStructure.dateCreated, - "dateModified": bldgAndStructure.dateModified, + "assessedById": 'none', + "assessedByName": 'none', + "dateCreated": 'none', + "dateModified": 'none', "bldgType": bldgAndStructure.bldgType, - "strucType": bldgAndStructure.strucType, + "strucType": bldgAndStructure.structType, "description": bldgAndStructure.description, "actualUse": bldgAndStructure.actualUse, "floorCount": bldgAndStructure.floorCount, @@ -1304,7 +1323,8 @@ class SQLServices { "depRate": bldgAndStructure.depRate, "marketValue": bldgAndStructure.marketValue, "depAmount": bldgAndStructure.depAmount, - "adjustedMarketValue": bldgAndStructure.adjustedMarketValue + "adjustedMarketValue": bldgAndStructure.adjustedMarketValue, + "buccPercentage": bldgAndStructure.buccPercentage, }; final id = await db.insert('bldg_and_structure', data); return bldgAndStructure.copy(id: id); @@ -1418,6 +1438,10 @@ class SQLServices { final data = { // "id": assessment.id, "bldgapprDetailsId": assessment.bldgapprDetailsId, + "assessedById": assessment.assessedById, + "assessedByName": assessment.assessedByName, + "dateCreated": assessment.dateCreated, + "dateModified": assessment.dateModified, "actualUse": assessment.actualUse, "marketValue": assessment.marketValue, "assessmentLevel": assessment.assessmentLevel, @@ -1435,7 +1459,12 @@ class SQLServices { "swornstatementNo": assessment.swornstatementNo, "dateReceived": assessment.dateReceived, "entryDateAssessment": assessment.entryDateAssessment, - "entryDateBy": assessment.entryDateBy + "entryDateBy": assessment.entryDateBy, + "gen_code": assessment.genCode, + "note": assessment.note, + "appraisedby_designation": assessment.appraisedbyDesignation, + "recommendappr_designation": assessment.recommendapprDesignation, + "approvedby_designation": assessment.approvedbyDesignation }; final id = await db.insert('bldg_assessment', data); return assessment.copy(id: id); @@ -1472,7 +1501,10 @@ class SQLServices { "swornstatementNo": assessment.swornstatementNo, "dateReceived": assessment.dateReceived, "entryDateAssessment": assessment.entryDateAssessment, - "entryDateBy": assessment.entryDateBy + "entryDateBy": assessment.entryDateBy, + "appraisedby_designation": assessment.appraisedbyDesignation, + "recommendappr_designation": assessment.recommendapprDesignation, + "approvedby_designation": assessment.approvedbyDesignation }; final result = await db.update('bldg_assessment', data, @@ -1911,10 +1943,13 @@ class SQLServices { "yr": landExt.yr, "appraisedbyName": landExt.appraisedbyName, "appraisedbyDate": landExt.appraisedbyDate, + "appraisedbyDesignation": landExt.appraisedbyDesignation, "recommendapprName": landExt.recommendapprName, "recommendapprDate": landExt.recommendapprDate, + "recommendapprDesignation": landExt.recommendapprDesignation, "approvedbyName": landExt.approvedbyName, "approvedbyDate": landExt.approvedbyDate, + "approvedbyDesignation": landExt.approvedbyDesignation, "memoranda": landExt.memoranda, "swornstatementNo": landExt.swornstatementNo, "dateReceived": landExt.dateReceived, diff --git a/lib/sevices/offline/offline_passo/building/property_owner_info_service.dart b/lib/sevices/offline/offline_passo/building/property_owner_info_service.dart index 87ccb03..0d7f13d 100644 --- a/lib/sevices/offline/offline_passo/building/property_owner_info_service.dart +++ b/lib/sevices/offline/offline_passo/building/property_owner_info_service.dart @@ -114,7 +114,10 @@ class PropertyOwnerInfoServices { "transCode": propertyInfo.transCode, "tdn": propertyInfo.tdn, "pin": propertyInfo.pin, - "owner": propertyInfo.owner, + "fname": propertyInfo.fname, + "mname": propertyInfo.mname, + "lname": propertyInfo.lname, + "bday": propertyInfo.bday, "address": propertyInfo.address, "telno": propertyInfo.telno, "tin": propertyInfo.tin, diff --git a/lib/theme-data.dart/form-style.dart b/lib/theme-data.dart/form-style.dart index 22d1e79..913b4d9 100644 --- a/lib/theme-data.dart/form-style.dart +++ b/lib/theme-data.dart/form-style.dart @@ -9,7 +9,7 @@ InputDecoration normalTextFieldStyle(String labelText, String hintText) { labelStyle: const TextStyle(color: Colors.grey), hintText: hintText, hintStyle: const TextStyle( - color: Colors.grey, + color: Colors.red, ), focusedBorder: OutlineInputBorder( borderSide: const BorderSide( @@ -49,8 +49,6 @@ InputDecoration normalTextFieldStyle(String labelText, String hintText) { filled: false); } - - InputDecoration loginTextFieldStyle() { return InputDecoration( floatingLabelBehavior: FloatingLabelBehavior.never, diff --git a/lib/utils/app_router.dart b/lib/utils/app_router.dart index 4a21b83..f31f5f0 100644 --- a/lib/utils/app_router.dart +++ b/lib/utils/app_router.dart @@ -1,9 +1,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:unit2/bloc/offline/offline_bloc/offline_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_dashboard.dart'; +import 'package:unit2/screens/offline/homepage/drawer.dart'; import 'package:unit2/screens/sos/index.dart'; import 'package:unit2/screens/unit2/homepage.dart/components/dashboard/dashboard.dart'; import 'package:unit2/screens/unit2/login/login.dart'; @@ -76,7 +77,10 @@ class AppRouter { }); case '/passo-home': return MaterialPageRoute(builder: (BuildContext context) { - return PassoDashBoard(); + return BlocProvider( + create: (context) => OfflineBloc()..add(SwitchOffline()), + child: const OfflineDrawerScreen(), + ); }); // BlocProvider.of( NavigationService.navigatorKey.currentContext!).add(LoadLoggedInUser()); // return MaterialPageRoute(builder: (_) { diff --git a/lib/utils/urls.dart b/lib/utils/urls.dart index cd576c1..4c3bed1 100644 --- a/lib/utils/urls.dart +++ b/lib/utils/urls.dart @@ -4,18 +4,23 @@ 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.185"; // return "192.168.10.221:3004"; // return "playweb.agusandelnorte.gov.ph"; // return 'devapi.agusandelnorte.gov.ph:3004'; - // return "192.168.10.218:8000"; + // return "192.168.80.21:8000"; + // return "192.168.10.247"; + // return "playcensys.agusandelnorte.gov.ph"; + // return "10.10.10.110:8000"; + return "192.168.80.20:8000"; } String prefixHost() { - return "https"; + return "http"; // return "http"; } diff --git a/pubspec.lock b/pubspec.lock index 9412a34..2604d48 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -385,6 +385,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.3" + date_format: + dependency: "direct main" + description: + name: date_format + sha256: "8e5154ca363411847220c8cbc43afcf69c08e8debe40ba09d57710c25711760c" + url: "https://pub.dev" + source: hosted + version: "2.0.7" date_time_picker: dependency: "direct main" description: @@ -433,6 +441,14 @@ packages: url: "https://pub.dev" source: hosted version: "5.3.3" + dropdown_button2: + dependency: "direct main" + description: + name: dropdown_button2 + sha256: b0fe8d49a030315e9eef6c7ac84ca964250155a6224d491c1365061bc974a9e1 + url: "https://pub.dev" + source: hosted + version: "2.3.9" easy_app_installer: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index b558772..4bdec04 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -99,9 +99,11 @@ dependencies: animated_splash_screen: ^1.3.0 sqflite: ^2.3.0 accordion: ^2.6.0 + dropdown_button2: ^2.3.9 device_info_plus: ^9.0.3 better_open_file: ^3.6.4 + date_format: ^2.0.7 dependency_overrides: intl: ^0.18.0