passo_mobile_app/lib/screens/offline/passo/building_home_offline.dart

697 lines
32 KiB
Dart
Raw Normal View History

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';
import 'package:unit2/bloc/offline/offline_passo/admin/municipalities_admin/municipalities_admin_bloc.dart';
import 'package:unit2/bloc/offline/offline_passo/admin/signatories/signatories_admin_bloc.dart';
import 'package:unit2/bloc/offline/offline_passo/admin/unit_construction/unit_construction_admin_bloc.dart';
import 'package:unit2/bloc/offline/offline_passo/building/additional_items_offline/additional_items_offline_bloc.dart';
import 'package:unit2/bloc/offline/offline_passo/building/appraisal_offline/bldg_appraisal_offline_bloc.dart';
import 'package:unit2/bloc/offline/offline_passo/building/assessment_offline/bldg_assessment_offline_bloc.dart';
2024-02-08 00:52:29 +00:00
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/bloc/offline/offline_passo/building/landref/landref_location_bloc.dart';
import 'package:unit2/bloc/offline/offline_passo/building/location/location_bloc.dart';
import 'package:unit2/bloc/offline/offline_passo/building/structural_materials_offline.dart/structural_material_offline_bloc.dart';
2024-02-08 00:52:29 +00:00
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';
2024-02-08 00:52:29 +00:00
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';
2024-02-08 00:52:29 +00:00
import 'package:unit2/screens/offline/passo/land/add/add_land.dart';
import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/widgets/empty_data.dart';
2024-02-08 00:52:29 +00:00
import '../../../bloc/offline/offline_passo/admin/land_classification/land_classification_bloc.dart';
import '../../../bloc/offline/offline_passo/admin/land_subclassification/land_subclassification_bloc.dart';
import '../../../bloc/offline/offline_passo/admin/trees_improvements/trees_improvements_bloc.dart';
import '../../../bloc/offline/offline_passo/admin/type_of_location/type_of_location_bloc.dart';
import '../../../bloc/offline/offline_passo/admin/type_of_road/type_of_road_bloc.dart';
import '../../../bloc/offline/offline_passo/building/owner_info_bloc/crud_bloc.dart';
2024-02-08 00:52:29 +00:00
import '../../../bloc/offline/offline_passo/land/land_property_appraisal/land_property_appraisal_bloc.dart';
import '../../../bloc/offline/offline_passo/land/land_property_assessment/land_property_assessment_bloc.dart';
import '../../../bloc/offline/offline_passo/land/land_property_boundaries/land_property_boundaries_bloc.dart';
import '../../../bloc/offline/offline_passo/land/land_property_location/land_property_location_bloc.dart';
import '../../../bloc/offline/offline_passo/land/land_property_owner_bloc/land_property_owner_bloc.dart';
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';
2024-02-08 00:52:29 +00:00
import '../../../utils/alerts.dart';
import 'package:http/http.dart';
import 'package:date_format/date_format.dart';
import '../../../utils/urls.dart';
class BuildingHomeOffline extends StatelessWidget {
2024-02-08 00:52:29 +00:00
final OfflineProfile offlineProfile;
const BuildingHomeOffline(this.offlineProfile, {super.key});
@override
Widget build(BuildContext context) {
void deleteItem(int itemId) {
context.read<CrudBloc>().add(DeleteTodo(id: itemId));
}
2024-02-08 00:52:29 +00:00
void triggerLoadBldgFaas() {
final myBloc = BlocProvider.of<CrudBloc>(context);
myBloc.add(FetchTodos());
}
void triggerLoadLandFaas() {
final myBloc = BlocProvider.of<LandPropertyOwnerBloc>(context);
myBloc.add(LoadLandPropertyOwner());
}
void uploadBldg() async {
List<PropertyInfo> propertyOwner =
await SQLServices.instance.readAllBldgOwner();
for (PropertyInfo infos in propertyOwner) {
//General Description
List<Map<String, dynamic>> genDesc =
await SQLServices.instance.getGeneralDescription(infos.id);
List<GeneralDesc> genDescList =
genDesc.map((map) => GeneralDesc.fromJson2(map)).toList();
GeneralDesc firstGenDesc = genDescList.first;
//Location
List<Map<String, dynamic>> loc =
await SQLServices.instance.getLandRef(infos.id);
List<BldgLoc> locList =
loc.map((map) => BldgLoc.fromJson2(map)).toList();
BldgLoc firstLoc = locList.first;
//Land Refeernce
List<Map<String, dynamic>> landRef =
await SQLServices.instance.getLocation(infos.id);
List<LandRef> landRefList =
landRef.map((map) => LandRef.fromJson2(map)).toList();
LandRef firstLandRef = landRefList.first;
//Assessment
List<Map<String, dynamic>> assessment =
await SQLServices.instance.getBldgAssessment(infos.id);
List<PropertyAssessment> assessList =
assessment.map((map) => PropertyAssessment.fromJson2(map)).toList();
PropertyAssessment firstAssess = assessList.first;
//Structural Materials
List<Map<String, dynamic>> strucMat =
await SQLServices.instance.getStructuralMaterials(infos.id);
List<StructureMaterials> strcuMatList =
strucMat.map((map) => StructureMaterials.fromJson2(map)).toList();
StructureMaterials firstStructMat = strcuMatList.first;
//Additional Items
List<Map<String, dynamic>> addItems =
await SQLServices.instance.getAdditionalItems(infos.id);
List<AdditionalItems> addItemsList =
addItems.map((map) => AdditionalItems.fromJson(map)).toList();
//BLDG Structure
List<Map<String, dynamic>> bldgStructure =
await SQLServices.instance.getBuildingAndStructure(infos.id);
List<BldgAndStructure> 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<String, String> 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,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocBuilder<CrudBloc, CrudState>(
builder: (context, state) {
2024-02-08 00:52:29 +00:00
if (state is PropertyInfoLoaded) {
if (state.propertyInfos.isNotEmpty) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Column(
children: [
Expanded(
child: ListView.builder(
shrinkWrap: true,
2024-02-08 00:52:29 +00:00
itemCount: state.propertyInfos.length,
itemBuilder: (BuildContext context, int index) {
2024-02-08 00:52:29 +00:00
return _listCard(
state.propertyInfos[index],
context,
index,
deleteItem,
state.propertyInfos.length,
offlineProfile);
},
),
),
],
),
);
} else {
return const EmptyData(
message:
"You don't have any building faas added. Please click + to add");
}
}
return Container();
},
)),
floatingActionButton: SpeedDial(
//provide here features of your parent FAB
icon: Icons.add,
backgroundColor: primary,
heroTag: null,
useRotationAnimation: true,
activeIcon: Icons.close,
animationCurve: Curves.elasticInOut,
children: [
SpeedDialChild(
child: const Icon(
Icons.maps_home_work_rounded,
color: primary,
),
label: 'Building & Other Structure',
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (BuildContext context) {
return MultiBlocProvider(providers: [
BlocProvider(
create: (context) => CrudBloc(),
),
BlocProvider(
create: (context) => AdditionalItemsOfflineBloc(),
),
BlocProvider(
create: (context) => MunicipalitiesAdminBloc()
..add(const LoadMunicipalities()),
),
BlocProvider(
create: (context) => BarangayAdminBloc()
..add(
const LoadBarangayInMunicipality(cityCode: '01')),
),
2024-02-08 00:52:29 +00:00
BlocProvider(
create: (context) => BuildingAndStructureBloc()),
BlocProvider(
create: (context) => ClassComponentsAdminBloc()
..add(const LoadClassComponents()),
),
BlocProvider(
create: (context) => UnitConstructionAdminBloc()
..add(const LoadUnitConstruct()),
),
BlocProvider(
create: (context) => SignatoriesAdminBloc()
..add(const LoadSignatories()),
),
BlocProvider(
create: (context) =>
MemorandaAdminBloc()..add(const LoadMemoranda()),
),
BlocProvider(create: (context) => LandrefLocationBloc()),
BlocProvider(create: (context) => LocationBloc()),
BlocProvider(
create: (context) => GeneralDescriptionBloc()),
BlocProvider(
create: (context) => StructuralMaterialOfflineBloc()),
BlocProvider(
create: (context) => AdditionalItemsOfflineBloc()
..add(const LoadAdditionalItems())),
BlocProvider(
create: (context) => BldgAppraisalOfflineBloc()),
BlocProvider(
create: (context) => BldgAssessmentOfflineBloc()),
2024-02-08 00:52:29 +00:00
], child: AddBuilding(triggerLoadBldgFaas, offlineProfile));
}));
}),
SpeedDialChild(
child: const Icon(
Icons.forest_rounded,
color: primary,
),
label: 'Land/Other Improvements',
2024-02-08 00:52:29 +00:00
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (BuildContext context) {
return MultiBlocProvider(providers: [
BlocProvider(
create: (context) => LandPropertyOwnerBloc(),
),
BlocProvider(
create: (context) => LandPropertyAppraisalBloc()
..add(const LoadLandPropertyAppraisal()),
),
BlocProvider(
create: (context) => LandClassificationBloc()
..add(const LoadLandClassification()),
),
BlocProvider(
create: (context) => LandSubclassificationBloc()
..add(const LoadLandSubClassification()),
),
BlocProvider(
create: (context) => MunicipalitiesAdminBloc()
..add(const LoadMunicipalities()),
),
BlocProvider(
create: (context) => OtherImprovementsBloc()
..add(const LoadOtherImprovements()),
),
BlocProvider(
create: (context) => TreesImprovementsBloc()
..add(const LoadTreesImprovements()),
),
BlocProvider(
create: (context) => ValueAdjustmentBloc()
..add(const LoadValueAdjustment()),
),
BlocProvider(
create: (context) =>
TypeOfRoadBloc()..add(const LoadTypeOfRoad()),
),
BlocProvider(
create: (context) =>
TypeOfLocationBloc()..add(const LoadTypeOfLocation()),
),
BlocProvider(
create: (context) => LandPropertyAssessmentBloc()
..add(const LoadLandPropertyAssessment()),
),
BlocProvider(
create: (context) => LandPropertySignatureBloc()),
BlocProvider(
create: (context) =>
SignatoriesAdminBloc()..add(const LoadSignatories()),
),
BlocProvider(
create: (context) =>
MemorandaAdminBloc()..add(const LoadMemoranda()),
),
BlocProvider(
create: (context) => LandPropertyLocationBloc(),
),
BlocProvider(
create: (context) => LandPropertyBoundariesBloc(),
),
BlocProvider(
create: (context) => TreesImprovementsBloc()
..add(const LoadTreesImprovements()),
),
], child: AddLandOffline(triggerLoadBldgFaas));
}));
},
),
SpeedDialChild(
child: const Icon(
Icons.precision_manufacturing_rounded,
color: primary,
),
label: 'Machinery',
onTap: () {},
),
2024-02-08 00:52:29 +00:00
SpeedDialChild(
child: const Icon(
Icons.upload,
color: primary,
),
label: 'Upload/Sync',
onTap: () {
uploadBldg();
},
2024-02-08 00:52:29 +00:00
),
]),
);
}
}
Card _listCard(PropertyInfo property_info, context, index, deleteItem,
bldgLength, offlineProfile) {
return Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
//set border radius more than 50% of height and width to make circle
),
margin: const EdgeInsets.all(5.0),
elevation: 5,
shadowColor: Colors.grey,
child: Padding(
padding: const EdgeInsets.all(15.0),
child: InkWell(
onTap: () async {
Navigator.push(context,
MaterialPageRoute(builder: (BuildContext context) {
return MultiBlocProvider(
providers: [
BlocProvider(
create: (context) => CrudBloc()..add(FetchTodos()),
),
BlocProvider(
create: (context) => MunicipalitiesAdminBloc()
..add(const LoadMunicipalities()),
),
BlocProvider(
create: (context) => BarangayAdminBloc()
..add(const LoadBarangayInMunicipality(cityCode: '01')),
),
BlocProvider(
create: (context) => ClassComponentsAdminBloc()
..add(const LoadClassComponents()),
),
BlocProvider(
create: (context) => UnitConstructionAdminBloc()
..add(const LoadUnitConstruct()),
),
BlocProvider(
create: (context) =>
SignatoriesAdminBloc()..add(const LoadSignatories()),
),
BlocProvider(
create: (context) =>
MemorandaAdminBloc()..add(const LoadMemoranda()),
),
2024-02-08 00:52:29 +00:00
BlocProvider(
create: (context) => BldgAppraisalOfflineBloc()
..add(FetchSingleBldgAppraisal(id: property_info.id!)),
),
BlocProvider(
create: (context) => LandrefLocationBloc()
..add(FetchSingleLandref(id: property_info.id!))),
BlocProvider(
create: (context) => LocationBloc()
..add(FetchSingleLocation(id: property_info.id!))),
BlocProvider(
create: (context) => GeneralDescriptionBloc()
..add(FetchSingleGeneralDescription(
id: property_info.id!))),
BlocProvider(
create: (context) => StructuralMaterialOfflineBloc()
..add(FetchSingleStructuralMaterial(
id: property_info.id!))),
2024-02-08 00:52:29 +00:00
BlocProvider(
create: (context) => BldgAssessmentOfflineBloc()
..add(FetchSingleBldgAssessment(id: property_info.id!))),
BlocProvider(
create: (context) => AdditionalItemsOfflineBloc()
..add(LoadAdditionalItemsEdit(
items: const <AdditionalItems>[],
id: property_info.id!))),
BlocProvider(
create: (context) => BuildingAndStructureBloc()
..add(LoadBuildingAndStructureEdit(
bldgAndStructure: const <BldgAndStructure>[],
id: property_info.id!))),
],
child: EditBuildingOffline(
index: index,
faas: property_info,
title: 'Bldg & Structure Edit',
offlineProfile: offlineProfile),
);
}));
},
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
2024-02-08 00:52:29 +00:00
width: 1, // Border width
),
),
child: const Icon(
Icons.maps_home_work_rounded,
color: primary, // Icon color
),
),
const SizedBox(
width: 20,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'${property_info.fname} ${property_info.mname} ${property_info.lname}',
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.left,
),
SizedBox(height: 5),
Text(
2024-02-08 00:52:29 +00:00
'${property_info.tdn}',
style: TextStyle(
fontSize: 13,
),
textAlign: TextAlign.left,
),
],
),
),
IconButton(
onPressed: () {
2024-02-08 00:52:29 +00:00
confirmAlertWithCancel(
context,
() => deleteItem(property_info.id),
() => null,
'Delete FAAS Item?',
"Are you sure you want to delete this item?");
},
icon: const Icon(Icons.delete_rounded),
color: primary,
),
],
),
),
),
);
}