Added delete on all building faas; Experimental modification for next button to effectively check wether PUT request is successful or not;Implemented ProgressHUD on edit buildig faas to avoid blank screens
parent
ebf7797e85
commit
42bd0312a4
|
@ -65,6 +65,11 @@ class PropertyInfoBloc extends Bloc<PropertyInfoEvent, PropertyInfoState> {
|
|||
.updateBldg(event.bldg_loc, event.bldg_loc.id))!;
|
||||
print('bldgLoc');
|
||||
print(response.statusCode);
|
||||
if (response.statusCode == 200) {
|
||||
emit(ShowBldgLocSuccessAlertState());
|
||||
} else {
|
||||
emit(ShowBldgLocErrorAlertState());
|
||||
}
|
||||
} catch (e) {
|
||||
emit(PropertyInfoErrorState(e.toString()));
|
||||
}
|
||||
|
@ -77,6 +82,11 @@ class PropertyInfoBloc extends Bloc<PropertyInfoEvent, PropertyInfoState> {
|
|||
.updateLandRef(event.land_ref, event.land_ref.id))!;
|
||||
print('landref');
|
||||
print(response.body);
|
||||
if (response.statusCode == 200) {
|
||||
emit(ShowLandRefSuccessAlertState());
|
||||
} else {
|
||||
emit(ShowLandRefErrorAlertState());
|
||||
}
|
||||
} catch (e) {
|
||||
emit(PropertyInfoErrorState(e.toString()));
|
||||
}
|
||||
|
@ -90,6 +100,11 @@ class PropertyInfoBloc extends Bloc<PropertyInfoEvent, PropertyInfoState> {
|
|||
.updateGenDesc(event.gen_desc, event.gen_desc.id))!;
|
||||
print('genDesc');
|
||||
print(response.body);
|
||||
if (response.statusCode == 200) {
|
||||
emit(ShowGenDescSuccessAlertState());
|
||||
} else {
|
||||
emit(ShowGenDescErrorAlertState());
|
||||
}
|
||||
} catch (e) {
|
||||
emit(PropertyInfoErrorState(e.toString()));
|
||||
}
|
||||
|
@ -104,9 +119,24 @@ class PropertyInfoBloc extends Bloc<PropertyInfoEvent, PropertyInfoState> {
|
|||
.update(event.data, event.data.id))!;
|
||||
print('struc Material');
|
||||
print(response.body);
|
||||
if (response.statusCode == 200) {
|
||||
emit(ShowStrucMatSuccessAlertState());
|
||||
} else {
|
||||
emit(ShowStrucMatErrorAlertState());
|
||||
}
|
||||
} catch (e) {
|
||||
emit(PropertyInfoErrorState(e.toString()));
|
||||
}
|
||||
});
|
||||
|
||||
on<DeleteBuildingFaas>((event, emit) async {
|
||||
print(event.id);
|
||||
http.Response response =
|
||||
(await PropertyInfoService.instance.remove(event.id));
|
||||
print(response.statusCode);
|
||||
if (response.statusCode == 200) {
|
||||
emit(BuildingFaasDeletedState(success: true));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,3 +73,16 @@ class UpdateStrucMaterials extends PropertyInfoEvent {
|
|||
@override
|
||||
List<Object> get props => [data];
|
||||
}
|
||||
|
||||
class DeleteBuildingFaas extends PropertyInfoEvent {
|
||||
final int id;
|
||||
|
||||
const DeleteBuildingFaas({required this.id});
|
||||
|
||||
@override
|
||||
List<Object> get props => [id];
|
||||
}
|
||||
|
||||
class ShowBldgLocErrorAlert extends PropertyInfoEvent {}
|
||||
|
||||
class ShowLandRefErrorAlert extends PropertyInfoEvent {}
|
||||
|
|
|
@ -24,3 +24,26 @@ class PropertyInfoErrorState extends PropertyInfoState {
|
|||
@override
|
||||
List<Object> get props => [error];
|
||||
}
|
||||
|
||||
class BuildingFaasDeletedState extends PropertyInfoState {
|
||||
final bool success;
|
||||
const BuildingFaasDeletedState({required this.success});
|
||||
@override
|
||||
List<Object> get props => [success];
|
||||
}
|
||||
|
||||
class ShowBldgLocErrorAlertState extends PropertyInfoState {}
|
||||
|
||||
class ShowLandRefErrorAlertState extends PropertyInfoState {}
|
||||
|
||||
class ShowGenDescErrorAlertState extends PropertyInfoState {}
|
||||
|
||||
class ShowStrucMatErrorAlertState extends PropertyInfoState {}
|
||||
|
||||
class ShowStrucMatSuccessAlertState extends PropertyInfoState {}
|
||||
|
||||
class ShowBldgLocSuccessAlertState extends PropertyInfoState {}
|
||||
|
||||
class ShowLandRefSuccessAlertState extends PropertyInfoState {}
|
||||
|
||||
class ShowGenDescSuccessAlertState extends PropertyInfoState {}
|
||||
|
|
|
@ -18,7 +18,7 @@ class LandAppraisalBloc extends Bloc<LandAppraisalEvent, LandAppraisalState> {
|
|||
final tempID = await SharedPreferences.getInstance();
|
||||
print(tempID.getInt('landid'));
|
||||
final additionalItems =
|
||||
await LandAppraisalServices.instance.fetch(tempID.getInt('tempid'));
|
||||
await LandAppraisalServices.instance.fetch(tempID.getInt('landid'));
|
||||
|
||||
globalLandAppraisal
|
||||
.addAll(additionalItems); // Append all items to the list
|
||||
|
|
|
@ -120,17 +120,30 @@ class _AddBuilding extends State<AddBuilding> {
|
|||
if (state is PropertyInfoErrorState) {
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress?.dismiss();
|
||||
}
|
||||
if (state is ShowBldgLocErrorAlertState ||
|
||||
state is ShowGenDescErrorAlertState ||
|
||||
state is ShowLandRefErrorAlertState ||
|
||||
state is ShowStrucMatErrorAlertState) {
|
||||
Fluttertoast.showToast(
|
||||
msg: onError,
|
||||
fontSize: 24,
|
||||
toastLength: Toast.LENGTH_LONG,
|
||||
gravity: ToastGravity.CENTER,
|
||||
backgroundColor: Colors.black,
|
||||
textColor: Colors.white);
|
||||
msg: "Slow internet connection, please try again!");
|
||||
}
|
||||
if (state is ShowLandRefSuccessAlertState ||
|
||||
state is ShowGenDescSuccessAlertState ||
|
||||
state is ShowStrucMatSuccessAlertState) {
|
||||
NextBtn();
|
||||
}
|
||||
}, builder: (context, state) {
|
||||
if (state is PropertyInfoLoaded ||
|
||||
state is PropertyInfoErrorState) {
|
||||
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<UnitConstructBloc, UnitConstructState>(
|
||||
listener: (
|
||||
context,
|
||||
|
|
|
@ -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: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';
|
||||
|
@ -15,7 +16,9 @@ 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';
|
||||
|
@ -114,10 +117,27 @@ class _BldgLocationLandrefPage extends State<BldgLocationLandrefPage> {
|
|||
MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
// optional flex property if flex is 1 because the default flex is 1
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"Province / City", "", 'province')),
|
||||
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: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
"AGUSAN DEL NORTE",
|
||||
style: TextStyle(fontSize: 15),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10.0),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
|
@ -244,21 +264,20 @@ class _BldgLocationLandrefPage extends State<BldgLocationLandrefPage> {
|
|||
color: Colors.white),
|
||||
onPressed: () async {
|
||||
{
|
||||
final tempID =
|
||||
await SharedPreferences.getInstance();
|
||||
try {
|
||||
final tempID = await SharedPreferences
|
||||
.getInstance();
|
||||
var bldgLocData = BldgLoc(
|
||||
id: tempID.getInt('tempid')! - 1,
|
||||
street: formKey
|
||||
.currentState?.value['street'],
|
||||
barangay:
|
||||
formKey.currentState?.value['brgy'],
|
||||
barangay: formKey
|
||||
.currentState?.value['brgy'],
|
||||
municipality: formKey
|
||||
.currentState
|
||||
?.value['municipality']
|
||||
.cityDescription,
|
||||
province: formKey
|
||||
.currentState?.value['province'],
|
||||
);
|
||||
province: "Agusan Del Norte");
|
||||
var landRefData = LandRef(
|
||||
id: tempID.getInt('tempid')! - 1,
|
||||
owner: formKey
|
||||
|
@ -269,8 +288,8 @@ class _BldgLocationLandrefPage extends State<BldgLocationLandrefPage> {
|
|||
.currentState?.value['lot_no'],
|
||||
tdn: formKey
|
||||
.currentState?.value['l_td_arp'],
|
||||
area:
|
||||
formKey.currentState?.value['area'],
|
||||
area: formKey
|
||||
.currentState?.value['area'],
|
||||
surveyNo: formKey
|
||||
.currentState?.value['survey_no'],
|
||||
blkNo: formKey
|
||||
|
@ -281,8 +300,11 @@ class _BldgLocationLandrefPage extends State<BldgLocationLandrefPage> {
|
|||
bldg_loc: bldgLocData))
|
||||
..add(UpdateLandRef(
|
||||
land_ref: landRefData));
|
||||
|
||||
widget.NextBtn();
|
||||
} catch (e) {
|
||||
Fluttertoast.showToast(
|
||||
msg:
|
||||
"Slow internet connection, please try again!");
|
||||
}
|
||||
}
|
||||
;
|
||||
},
|
||||
|
@ -314,6 +336,22 @@ class _BldgLocationLandrefPage extends State<BldgLocationLandrefPage> {
|
|||
},
|
||||
);
|
||||
}
|
||||
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();
|
||||
},
|
||||
),
|
||||
|
@ -325,12 +363,13 @@ class _BldgLocationLandrefPage extends State<BldgLocationLandrefPage> {
|
|||
// Wait for the state change indicating completion
|
||||
final propertyInfoState = context.read<PropertyInfoBloc>().state;
|
||||
|
||||
if (propertyInfoState is PropertyInfoErrorState) {
|
||||
if (propertyInfoState is ShowBldgLocErrorAlertState ||
|
||||
propertyInfoState is ShowLandRefErrorAlertState) {
|
||||
// Check if the add operation was successful
|
||||
return true; // You'll need to define this in your state class
|
||||
return false; // You'll need to define this in your state class
|
||||
}
|
||||
|
||||
// Return false if the state didn't change as expected
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
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';
|
||||
|
@ -177,17 +178,19 @@ class _GeneralDescriptionPage extends State<GeneralDescriptionPage> {
|
|||
color: Colors.white),
|
||||
onPressed: () async {
|
||||
{
|
||||
try {
|
||||
final tempID = await SharedPreferences.getInstance();
|
||||
widget.onPutGeneralDescription();
|
||||
|
||||
var genDescData = GeneralDesc(
|
||||
id: tempID.getInt('tempid')! - 1,
|
||||
bldgKind:
|
||||
formKey.currentState?.value['bldg_type'].building,
|
||||
strucType:
|
||||
formKey.currentState?.value['bldg_type'].bldgType,
|
||||
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'],
|
||||
dateIssued:
|
||||
formKey.currentState?.value['coc_issued'],
|
||||
cct: formKey.currentState?.value['cct'],
|
||||
certCompletionIssued:
|
||||
formKey.currentState?.value['coc_issued'],
|
||||
|
@ -208,10 +211,15 @@ class _GeneralDescriptionPage extends State<GeneralDescriptionPage> {
|
|||
totalFloorArea:
|
||||
formKey.currentState?.value['total_area'],
|
||||
floorSketch: null,
|
||||
actualUse: formKey.currentState?.value['actual_use']);
|
||||
actualUse:
|
||||
formKey.currentState?.value['actual_use']);
|
||||
|
||||
context.read<PropertyInfoBloc>()
|
||||
..add(UpdateGeneralDesc(gen_desc: genDescData));
|
||||
} catch (e) {
|
||||
Fluttertoast.showToast(
|
||||
msg: "Slow internet connection, please try again!");
|
||||
}
|
||||
}
|
||||
;
|
||||
},
|
||||
|
@ -223,4 +231,17 @@ class _GeneralDescriptionPage extends State<GeneralDescriptionPage> {
|
|||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<bool> _waitForAddPropertyInfoToComplete() async {
|
||||
// Wait for the state change indicating completion
|
||||
final propertyInfoState = context.read<PropertyInfoBloc>().state;
|
||||
|
||||
if (propertyInfoState is ShowGenDescErrorAlertState) {
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ 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';
|
||||
|
@ -1029,4 +1030,17 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
|
|||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<bool> _waitForAddPropertyInfoToComplete() async {
|
||||
// Wait for the state change indicating completion
|
||||
final propertyInfoState = context.read<PropertyInfoBloc>().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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
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';
|
||||
|
@ -98,9 +99,11 @@ class _PropertyInfoPage extends State<PropertyInfoPage> {
|
|||
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']
|
||||
transCode: formKey
|
||||
.currentState!.value['transaction_code']
|
||||
.toString(),
|
||||
tdn: formKey.currentState!.value['arp_td'],
|
||||
pin: formKey.currentState!.value['pin'],
|
||||
|
@ -111,7 +114,8 @@ class _PropertyInfoPage extends State<PropertyInfoPage> {
|
|||
adminUser: formKey.currentState!.value['benificiary'],
|
||||
adminAddress:
|
||||
formKey.currentState!.value['benificiary_address'],
|
||||
adminTin: formKey.currentState!.value['benificiary_tin'],
|
||||
adminTin:
|
||||
formKey.currentState!.value['benificiary_tin'],
|
||||
adminTelno:
|
||||
formKey.currentState!.value['benificiary_telno'],
|
||||
assessedById: '1',
|
||||
|
@ -124,16 +128,23 @@ class _PropertyInfoPage extends State<PropertyInfoPage> {
|
|||
context.read<PropertyInfoBloc>().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 success = await _waitForAddPropertyInfoToComplete();
|
||||
// bool failed = await _waitForAddPropertyInfoToComplete();
|
||||
|
||||
if (success) {
|
||||
// Proceed to the next step or perform an action
|
||||
widget.handleButtonPress();
|
||||
} else {
|
||||
// Stay or show an error message
|
||||
}
|
||||
// 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();
|
||||
// }
|
||||
},
|
||||
)
|
||||
]),
|
||||
|
@ -145,8 +156,8 @@ class _PropertyInfoPage extends State<PropertyInfoPage> {
|
|||
// Wait for the state change indicating completion
|
||||
final propertyInfoState = context.read<PropertyInfoBloc>().state;
|
||||
|
||||
if (propertyInfoState is PropertyInfoLoaded) {
|
||||
// Check if the add operation was successful
|
||||
if (propertyInfoState is PropertyInfoErrorState) {
|
||||
// Check if the add operation was unsuccessful
|
||||
return true; // You'll need to define this in your state class
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
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';
|
||||
|
@ -364,7 +365,7 @@ class _StructuralMaterialsPage extends State<StructuralMaterialsPage> {
|
|||
const Icon(Icons.chevron_left_rounded, color: Colors.white),
|
||||
onPressed: () {
|
||||
{
|
||||
widget.NextBtn();
|
||||
widget.PrevBtn();
|
||||
}
|
||||
;
|
||||
},
|
||||
|
@ -374,6 +375,7 @@ class _StructuralMaterialsPage extends State<StructuralMaterialsPage> {
|
|||
color: Colors.white),
|
||||
onPressed: () async {
|
||||
{
|
||||
try {
|
||||
final tempID = await SharedPreferences.getInstance();
|
||||
var strucMaterials = StructureMaterialsII(
|
||||
id: tempID.getInt('tempid')! - 1,
|
||||
|
@ -390,7 +392,8 @@ class _StructuralMaterialsPage extends State<StructuralMaterialsPage> {
|
|||
.split(',')
|
||||
: beam,
|
||||
trussFraming: tfOthers
|
||||
? formKey.currentState!.value['other_tf'].split(',')
|
||||
? formKey.currentState!.value['other_tf']
|
||||
.split(',')
|
||||
: truss_framing,
|
||||
roof: roofOthers
|
||||
? formKey.currentState!.value['other_roof']
|
||||
|
@ -401,13 +404,16 @@ class _StructuralMaterialsPage extends State<StructuralMaterialsPage> {
|
|||
.split(',')
|
||||
: flooring,
|
||||
walls: wpOthers
|
||||
? formKey.currentState!.value['other_wp'].split(',')
|
||||
? formKey.currentState!.value['other_wp']
|
||||
.split(',')
|
||||
: walls,
|
||||
others: ["Others"]);
|
||||
context.read<PropertyInfoBloc>()
|
||||
..add(UpdateStrucMaterials(data: strucMaterials));
|
||||
|
||||
widget.PrevBtn();
|
||||
} catch (e) {
|
||||
Fluttertoast.showToast(
|
||||
msg: "Slow internet connection, please try again!");
|
||||
}
|
||||
}
|
||||
;
|
||||
},
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
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';
|
||||
|
||||
|
@ -16,6 +17,8 @@ import 'package:unit2/screens/passo/Building/edit_building/property_appraisal.da
|
|||
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';
|
||||
|
@ -54,9 +57,7 @@ class _EditBuilding extends State<EditBuilding> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
home: Scaffold(
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
backgroundColor: primary,
|
||||
|
@ -115,9 +116,7 @@ class _EditBuilding extends State<EditBuilding> {
|
|||
},
|
||||
builder: (context, state) {
|
||||
if (state is ClassComponentLoaded) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
return Column(
|
||||
children: [
|
||||
NumberStepper(
|
||||
numbers: [1, 2, 3, 4, 5, 6, 7],
|
||||
|
@ -135,10 +134,19 @@ class _EditBuilding extends State<EditBuilding> {
|
|||
});
|
||||
},
|
||||
),
|
||||
content(unit, state.classes),
|
||||
],
|
||||
Expanded(
|
||||
child: StatefulBuilder(builder:
|
||||
(BuildContext context, StateSetter setState) {
|
||||
return Container(
|
||||
child: content(
|
||||
unit,
|
||||
state.classes,
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
if (state is ClassComponentErrorState) {
|
||||
return SomethingWentWrong(
|
||||
|
@ -166,7 +174,6 @@ class _EditBuilding extends State<EditBuilding> {
|
|||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -184,7 +191,7 @@ class _EditBuilding extends State<EditBuilding> {
|
|||
return GeneralDescriptionEdit(unit, widget.faas.id!, NextBtn, PrevBtn);
|
||||
|
||||
case 3:
|
||||
return StructuralMaterialsPageEdit(widget.faas.id!, NextBtn, PrevBtn);
|
||||
return StructuralMaterialsEditPage(widget.faas.id!, NextBtn, PrevBtn);
|
||||
|
||||
case 4:
|
||||
return AdditionalItemEditPage(
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
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';
|
||||
|
@ -41,9 +43,25 @@ class _AdditionalItemEditPage extends State<AdditionalItemEditPage> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocConsumer<AdditionalItemsEditBloc, AdditionalItemsEditState>(
|
||||
return Scaffold(
|
||||
body: ProgressHUD(
|
||||
padding: const EdgeInsets.all(24),
|
||||
backgroundColor: Colors.black87,
|
||||
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||
child: BlocConsumer<AdditionalItemsEditBloc, AdditionalItemsEditState>(
|
||||
listener: (context, state) {
|
||||
// TODO: implement listener
|
||||
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<AdditionalItemsEditBloc>().state;
|
||||
|
@ -63,7 +81,8 @@ class _AdditionalItemEditPage extends State<AdditionalItemEditPage> {
|
|||
left: 0, top: 20, right: 0, bottom: 10),
|
||||
child: const Text('ADDITIONAL ITEMS',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold, fontSize: 18),
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 18),
|
||||
textAlign: TextAlign.left),
|
||||
),
|
||||
Align(
|
||||
|
@ -233,7 +252,8 @@ class _AdditionalItemEditPage extends State<AdditionalItemEditPage> {
|
|||
Navigator.of(context).pop();
|
||||
context.read<AdditionalItemsEditBloc>().add(
|
||||
LoadAdditionalItemsEdit(
|
||||
items: const <AdditionalItems>[], id: widget.tempId));
|
||||
items: const <AdditionalItems>[],
|
||||
id: widget.tempId));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -269,7 +289,8 @@ class _AdditionalItemEditPage extends State<AdditionalItemEditPage> {
|
|||
margin: const EdgeInsets.only(
|
||||
left: 0, top: 20, right: 0, bottom: 10),
|
||||
child: const Text('ADDITIONAL MATERIALS',
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold, fontSize: 18),
|
||||
textAlign: TextAlign.left),
|
||||
),
|
||||
Align(
|
||||
|
@ -300,6 +321,8 @@ class _AdditionalItemEditPage extends State<AdditionalItemEditPage> {
|
|||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,8 @@ class _BldgLocLandRefEdit extends State<BldgLocLandRefEdit> {
|
|||
Set<String> seenCityCodes = Set<String>();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ProgressHUD(
|
||||
return Scaffold(
|
||||
body: ProgressHUD(
|
||||
padding: const EdgeInsets.all(24),
|
||||
backgroundColor: Colors.black87,
|
||||
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||
|
@ -166,7 +167,8 @@ class _BldgLocLandRefEdit extends State<BldgLocLandRefEdit> {
|
|||
child: FormBuilderDropdown<City>(
|
||||
name: 'municipality',
|
||||
autofocus: false,
|
||||
decoration: normalTextFieldStyle(
|
||||
decoration:
|
||||
normalTextFieldStyle(
|
||||
bldgloc.municipality ??
|
||||
"Municipality",
|
||||
"",
|
||||
|
@ -174,7 +176,8 @@ class _BldgLocLandRefEdit extends State<BldgLocLandRefEdit> {
|
|||
items: uniqueItems
|
||||
.map(
|
||||
(city) =>
|
||||
DropdownMenuItem<City>(
|
||||
DropdownMenuItem<
|
||||
City>(
|
||||
value: city,
|
||||
child: Text(
|
||||
city.cityDescription ??
|
||||
|
@ -282,7 +285,9 @@ class _BldgLocLandRefEdit extends State<BldgLocLandRefEdit> {
|
|||
Expanded(
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"TD / ARP No.", "", 'l_td_arp'),
|
||||
"TD / ARP No.",
|
||||
"",
|
||||
'l_td_arp'),
|
||||
),
|
||||
const SizedBox(width: 10.0),
|
||||
Expanded(
|
||||
|
@ -323,7 +328,8 @@ class _BldgLocLandRefEdit extends State<BldgLocLandRefEdit> {
|
|||
?.value['brgy'],
|
||||
municipality: keys
|
||||
.currentState
|
||||
?.value['municipality']
|
||||
?.value[
|
||||
'municipality']
|
||||
?.cityDescription ??
|
||||
bldgloc.municipality,
|
||||
province: keys.currentState
|
||||
|
@ -418,6 +424,7 @@ class _BldgLocLandRefEdit extends State<BldgLocLandRefEdit> {
|
|||
return Container();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,14 +39,29 @@ class _GeneralDescriptionEdit extends State<GeneralDescriptionEdit> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Expanded(
|
||||
return Scaffold(
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ProgressHUD(
|
||||
padding: const EdgeInsets.all(24),
|
||||
backgroundColor: Colors.black87,
|
||||
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||
child: BlocConsumer<GeneralDescriptionBloc, GeneralDescriptionState>(
|
||||
child:
|
||||
BlocConsumer<GeneralDescriptionBloc, GeneralDescriptionState>(
|
||||
listener: (context, state) {
|
||||
// TODO: implement listener
|
||||
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) {
|
||||
|
@ -56,8 +71,10 @@ class _GeneralDescriptionEdit extends State<GeneralDescriptionEdit> {
|
|||
'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(),
|
||||
'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(),
|
||||
|
@ -88,7 +105,8 @@ class _GeneralDescriptionEdit extends State<GeneralDescriptionEdit> {
|
|||
left: 0, top: 20, right: 0, bottom: 10),
|
||||
child: const Text('GENERAL DESCRIPTION',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold, fontSize: 18),
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 18),
|
||||
textAlign: TextAlign.left),
|
||||
),
|
||||
Container(
|
||||
|
@ -98,13 +116,15 @@ class _GeneralDescriptionEdit extends State<GeneralDescriptionEdit> {
|
|||
name: 'bldg_type',
|
||||
autofocus: false,
|
||||
decoration: normalTextFieldStyle(
|
||||
state.gendesc.bldgKind ?? "Kind of Building",
|
||||
state.gendesc.bldgKind ??
|
||||
"Kind of Building",
|
||||
"Kind of Building"),
|
||||
items: widget.unit
|
||||
.map((e) => DropdownMenuItem(
|
||||
value: e,
|
||||
child:
|
||||
Text(e.bldgType + '-' + e.building),
|
||||
child: Text(e.bldgType +
|
||||
'-' +
|
||||
e.building),
|
||||
))
|
||||
.toList(),
|
||||
),
|
||||
|
@ -112,12 +132,15 @@ class _GeneralDescriptionEdit extends State<GeneralDescriptionEdit> {
|
|||
customDropDownField(
|
||||
"Actual Use", "", 'actual_use', actual_use),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"Bldg. Permit No.", "", 'bldg_permit'),
|
||||
"Bldg. Permit No.",
|
||||
"",
|
||||
'bldg_permit'),
|
||||
),
|
||||
const SizedBox(width: 10.0),
|
||||
Expanded(
|
||||
|
@ -133,7 +156,8 @@ class _GeneralDescriptionEdit extends State<GeneralDescriptionEdit> {
|
|||
"",
|
||||
'cct'),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
|
@ -152,7 +176,8 @@ class _GeneralDescriptionEdit extends State<GeneralDescriptionEdit> {
|
|||
'coo_issued'))
|
||||
]),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
|
@ -166,10 +191,13 @@ class _GeneralDescriptionEdit extends State<GeneralDescriptionEdit> {
|
|||
// optional flex property if flex is 1 because the default flex is 1
|
||||
flex: 1,
|
||||
child: customDatTimePicker(
|
||||
"Date Occupied", "", 'date_occupied'))
|
||||
"Date Occupied",
|
||||
"",
|
||||
'date_occupied'))
|
||||
]),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
|
@ -181,46 +209,60 @@ class _GeneralDescriptionEdit extends State<GeneralDescriptionEdit> {
|
|||
// optional flex property if flex is 1 because the default flex is 1
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"No. of storeys", "", 'no_of_storeys'))
|
||||
"No. of storeys",
|
||||
"",
|
||||
'no_of_storeys'))
|
||||
]),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"Area of 1st Floor", "", 'area_of_1stFl'),
|
||||
"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'))
|
||||
child: customTextField(
|
||||
"Area of 2nd Floor",
|
||||
"",
|
||||
'area_of_2ndFl'))
|
||||
]),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: customTextField("Area of 3rd Floor",
|
||||
"", 'area_of_3rdFl')),
|
||||
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'))
|
||||
child: customTextField(
|
||||
"Area of 4th Floor",
|
||||
"",
|
||||
'area_of_4thFl'))
|
||||
]),
|
||||
customTextField("Total Area", "", 'total_area'),
|
||||
SizedBox(
|
||||
height: 50,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
CustomButton(
|
||||
icon: const Icon(Icons.chevron_left_rounded,
|
||||
icon: const Icon(
|
||||
Icons.chevron_left_rounded,
|
||||
color: Colors.white),
|
||||
onPressed: () {
|
||||
{
|
||||
|
@ -230,7 +272,8 @@ class _GeneralDescriptionEdit extends State<GeneralDescriptionEdit> {
|
|||
},
|
||||
),
|
||||
CustomButton(
|
||||
icon: const Icon(Icons.chevron_right_rounded,
|
||||
icon: const Icon(
|
||||
Icons.chevron_right_rounded,
|
||||
color: Colors.white),
|
||||
onPressed: () {
|
||||
{
|
||||
|
@ -247,19 +290,21 @@ class _GeneralDescriptionEdit extends State<GeneralDescriptionEdit> {
|
|||
?.value['bldg_type']
|
||||
?.bldgType ??
|
||||
state.gendesc.strucType,
|
||||
bldgPermit: keys
|
||||
.currentState?.value['bldg_permit'],
|
||||
dateIssued: keys
|
||||
.currentState?.value['coc_issued'],
|
||||
cct: keys.currentState?.value['cct'],
|
||||
bldgPermit: keys.currentState
|
||||
?.value['bldg_permit'],
|
||||
dateIssued: keys.currentState
|
||||
?.value['coc_issued'],
|
||||
cct: keys
|
||||
.currentState?.value['cct'],
|
||||
certCompletionIssued: keys
|
||||
.currentState?.value['coc_issued'],
|
||||
.currentState
|
||||
?.value['coc_issued'],
|
||||
certOccupancyIssued: keys
|
||||
.currentState?.value['coo_issued'],
|
||||
dateCompleted: keys.currentState
|
||||
?.value['date_cnstructed'],
|
||||
dateOccupied: keys.currentState
|
||||
?.value['date_occupied'],
|
||||
.currentState
|
||||
?.value['coo_issued'],
|
||||
dateCompleted:
|
||||
keys.currentState?.value['date_cnstructed'],
|
||||
dateOccupied: keys.currentState?.value['date_occupied'],
|
||||
bldgAge: int.tryParse(keys.currentState?.value['bldg_age']),
|
||||
noStoreys: int.tryParse(keys.currentState?.value['no_of_storeys']),
|
||||
area1Stfloor: keys.currentState?.value['area_of_1stFl'],
|
||||
|
@ -292,8 +337,8 @@ class _GeneralDescriptionEdit extends State<GeneralDescriptionEdit> {
|
|||
return SomethingWentWrong(
|
||||
message: onError,
|
||||
onpressed: () {
|
||||
context.read<GeneralDescriptionBloc>().add(
|
||||
LoadGenDesc(id: widget.tempId, gendesc: GeneralDesc()));
|
||||
context.read<GeneralDescriptionBloc>().add(LoadGenDesc(
|
||||
id: widget.tempId, gendesc: GeneralDesc()));
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@ -301,6 +346,9 @@ class _GeneralDescriptionEdit extends State<GeneralDescriptionEdit> {
|
|||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
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';
|
||||
|
@ -498,9 +500,25 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocConsumer<PropertyAppraisalEditBloc, PropertyAppraisalEditState>(
|
||||
return ProgressHUD(
|
||||
padding: const EdgeInsets.all(24),
|
||||
backgroundColor: Colors.black87,
|
||||
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||
child:
|
||||
BlocConsumer<PropertyAppraisalEditBloc, PropertyAppraisalEditState>(
|
||||
listener: (context, state) {
|
||||
// TODO: implement listener
|
||||
if (state is PropertyAppraisalEditLoading) {
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress!.showWithText("Please wait...");
|
||||
}
|
||||
if (state is PropertyAppraisalEditLoaded) {
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress?.dismiss();
|
||||
}
|
||||
if (state is PropertyAppraisalEditErrorState) {
|
||||
final progress = ProgressHUD.of(context);
|
||||
progress?.dismiss();
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
if (state is PropertyAppraisalEditLoaded) {
|
||||
|
@ -528,7 +546,8 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
|
|||
return Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
margin: const EdgeInsets.only(left: 20.0, right: 20.0),
|
||||
margin:
|
||||
const EdgeInsets.only(left: 20.0, right: 20.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
|
@ -541,7 +560,8 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
|
|||
textAlign: TextAlign.left),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
child: Text(
|
||||
|
@ -562,7 +582,8 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
|
|||
),
|
||||
const SizedBox(height: 15),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
child: Text(
|
||||
|
@ -583,7 +604,8 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
|
|||
),
|
||||
const SizedBox(height: 40),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
child: Text(
|
||||
|
@ -604,7 +626,8 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
|
|||
),
|
||||
const SizedBox(height: 40),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
child: Text(
|
||||
|
@ -625,7 +648,8 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
|
|||
),
|
||||
const SizedBox(height: 15),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
child: Text(
|
||||
|
@ -638,7 +662,7 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
|
|||
),
|
||||
Container(
|
||||
child: Text(
|
||||
appraisal.addItemsSubtotal!,
|
||||
appraisal.addItemsSubtotal ?? '0.00',
|
||||
textAlign: TextAlign.right,
|
||||
),
|
||||
)
|
||||
|
@ -646,7 +670,8 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
|
|||
),
|
||||
const SizedBox(height: 15),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
child: Text(
|
||||
|
@ -672,7 +697,8 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
|
|||
),
|
||||
const SizedBox(height: 40),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
child: Text(
|
||||
|
@ -703,7 +729,8 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
|
|||
),
|
||||
const SizedBox(height: 15),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
child: Text(
|
||||
|
@ -730,7 +757,8 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
|
|||
),
|
||||
const SizedBox(height: 15),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
child: Text(
|
||||
|
@ -751,7 +779,8 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
|
|||
),
|
||||
const SizedBox(height: 15),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
child: Text(
|
||||
|
@ -809,7 +838,8 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
|
|||
width: 100,
|
||||
margin:
|
||||
const EdgeInsets.only(
|
||||
top: 15, left: 15),
|
||||
top: 15,
|
||||
left: 15),
|
||||
padding:
|
||||
const EdgeInsets.all(
|
||||
5.0),
|
||||
|
@ -828,7 +858,8 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
|
|||
width: 150,
|
||||
margin:
|
||||
const EdgeInsets.only(
|
||||
top: 15, left: 15),
|
||||
top: 15,
|
||||
left: 15),
|
||||
padding:
|
||||
const EdgeInsets.all(
|
||||
5.0),
|
||||
|
@ -847,7 +878,8 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
|
|||
width: 100,
|
||||
margin:
|
||||
const EdgeInsets.only(
|
||||
top: 15, left: 15),
|
||||
top: 15,
|
||||
left: 15),
|
||||
padding:
|
||||
const EdgeInsets.all(
|
||||
5.0),
|
||||
|
@ -866,7 +898,8 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
|
|||
width: 150,
|
||||
margin:
|
||||
const EdgeInsets.only(
|
||||
top: 15, left: 15),
|
||||
top: 15,
|
||||
left: 15),
|
||||
padding:
|
||||
const EdgeInsets.all(
|
||||
5.0),
|
||||
|
@ -907,7 +940,8 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
|
|||
state.gendesc
|
||||
.actualUse ??
|
||||
"",
|
||||
style: TextStyle(
|
||||
style:
|
||||
TextStyle(
|
||||
fontWeight:
|
||||
FontWeight
|
||||
.bold,
|
||||
|
@ -931,7 +965,8 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
|
|||
child: Text(
|
||||
NumberFormat
|
||||
.currency(
|
||||
locale: 'en-PH',
|
||||
locale:
|
||||
'en-PH',
|
||||
symbol: "₱",
|
||||
).format(
|
||||
calculateMarketValue(
|
||||
|
@ -943,7 +978,8 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
|
|||
?.value['depRate'] ??
|
||||
appraisal.depreciationRate)),
|
||||
),
|
||||
style: TextStyle(
|
||||
style:
|
||||
TextStyle(
|
||||
fontWeight:
|
||||
FontWeight
|
||||
.bold,
|
||||
|
@ -966,14 +1002,14 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
|
|||
.all(5.0),
|
||||
child: Text(
|
||||
assessmentLevel(
|
||||
calculateMarketValue(
|
||||
(totalArea * bldgUnitValue),
|
||||
item,
|
||||
double.parse(keys.currentState?.value['depRate'] ?? appraisal.depreciationRate))
|
||||
calculateMarketValue((totalArea * bldgUnitValue), item, double.parse(keys.currentState?.value['depRate'] ?? appraisal.depreciationRate))
|
||||
.toString(),
|
||||
state.gendesc.actualUse) +
|
||||
state
|
||||
.gendesc
|
||||
.actualUse) +
|
||||
'%',
|
||||
style: TextStyle(
|
||||
style:
|
||||
TextStyle(
|
||||
fontWeight:
|
||||
FontWeight
|
||||
.bold,
|
||||
|
@ -997,7 +1033,8 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
|
|||
child: Text(
|
||||
NumberFormat
|
||||
.currency(
|
||||
locale: 'en-PH',
|
||||
locale:
|
||||
'en-PH',
|
||||
symbol: "₱",
|
||||
).format(assessmentValue(
|
||||
calculateMarketValue(
|
||||
|
@ -1008,9 +1045,11 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
|
|||
appraisal
|
||||
.depreciationRate))
|
||||
.toString(),
|
||||
state.gendesc
|
||||
state
|
||||
.gendesc
|
||||
.actualUse)),
|
||||
style: TextStyle(
|
||||
style:
|
||||
TextStyle(
|
||||
fontWeight:
|
||||
FontWeight
|
||||
.bold,
|
||||
|
@ -1040,7 +1079,8 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
|
|||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
CustomButton(
|
||||
icon: const Icon(Icons.chevron_left_rounded,
|
||||
|
@ -1053,7 +1093,8 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
|
|||
},
|
||||
),
|
||||
CustomButton(
|
||||
icon: const Icon(Icons.chevron_right_rounded,
|
||||
icon: const Icon(
|
||||
Icons.chevron_right_rounded,
|
||||
color: Colors.white),
|
||||
onPressed: () async {
|
||||
final tempID =
|
||||
|
@ -1070,20 +1111,19 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
|
|||
unitconstructSubtotal:
|
||||
(totalArea * bldgUnitValue)
|
||||
.toString(),
|
||||
depreciationRate: depRate.toString(),
|
||||
depreciationRate:
|
||||
depRate.toString(),
|
||||
depreciationCost: calculateDepCost(
|
||||
(totalArea * bldgUnitValue),
|
||||
item,
|
||||
depRate)
|
||||
.toString(),
|
||||
costAddItems:
|
||||
calculateAdditionalItems(item)
|
||||
costAddItems: calculateAdditionalItems(item)
|
||||
.toString(),
|
||||
addItemsSubtotal:
|
||||
calculateAdditionalItems(item)
|
||||
.toString(),
|
||||
totalpercentDepreciation:
|
||||
(depRate * 100)
|
||||
totalpercentDepreciation: (depRate * 100)
|
||||
.toStringAsFixed(2),
|
||||
marketValue: calculateMarketValue(
|
||||
(totalArea * bldgUnitValue),
|
||||
|
@ -1091,7 +1131,8 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
|
|||
depRate)
|
||||
.toString(),
|
||||
totalArea: totalArea.toString());
|
||||
context.read<PropertyAppraisalEditBloc>()
|
||||
context
|
||||
.read<PropertyAppraisalEditBloc>()
|
||||
..add(UpdatePropertyAppraisalEdit(
|
||||
appraisalEdit: appraisals,
|
||||
id: widget.tempId));
|
||||
|
@ -1130,6 +1171,7 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
|
|||
}
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
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';
|
||||
|
@ -457,7 +459,26 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<PropertyAssessmentEditBloc, PropertyAssessmentEditState>(
|
||||
return ProgressHUD(
|
||||
padding: const EdgeInsets.all(24),
|
||||
backgroundColor: Colors.black87,
|
||||
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||
child:
|
||||
BlocConsumer<PropertyAssessmentEditBloc, PropertyAssessmentEditState>(
|
||||
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;
|
||||
|
@ -503,7 +524,8 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
|
|||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
margin: const EdgeInsets.fromLTRB(0, 20, 0, 20),
|
||||
margin:
|
||||
const EdgeInsets.fromLTRB(0, 20, 0, 20),
|
||||
child: const Text(
|
||||
'PROPERTY ASSESSMENT cont..',
|
||||
style: TextStyle(
|
||||
|
@ -561,14 +583,16 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
|
|||
const Text(
|
||||
'EFFECTIVITY OF ASSESSMENT / REASSESSMENT :',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold),
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceAround,
|
||||
MainAxisAlignment
|
||||
.spaceAround,
|
||||
children: [
|
||||
const Text('Qtr.'),
|
||||
SizedBox(
|
||||
|
@ -664,7 +688,8 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
|
|||
|
||||
initialTime:
|
||||
const TimeOfDay(
|
||||
hour: 8, minute: 0),
|
||||
hour: 8,
|
||||
minute: 0),
|
||||
// locale: const Locale.fromSubtags(languageCode: 'fr'),
|
||||
),
|
||||
),
|
||||
|
@ -681,7 +706,8 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
|
|||
child: Text(
|
||||
'RECOMMENDING APPROVAL:',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold),
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
)),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
|
@ -736,7 +762,8 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
|
|||
|
||||
initialTime:
|
||||
const TimeOfDay(
|
||||
hour: 8, minute: 0),
|
||||
hour: 8,
|
||||
minute: 0),
|
||||
// locale: const Locale.fromSubtags(languageCode: 'fr'),
|
||||
),
|
||||
),
|
||||
|
@ -813,7 +840,8 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
|
|||
itemHeight: 70,
|
||||
|
||||
suggestions: state.memorada
|
||||
.map((Memoranda memoranda) =>
|
||||
.map(
|
||||
(Memoranda memoranda) =>
|
||||
SearchFieldListItem(
|
||||
'${memoranda.memoranda}',
|
||||
item:
|
||||
|
@ -864,7 +892,8 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
|
|||
child: FormBuilderTextField(
|
||||
name: 'sworn_statement',
|
||||
decoration: InputDecoration(),
|
||||
validator: FormBuilderValidators
|
||||
validator:
|
||||
FormBuilderValidators
|
||||
.compose([]),
|
||||
),
|
||||
),
|
||||
|
@ -881,7 +910,8 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
|
|||
SizedBox(
|
||||
width: 150,
|
||||
height: 20,
|
||||
child: FormBuilderDateTimePicker(
|
||||
child:
|
||||
FormBuilderDateTimePicker(
|
||||
name: 'date_received',
|
||||
initialEntryMode:
|
||||
DatePickerEntryMode
|
||||
|
@ -908,7 +938,8 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
|
|||
SizedBox(
|
||||
width: 100,
|
||||
height: 20,
|
||||
child: FormBuilderDateTimePicker(
|
||||
child:
|
||||
FormBuilderDateTimePicker(
|
||||
name: 'date_of_entry',
|
||||
initialEntryMode:
|
||||
DatePickerEntryMode
|
||||
|
@ -937,7 +968,8 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
|
|||
child: FormBuilderTextField(
|
||||
name: 'by',
|
||||
decoration: InputDecoration(),
|
||||
validator: FormBuilderValidators
|
||||
validator:
|
||||
FormBuilderValidators
|
||||
.compose([]),
|
||||
),
|
||||
),
|
||||
|
@ -947,8 +979,9 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
|
|||
height: 30,
|
||||
),
|
||||
SizedBox(
|
||||
width:
|
||||
MediaQuery.of(context).size.width,
|
||||
width: MediaQuery.of(context)
|
||||
.size
|
||||
.width,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: primary,
|
||||
|
@ -968,14 +1001,16 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
|
|||
),
|
||||
),
|
||||
onPressed: () {
|
||||
final List<PropertyAssessmentEdit>
|
||||
final List<
|
||||
PropertyAssessmentEdit>
|
||||
propertyAssessments = [];
|
||||
|
||||
PropertyAssessmentEdit ass =
|
||||
PropertyAssessmentEdit(
|
||||
id: 1,
|
||||
bldgapprDetailsId: 440,
|
||||
actualUse: assessment.actualUse,
|
||||
actualUse:
|
||||
assessment.actualUse,
|
||||
marketValue: '0.0',
|
||||
assessmentLevel: '0.0',
|
||||
assessedValue: "1.0",
|
||||
|
@ -985,7 +1020,8 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
|
|||
.currentState!
|
||||
.value['qtr']),
|
||||
yr: int.parse(keys
|
||||
.currentState!.value['yr']),
|
||||
.currentState!
|
||||
.value['yr']),
|
||||
appraisedbyName: keys
|
||||
.currentState!
|
||||
.value['appraised_by']
|
||||
|
@ -1038,21 +1074,22 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
|
|||
swornstatementNo: keys
|
||||
.currentState!
|
||||
.value['sworn_statement'],
|
||||
dateReceived: keys.currentState!
|
||||
dateReceived: keys
|
||||
.currentState!
|
||||
.value['date_received'],
|
||||
entryDateAssessment: keys
|
||||
.currentState!
|
||||
.value['date_of_entry'],
|
||||
entryDateBy: keys
|
||||
.currentState!.value['by'],
|
||||
.currentState!
|
||||
.value['by'],
|
||||
);
|
||||
|
||||
propertyAssessments.add(ass);
|
||||
|
||||
context.read<
|
||||
PropertyAssessmentEditBloc>()
|
||||
..add(
|
||||
UpdatePropertyAssessmentEdit(
|
||||
..add(UpdatePropertyAssessmentEdit(
|
||||
assessmentsEdit:
|
||||
propertyAssessments[
|
||||
0]));
|
||||
|
@ -1088,6 +1125,7 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
|
|||
}
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,6 +67,10 @@ class _PropertyOwnerInfoEdit extends State<PropertyOwnerInfoEdit> {
|
|||
if (state is PropertyInfoLoaded) {
|
||||
return SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: Expanded(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
|
@ -100,14 +104,16 @@ class _PropertyOwnerInfoEdit extends State<PropertyOwnerInfoEdit> {
|
|||
left: 0, top: 20, right: 0, bottom: 10),
|
||||
child: const Text('PROPERTY OWNER INFO',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold, fontSize: 18),
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 18),
|
||||
textAlign: TextAlign.left),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
customDropDownField("Transaction Code", "",
|
||||
"transaction_code", transaction_codes),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
// optional flex property if flex is 1 because the default flex is 1
|
||||
|
@ -118,27 +124,31 @@ class _PropertyOwnerInfoEdit extends State<PropertyOwnerInfoEdit> {
|
|||
Expanded(
|
||||
// optional flex property if flex is 1 because the default flex is 1
|
||||
flex: 1,
|
||||
child: customTextField("Pin", "", 'pin')),
|
||||
child:
|
||||
customTextField("Pin", "", 'pin')),
|
||||
],
|
||||
),
|
||||
customTextField("Owner", "", 'owner'),
|
||||
customTextField("Address", "", 'address'),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child:
|
||||
customTextField("Tel No.", "", 'tel_no'),
|
||||
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'))
|
||||
child:
|
||||
customTextField("TIN", "", 'tin'))
|
||||
]),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
|
@ -155,19 +165,20 @@ class _PropertyOwnerInfoEdit extends State<PropertyOwnerInfoEdit> {
|
|||
"TIN", "", 'benificiary_tin'))
|
||||
]),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: customTextField(
|
||||
"Address", "", 'benificiary_address'),
|
||||
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'))
|
||||
child: customTextField("Tel No.", "",
|
||||
'benificiary_telno'))
|
||||
]),
|
||||
const SizedBox(height: 25),
|
||||
SizedBox(
|
||||
|
@ -178,22 +189,25 @@ class _PropertyOwnerInfoEdit extends State<PropertyOwnerInfoEdit> {
|
|||
onPressed: () {
|
||||
var property_info = PropertyInfo(
|
||||
id: widget.faas.id,
|
||||
transCode: keys
|
||||
.currentState!.value['transaction_code']
|
||||
transCode: keys.currentState!
|
||||
.value['transaction_code']
|
||||
.toString(),
|
||||
tdn: keys.currentState!.value['arp_td'],
|
||||
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'],
|
||||
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'],
|
||||
adminUser: keys.currentState!
|
||||
.value['benificiary'],
|
||||
adminAddress: keys.currentState!
|
||||
.value['benificiary_address'],
|
||||
adminTin: keys
|
||||
.currentState!.value['benificiary_tin'],
|
||||
adminTin: keys.currentState!
|
||||
.value['benificiary_tin'],
|
||||
adminTelno: keys.currentState!
|
||||
.value['benificiary_telno'],
|
||||
assessedById: '1',
|
||||
|
@ -213,6 +227,9 @@ class _PropertyOwnerInfoEdit extends State<PropertyOwnerInfoEdit> {
|
|||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
if (state is PropertyInfoErrorState) {
|
||||
|
|
|
@ -56,19 +56,24 @@ class _StructuralMaterialsPageEdit extends State<StructuralMaterialsPageEdit> {
|
|||
// TODO: implement listener
|
||||
}, builder: (context, state) {
|
||||
if (state is StructuralMaterialsLoaded) {
|
||||
return Expanded(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(30.0),
|
||||
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),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold, fontSize: 18),
|
||||
textAlign: TextAlign.left),
|
||||
),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'FOUNDATION',
|
||||
textAlign: TextAlign.start,
|
||||
|
@ -101,13 +106,18 @@ class _StructuralMaterialsPageEdit extends State<StructuralMaterialsPageEdit> {
|
|||
foundation = x;
|
||||
});
|
||||
},
|
||||
options: const ['Reinforced Concrete', 'Plain Concrete'],
|
||||
options: const [
|
||||
'Reinforced Concrete',
|
||||
'Plain Concrete'
|
||||
],
|
||||
selectedValues: foundation,
|
||||
whenEmpty: 'Select Foundations',
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'COLUMNS',
|
||||
textAlign: TextAlign.start,
|
||||
|
@ -140,13 +150,19 @@ class _StructuralMaterialsPageEdit extends State<StructuralMaterialsPageEdit> {
|
|||
column = x;
|
||||
});
|
||||
},
|
||||
options: const ['Steel', 'Reinforced Concrete', 'Wood'],
|
||||
options: const [
|
||||
'Steel',
|
||||
'Reinforced Concrete',
|
||||
'Wood'
|
||||
],
|
||||
selectedValues: column,
|
||||
whenEmpty: 'Select Column/s',
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'BEAMS',
|
||||
textAlign: TextAlign.start,
|
||||
|
@ -170,8 +186,8 @@ class _StructuralMaterialsPageEdit extends State<StructuralMaterialsPageEdit> {
|
|||
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||
child: Visibility(
|
||||
visible: beamsOthers,
|
||||
child:
|
||||
customTextField("Enter other beam/s", "", "other_beam"),
|
||||
child: customTextField(
|
||||
"Enter other beam/s", "", "other_beam"),
|
||||
replacement: DropDownMultiSelect(
|
||||
selected_values_style: TextStyle(color: Colors.black),
|
||||
onChanged: (List<String> x) {
|
||||
|
@ -179,13 +195,19 @@ class _StructuralMaterialsPageEdit extends State<StructuralMaterialsPageEdit> {
|
|||
beam = x;
|
||||
});
|
||||
},
|
||||
options: const ['Steel', 'Reinforced Concrete', 'Wood'],
|
||||
options: const [
|
||||
'Steel',
|
||||
'Reinforced Concrete',
|
||||
'Wood'
|
||||
],
|
||||
selectedValues: beam,
|
||||
whenEmpty: 'Select Beam/s',
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'TRUSS FRAMING',
|
||||
textAlign: TextAlign.start,
|
||||
|
@ -224,7 +246,9 @@ class _StructuralMaterialsPageEdit extends State<StructuralMaterialsPageEdit> {
|
|||
),
|
||||
),
|
||||
),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'ROOF',
|
||||
textAlign: TextAlign.start,
|
||||
|
@ -248,8 +272,8 @@ class _StructuralMaterialsPageEdit extends State<StructuralMaterialsPageEdit> {
|
|||
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||
child: Visibility(
|
||||
visible: roofOthers,
|
||||
child:
|
||||
customTextField("Enter other roof/s", "", "other_roof"),
|
||||
child: customTextField(
|
||||
"Enter other roof/s", "", "other_roof"),
|
||||
replacement: DropDownMultiSelect(
|
||||
selected_values_style: TextStyle(color: Colors.black),
|
||||
onChanged: (List<String> x) {
|
||||
|
@ -272,7 +296,9 @@ class _StructuralMaterialsPageEdit extends State<StructuralMaterialsPageEdit> {
|
|||
),
|
||||
),
|
||||
),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'FLOORING',
|
||||
textAlign: TextAlign.start,
|
||||
|
@ -317,7 +343,9 @@ class _StructuralMaterialsPageEdit extends State<StructuralMaterialsPageEdit> {
|
|||
),
|
||||
),
|
||||
),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'WALLS & PARTITIONS',
|
||||
textAlign: TextAlign.start,
|
||||
|
@ -394,7 +422,8 @@ class _StructuralMaterialsPageEdit extends State<StructuralMaterialsPageEdit> {
|
|||
walls: walls,
|
||||
others: ["Others"]);
|
||||
context.read<PropertyInfoBloc>()
|
||||
..add(UpdateStrucMaterials(data: strucMaterials));
|
||||
..add(
|
||||
UpdateStrucMaterials(data: strucMaterials));
|
||||
|
||||
widget.NextBtn();
|
||||
}
|
||||
|
@ -405,7 +434,10 @@ class _StructuralMaterialsPageEdit extends State<StructuralMaterialsPageEdit> {
|
|||
)
|
||||
],
|
||||
),
|
||||
));
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
if (state is StructuralMaterialsErrorState) {
|
||||
return Text(state.error);
|
||||
|
|
|
@ -0,0 +1,481 @@
|
|||
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<StructuralMaterialsEditPage> {
|
||||
List<String> foundation = [];
|
||||
List<String> column = [];
|
||||
List<String> beam = [];
|
||||
List<String> truss_framing = [];
|
||||
List<String> roof = [];
|
||||
List<String> flooring = [];
|
||||
List<String> walls = [];
|
||||
bool foundationOthers = false;
|
||||
bool columOthers = false;
|
||||
bool beamsOthers = false;
|
||||
bool tfOthers = false;
|
||||
bool roofOthers = false;
|
||||
bool flooringOthers = false;
|
||||
bool wpOthers = false;
|
||||
|
||||
List<MaterialOption> columnOptions = [
|
||||
MaterialOption('steel', 'Steel'),
|
||||
MaterialOption('concrete', 'Reinforced Concrete'),
|
||||
MaterialOption('wood', 'Wood'),
|
||||
];
|
||||
|
||||
List<String> selectedColumnValues = [];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: ProgressHUD(
|
||||
padding: const EdgeInsets.all(24),
|
||||
backgroundColor: Colors.black87,
|
||||
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||
child: BlocConsumer<StructuralMaterialBloc, StructuralMaterialState>(
|
||||
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<String> x) {
|
||||
setState(() {
|
||||
foundation = x;
|
||||
});
|
||||
},
|
||||
options: const ['Reinforced Concrete', 'Plain Concrete'],
|
||||
selectedValues: foundation,
|
||||
whenEmpty: 'Select Foundations',
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'COLUMNS',
|
||||
textAlign: TextAlign.start,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
const Text('Others'),
|
||||
Checkbox(
|
||||
checkColor: Colors.white,
|
||||
value: columOthers,
|
||||
onChanged: (bool? value) {
|
||||
setState(() {
|
||||
columOthers = value!;
|
||||
});
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
]),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||
child: Visibility(
|
||||
visible: columOthers,
|
||||
child: customTextField(
|
||||
"Enter other columns", "", "other_column"),
|
||||
replacement: DropDownMultiSelect(
|
||||
selected_values_style: TextStyle(color: Colors.black),
|
||||
onChanged: (List<String> x) {
|
||||
setState(() {
|
||||
column = x;
|
||||
});
|
||||
},
|
||||
options: const ['Steel', 'Reinforced Concrete', 'Wood'],
|
||||
selectedValues: column,
|
||||
whenEmpty: 'Select Column/s',
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'BEAMS',
|
||||
textAlign: TextAlign.start,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
const Text('Others'),
|
||||
Checkbox(
|
||||
checkColor: Colors.white,
|
||||
value: beamsOthers,
|
||||
onChanged: (bool? value) {
|
||||
setState(() {
|
||||
beamsOthers = value!;
|
||||
});
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
]),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||
child: Visibility(
|
||||
visible: beamsOthers,
|
||||
child:
|
||||
customTextField("Enter other beam/s", "", "other_beam"),
|
||||
replacement: DropDownMultiSelect(
|
||||
selected_values_style: TextStyle(color: Colors.black),
|
||||
onChanged: (List<String> x) {
|
||||
setState(() {
|
||||
beam = x;
|
||||
});
|
||||
},
|
||||
options: const ['Steel', 'Reinforced Concrete', 'Wood'],
|
||||
selectedValues: beam,
|
||||
whenEmpty: 'Select Beam/s',
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'TRUSS FRAMING',
|
||||
textAlign: TextAlign.start,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
const Text('Others'),
|
||||
Checkbox(
|
||||
checkColor: Colors.white,
|
||||
value: tfOthers,
|
||||
onChanged: (bool? value) {
|
||||
setState(() {
|
||||
tfOthers = value!;
|
||||
});
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
]),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||
child: Visibility(
|
||||
visible: tfOthers,
|
||||
child: customTextField(
|
||||
"Enter other truss framing/s", "", "other_tf"),
|
||||
replacement: DropDownMultiSelect(
|
||||
selected_values_style: TextStyle(color: Colors.black),
|
||||
onChanged: (List<String> x) {
|
||||
setState(() {
|
||||
truss_framing = x;
|
||||
});
|
||||
},
|
||||
options: const ['Steel', 'Wood'],
|
||||
selectedValues: truss_framing,
|
||||
whenEmpty: 'Select Truss Framing/s',
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'ROOF',
|
||||
textAlign: TextAlign.start,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
const Text('Others'),
|
||||
Checkbox(
|
||||
checkColor: Colors.white,
|
||||
value: roofOthers,
|
||||
onChanged: (bool? value) {
|
||||
setState(() {
|
||||
roofOthers = value!;
|
||||
});
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
]),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||
child: Visibility(
|
||||
visible: roofOthers,
|
||||
child:
|
||||
customTextField("Enter other roof/s", "", "other_roof"),
|
||||
replacement: DropDownMultiSelect(
|
||||
selected_values_style: TextStyle(color: Colors.black),
|
||||
onChanged: (List<String> x) {
|
||||
setState(() {
|
||||
roof = x;
|
||||
});
|
||||
},
|
||||
options: const [
|
||||
'Reinforced Concrete',
|
||||
'Tiles',
|
||||
'G.I Sheet',
|
||||
'Aluminum',
|
||||
'Asbestos',
|
||||
'Long Span',
|
||||
'Concrete Desk',
|
||||
'Nipa/Anahaw/Cogon'
|
||||
],
|
||||
selectedValues: roof,
|
||||
whenEmpty: 'Select Roof/s',
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'FLOORING',
|
||||
textAlign: TextAlign.start,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
const Text('Others'),
|
||||
Checkbox(
|
||||
checkColor: Colors.white,
|
||||
value: flooringOthers,
|
||||
onChanged: (bool? value) {
|
||||
setState(() {
|
||||
flooringOthers = value!;
|
||||
});
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
]),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||
child: Visibility(
|
||||
visible: flooringOthers,
|
||||
child: customTextField(
|
||||
"Enter other flooring/s", "", "other_flooring"),
|
||||
replacement: DropDownMultiSelect(
|
||||
selected_values_style: TextStyle(color: Colors.black),
|
||||
onChanged: (List<String> x) {
|
||||
setState(() {
|
||||
flooring = x;
|
||||
});
|
||||
},
|
||||
options: const [
|
||||
'Reinforced Concrete',
|
||||
'Plain Cement',
|
||||
'Marble',
|
||||
'Wood',
|
||||
'Tiles'
|
||||
],
|
||||
selectedValues: flooring,
|
||||
whenEmpty: 'Select Flooring/s',
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'WALLS & PARTITIONS',
|
||||
textAlign: TextAlign.start,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
const Text('Others'),
|
||||
Checkbox(
|
||||
checkColor: Colors.white,
|
||||
value: wpOthers,
|
||||
onChanged: (bool? value) {
|
||||
setState(() {
|
||||
wpOthers = value!;
|
||||
});
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
]),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||
child: Visibility(
|
||||
visible: wpOthers,
|
||||
child: customTextField(
|
||||
"Enter other walls & partition/s", "", "other_wp"),
|
||||
replacement: DropDownMultiSelect(
|
||||
selected_values_style: TextStyle(color: Colors.black),
|
||||
onChanged: (List<String> x) {
|
||||
setState(() {
|
||||
walls = x;
|
||||
});
|
||||
},
|
||||
options: const [
|
||||
'Reinforced Concrete',
|
||||
'Plain Concrete',
|
||||
'Wood',
|
||||
'CHIB',
|
||||
'G.I Sheet',
|
||||
'Build-a-wall',
|
||||
'Sawali',
|
||||
'Bamboo'
|
||||
],
|
||||
selectedValues: walls,
|
||||
whenEmpty: 'Select Walls & Partition/s',
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
CustomButton(
|
||||
icon: const Icon(Icons.chevron_left_rounded,
|
||||
color: Colors.white),
|
||||
onPressed: () {
|
||||
{
|
||||
widget.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<PropertyInfoBloc>()
|
||||
..add(UpdateStrucMaterials(data: strucMaterials));
|
||||
|
||||
widget.PrevBtn();
|
||||
}
|
||||
;
|
||||
},
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -5,6 +5,8 @@ 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 {
|
||||
|
@ -242,6 +244,14 @@ class _LandAppraisal extends State<LandAppraisal> {
|
|||
),
|
||||
);
|
||||
}
|
||||
if (state is LandAppraisalErrorState) {
|
||||
return SomethingWentWrong(
|
||||
message: onError,
|
||||
onpressed: () {
|
||||
context.read<LandAppraisalBloc>().add(LoadLandAppraisal());
|
||||
},
|
||||
);
|
||||
}
|
||||
return Container();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ 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});
|
||||
|
@ -66,6 +67,11 @@ class BuildingHome extends StatelessWidget {
|
|||
int? profileId;
|
||||
String? token;
|
||||
Profile profile;
|
||||
|
||||
void deleteItem(int itemId) {
|
||||
context.read<PropertyInfoBloc>().add(DeleteBuildingFaas(id: itemId));
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
body: ProgressHUD(
|
||||
backgroundColor: Colors.black87,
|
||||
|
@ -102,8 +108,8 @@ class BuildingHome extends StatelessWidget {
|
|||
shrinkWrap: true,
|
||||
itemCount: propertyList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return _listCard(
|
||||
propertyList[index], context, index);
|
||||
return _listCard(propertyList[index], context,
|
||||
index, deleteItem);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
@ -121,6 +127,20 @@ class BuildingHome extends StatelessWidget {
|
|||
},
|
||||
);
|
||||
}
|
||||
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<PropertyInfoBloc>()
|
||||
.add(const LoadPropertyInfo());
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
return Container();
|
||||
},
|
||||
);
|
||||
|
@ -269,7 +289,7 @@ class BuildingHome extends StatelessWidget {
|
|||
}
|
||||
}
|
||||
|
||||
Card _listCard(PropertyInfo property_info, context, index) {
|
||||
Card _listCard(PropertyInfo property_info, context, index, deleteItem) {
|
||||
return Card(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
|
@ -400,7 +420,13 @@ Card _listCard(PropertyInfo property_info, context, index) {
|
|||
],
|
||||
),
|
||||
),
|
||||
IconButton(onPressed: () {}, icon: const Icon(Icons.chevron_right)),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
deleteItem(property_info.id);
|
||||
},
|
||||
icon: const Icon(Icons.delete_rounded),
|
||||
color: primary,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
@ -134,4 +134,29 @@ class PropertyInfoService {
|
|||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
Future<http.Response> remove(id) async {
|
||||
String path = Url.instance.propertyInfo();
|
||||
Map<String, String> headers = {
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'X-Client-Key': xClientKey,
|
||||
'X-Client-Secret': xClientKeySecret
|
||||
};
|
||||
Map<String, String> params = {
|
||||
"id": id.toString(),
|
||||
};
|
||||
try {
|
||||
http.Response response = await Request.instance
|
||||
.deleteRequest(path: path, headers: headers, body: {}, param: params);
|
||||
print(id);
|
||||
if (response.statusCode == 200) {
|
||||
print(response.body);
|
||||
return response;
|
||||
} else {
|
||||
throw Exception(response.reasonPhrase);
|
||||
}
|
||||
} catch (e) {
|
||||
throw e.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ class Request {
|
|||
Map<String, String>? param}) async {
|
||||
Response response;
|
||||
try {
|
||||
response = await get(Uri.https(host, path!, param), headers: headers)
|
||||
response = await get(Uri.http(host, path!, param), headers: headers)
|
||||
.timeout(Duration(seconds: requestTimeout));
|
||||
} on TimeoutException catch (_) {
|
||||
// Fluttertoast.showToast(
|
||||
|
@ -61,7 +61,7 @@ class Request {
|
|||
Map<String, String>? param}) async {
|
||||
Response response;
|
||||
try {
|
||||
response = await post(Uri.https(host, path!, param),
|
||||
response = await post(Uri.http(host, path!, param),
|
||||
headers: headers, body: jsonEncode(body))
|
||||
.timeout(Duration(seconds: requestTimeout));
|
||||
} on TimeoutException catch (_) {
|
||||
|
@ -104,7 +104,7 @@ class Request {
|
|||
required Map<String, dynamic>? param}) async {
|
||||
Response response;
|
||||
try {
|
||||
response = await put(Uri.https(host, path, param),
|
||||
response = await put(Uri.http(host, path, param),
|
||||
headers: headers, body: jsonEncode(body));
|
||||
} on TimeoutException catch (_) {
|
||||
// Fluttertoast.showToast(
|
||||
|
@ -188,7 +188,7 @@ class Request {
|
|||
required Map<String, dynamic>? param}) async {
|
||||
Response response;
|
||||
try {
|
||||
response = await delete(Uri.https(host, path, param),
|
||||
response = await delete(Uri.http(host, path, param),
|
||||
headers: headers, body: jsonEncode(body))
|
||||
.timeout(Duration(seconds: requestTimeout));
|
||||
} on TimeoutException catch (_) {
|
||||
|
|
|
@ -5,12 +5,13 @@ class Url {
|
|||
|
||||
String host() {
|
||||
// return '192.168.10.183:3000';
|
||||
return 'agusandelnorte.gov.ph';
|
||||
// return 'agusandelnorte.gov.ph';
|
||||
// return "192.168.10.219:3000";
|
||||
// return "192.168.10.241";
|
||||
// return "192.168.10.221:3004";
|
||||
// return "playweb.agusandelnorte.gov.ph";
|
||||
return "playweb.agusandelnorte.gov.ph";
|
||||
// return 'devapi.agusandelnorte.gov.ph:3004';
|
||||
// return "192.168.10.218:8000";
|
||||
}
|
||||
|
||||
String prefixHost() {
|
||||
|
@ -26,7 +27,6 @@ class Url {
|
|||
return 'api/jobnet_app/profile/pds/';
|
||||
}
|
||||
|
||||
|
||||
String latestApk() {
|
||||
return "/api/system_app/apk_version/latest";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue