Merge pull request 'consol/feature/passo/PASSO-#55-Refactor-property-assessment-and-add-condition-to-edit-faas-to-save-changes-or-not__develop' (#63) from consol/feature/passo/PASSO-#55-Refactor-property-assessment-and-add-condition-to-edit-faas-to-save-changes-or-not__develop into develop

Reviewed-on: http://git.agusandelnorte.gov.ph:3000/SoftwareDevelopmentSection/unit2-null-safety-repository/pulls/63
feature/passo/PASSO-#1-Sync-data-from-device-to-postgre-and-vice-versa
cyrilaquismundo 2023-10-09 09:48:45 +08:00
commit 5a17258c82
27 changed files with 2756 additions and 2307 deletions

View File

@ -16,11 +16,6 @@ class AdditionalItemBloc
on<LoadAdditionalItems>((event, emit) async { on<LoadAdditionalItems>((event, emit) async {
emit(AdditionalItemsLoading()); emit(AdditionalItemsLoading());
try { try {
// final tempID = await SharedPreferences.getInstance();
// print(tempID.getInt('tempid'));
// final additionalItem = await GetAdditionalItems.getAdditionalItems(
// tempID.getInt('tempid'));
emit(AdditionalItemsLoaded(globalAdditionalItems)); emit(AdditionalItemsLoaded(globalAdditionalItems));
} catch (e) { } catch (e) {
emit(AdditionalItemsErrorState(e.toString())); emit(AdditionalItemsErrorState(e.toString()));
@ -42,7 +37,7 @@ class AdditionalItemBloc
emit(AdditionalItemsLoaded(globalAdditionalItems)); emit(AdditionalItemsLoaded(globalAdditionalItems));
} else { } else {
emit(AdditionalItemsErrorState('error')); emit(const AdditionalItemsErrorState('error'));
} }
} catch (e) { } catch (e) {
emit(AdditionalItemsErrorState(e.toString())); emit(AdditionalItemsErrorState(e.toString()));
@ -56,7 +51,7 @@ class AdditionalItemBloc
if (response.statusCode == 200) { if (response.statusCode == 200) {
globalAdditionalItems globalAdditionalItems
.removeWhere(((AdditionalItems element) => element.id == event.id)); .removeWhere(((AdditionalItems element) => element.id == event.id));
emit(AdditionalItemsDeletedState(success: true)); emit(const AdditionalItemsDeletedState(success: true));
} }
}); });

View File

@ -12,14 +12,14 @@ part 'property_appraisal_state.dart';
class PropertyAppraisalBloc class PropertyAppraisalBloc
extends Bloc<PropertyAppraisalEvent, PropertyAppraisalState> { extends Bloc<PropertyAppraisalEvent, PropertyAppraisalState> {
PropertyAppraisalBloc() : super(PropertyAppraisalInitial()) { PropertyAppraisalBloc() : super(PropertyAppraisalLoading()) {
List<PropertyAppraisal> globalPropertyAppraisal = []; List<PropertyAppraisal> globalPropertyAppraisal = [];
on<LoadPropertyAppraisal>((event, emit) async { on<LoadPropertyAppraisal>((event, emit) async {
emit(PropertyAppraisalLoading()); emit(PropertyAppraisalLoading());
try { try {
final appraisal = await PropertyAppraisalServices.instance.fetch(); // final appraisal = await PropertyAppraisalServices.instance.fetch();
print(appraisal); // print(appraisal);
emit(PropertyAppraisalLoaded(appraisal)); emit(PropertyAppraisalLoaded(PropertyAppraisal()));
} catch (e) { } catch (e) {
emit(PropertyAppraisalErrorState(e.toString())); emit(PropertyAppraisalErrorState(e.toString()));
} }

View File

@ -42,7 +42,8 @@ class LandExtBloc extends Bloc<LandExtEvent, LandExtState> {
}); });
on<UpdateLandExt>((event, emit) async { on<UpdateLandExt>((event, emit) async {
final tempID = await SharedPreferences.getInstance(); final tempID = await SharedPreferences.getInstance();
final tempID2 = tempID.getInt('tempid')! - 1; final tempID2 = tempID.getInt('landid')! - 1;
http.Response response = http.Response response =
(await LandExtServices.instance.update(event.landext, tempID2))!; (await LandExtServices.instance.update(event.landext, tempID2))!;
print('landext'); print('landext');

View File

@ -59,6 +59,11 @@ class LandPropertyOwnerInfoBloc
print(event.land_loc.id!); print(event.land_loc.id!);
print('Land LOc'); print('Land LOc');
print(response.statusCode); print(response.statusCode);
if (response.statusCode == 200) {
emit(ShowLandLocSuccessAlertState());
} else {
emit(ShowLandLocErrorAlertState());
}
}); });
on<UpdateLandBoundaries>((event, emit) async { on<UpdateLandBoundaries>((event, emit) async {
@ -67,6 +72,21 @@ class LandPropertyOwnerInfoBloc
.update(event.land_boundaries, event.land_boundaries.id))!; .update(event.land_boundaries, event.land_boundaries.id))!;
print('Land Boundaries'); print('Land Boundaries');
print(response.body); print(response.body);
if (response.statusCode == 200) {
emit(ShowLandBoundariesSuccessState());
} else {
emit(ShowLandBoundariesErrorAlertState());
}
});
on<DeleteLandFaas>((event, emit) async {
print(event.id);
emit(LandLoading());
http.Response response = (await LandServices.instance.remove(event.id));
print(response.statusCode);
if (response.statusCode == 200) {
emit(LandFaasDeletedState(success: true));
}
}); });
} }
} }

View File

@ -58,3 +58,12 @@ class UpdateLandBoundaries extends LandPropertyOwnerInfoEvent {
@override @override
List<Object> get props => [land_boundaries]; List<Object> get props => [land_boundaries];
} }
class DeleteLandFaas extends LandPropertyOwnerInfoEvent {
final int id;
const DeleteLandFaas({required this.id});
@override
List<Object> get props => [id];
}

View File

@ -24,3 +24,18 @@ class LandErrorState extends LandPropertyOwnerInfoState {
@override @override
List<Object> get props => [error]; List<Object> get props => [error];
} }
class LandFaasDeletedState extends LandPropertyOwnerInfoState {
final bool success;
const LandFaasDeletedState({required this.success});
@override
List<Object> get props => [success];
}
class ShowLandLocErrorAlertState extends LandPropertyOwnerInfoState {}
class ShowLandBoundariesErrorAlertState extends LandPropertyOwnerInfoState {}
class ShowLandLocSuccessAlertState extends LandPropertyOwnerInfoState {}
class ShowLandBoundariesSuccessState extends LandPropertyOwnerInfoState {}

View File

@ -31,6 +31,8 @@ import 'package:unit2/widgets/error_state.dart';
GlobalKey<FormBuilderState> formKey = GlobalKey<FormBuilderState>(); GlobalKey<FormBuilderState> formKey = GlobalKey<FormBuilderState>();
class AddBuilding extends StatefulWidget { class AddBuilding extends StatefulWidget {
Function triggerBlocEvent;
AddBuilding(this.triggerBlocEvent);
@override @override
_AddBuilding createState() => _AddBuilding(); _AddBuilding createState() => _AddBuilding();
} }
@ -293,6 +295,7 @@ class _AddBuilding extends State<AddBuilding> {
} }
void onSAveAll() { void onSAveAll() {
return Navigator.of(context).pop(); Navigator.of(context).pop();
widget.triggerBlocEvent();
} }
} }

View File

@ -580,16 +580,17 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
propertyAssessments.add(ass); propertyAssessments.add(ass);
context.read<PropertyAssessmentBloc>() context
..add(UpdatePropertyAssessment( .read<PropertyAssessmentBloc>()
assessment: .add(UpdatePropertyAssessment(
propertyAssessments[0])); assessment:
propertyAssessments[0]));
widget.function(); widget.function();
}, },
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: primary, backgroundColor: primary,
foregroundColor: Colors.red), foregroundColor: Colors.red),
child: SizedBox( child: const SizedBox(
width: 200, width: 200,
height: 50, height: 50,
child: Align( child: Align(
@ -604,7 +605,7 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
), ),
), ),
), ),
SizedBox( const SizedBox(
height: 30, height: 30,
), ),
]), ]),
@ -613,10 +614,26 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
], ],
); );
} }
if (state is MemorandaErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context.read<MemorandaBloc>().add(LoadMemoranda());
},
);
}
return Container(); return Container();
}, },
); );
} }
if (state is SignatoriesErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context.read<SignatoriesBloc>().add(LoadSignatories());
},
);
}
return Container(); return Container();
}, },
))); )));

View File

@ -1129,10 +1129,30 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
), ),
); );
} }
if (state is MemorandaErrorState) {
return SomethingWentWrong(
message: state.error,
onpressed: () {
context
.read<MemorandaBloc>()
.add(const LoadMemoranda());
},
);
}
return Container(); return Container();
}, },
); );
} }
if (state is SignatoriesErrorState) {
return SomethingWentWrong(
message: state.error,
onpressed: () {
context
.read<SignatoriesBloc>()
.add(const LoadSignatories());
},
);
}
return Container(); return Container();
}, },
); );

View File

@ -48,16 +48,16 @@ class _AddLand extends State<AddLand> {
appBar: AppBar( appBar: AppBar(
centerTitle: true, centerTitle: true,
backgroundColor: primary, backgroundColor: primary,
title: Text('Land FAAS'), title: const Text('Land FAAS'),
), ),
body: Padding( body: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Column( child: Column(
children: [ children: [
NumberStepper( NumberStepper(
numbers: [1, 2, 3, 4, 5, 6, 7], numbers: const [1, 2, 3, 4, 5, 6, 7],
activeStepColor: primary, activeStepColor: primary,
numberStyle: TextStyle(color: Colors.white), numberStyle: const TextStyle(color: Colors.white),
lineColor: primary, lineColor: primary,
// activeStep property set to activeStep variable defined above. // activeStep property set to activeStep variable defined above.
activeStep: activeStep, activeStep: activeStep,

View File

@ -1,6 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:unit2/bloc/passo/land/land_appraisal/land_appraisal_bloc.dart'; import 'package:unit2/bloc/passo/land/land_appraisal/land_appraisal_bloc.dart';
@ -12,6 +14,8 @@ import 'package:unit2/model/passo/land_value_adjustment.dart';
import 'package:unit2/model/passo/type_of_location.dart'; import 'package:unit2/model/passo/type_of_location.dart';
import 'package:unit2/model/passo/type_of_road.dart'; import 'package:unit2/model/passo/type_of_road.dart';
import 'package:unit2/theme-data.dart/form-style.dart'; import 'package:unit2/theme-data.dart/form-style.dart';
import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/error_state.dart';
class AddLandValueAdjustmentModal extends StatefulWidget { class AddLandValueAdjustmentModal extends StatefulWidget {
// final List<UnitConstruct> unit; // final List<UnitConstruct> unit;
@ -103,365 +107,421 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BlocBuilder<LandValueAdjustmentsBloc, LandValueAdjustmentsState>( return Scaffold(
buildWhen: (previous, current) { body: ProgressHUD(
return false; padding: const EdgeInsets.all(24),
}, builder: (context, state) { backgroundColor: Colors.black87,
if (state is ShowAddLandValueAdjustmentsScreen) { indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
return BlocConsumer<LandAppraisalBloc, LandAppraisalState>( child: BlocBuilder<LandValueAdjustmentsBloc, LandValueAdjustmentsState>(
listener: (context, state) { buildWhen: (previous, current) {
// TODO: implement listener return false;
}, builder: (context, state) { }, builder: (context, state) {
if (state is LandAppraisalLoaded) { if (state is ShowAddLandValueAdjustmentsScreen) {
final land_appr = state.land_appr; return BlocConsumer<LandAppraisalBloc, LandAppraisalState>(
return BlocConsumer<TypeOfRoadBloc, TypeOfRoadState>( listener: (context, state) {
listener: (context, state) { // TODO: implement listener
// TODO: implement listener }, builder: (context, state) {
}, if (state is LandAppraisalLoaded) {
builder: (context, state) { final land_appr = state.land_appr;
if (state is TypeOfRoadLoaded) { return BlocConsumer<TypeOfRoadBloc, TypeOfRoadState>(
final roadType = state.road_type; listener: (context, state) {
return BlocConsumer<TypeOfLocationBloc, TypeOfLocationState>( // TODO: implement listener
listener: (context, state) { },
// TODO: implement listener builder: (context, state) {
}, if (state is TypeOfRoadLoaded) {
builder: (context, state) { final roadType = state.road_type;
if (state is TypeOfLocationLoaded) { return BlocConsumer<TypeOfLocationBloc,
return FormBuilder( TypeOfLocationState>(
key: otherImpKey, listener: (context, state) {
onChanged: () { // TODO: implement listener
otherImpKey.currentState?.save(); },
}, builder: (context, state) {
autovalidateMode: AutovalidateMode.disabled, if (state is TypeOfLocationLoaded) {
child: Padding( return FormBuilder(
padding: const EdgeInsets.all(8.0), key: otherImpKey,
child: Container( onChanged: () {
child: SingleChildScrollView( otherImpKey.currentState?.save();
},
autovalidateMode: AutovalidateMode.disabled,
child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Column( child: Container(
mainAxisAlignment: MainAxisAlignment.start, child: SingleChildScrollView(
crossAxisAlignment: padding: const EdgeInsets.all(8.0),
CrossAxisAlignment.start, child: Column(
mainAxisSize: MainAxisSize.min, mainAxisAlignment:
children: <Widget>[ MainAxisAlignment.start,
Container( crossAxisAlignment:
margin: const EdgeInsets.only( CrossAxisAlignment.start,
left: 0, mainAxisSize: MainAxisSize.min,
top: 10, children: <Widget>[
right: 0,
bottom: 0),
child: Expanded(
flex: 1,
child:
FormBuilderDropdown<LandAppr?>(
name: 'land_appr_item',
autofocus: false,
decoration: normalTextFieldStyle(
"Land Appraisal Items", ""),
items: land_appr
.map((land_appr) =>
DropdownMenuItem<
LandAppr?>(
value: land_appr,
child: Text((land_appr
.subClass ??
"")),
))
.toList(),
onChanged: (selectedLandAppr) {
if (selectedLandAppr != null) {
setState(() {
_unitValue = double.parse(
selectedLandAppr
.baseMarketval!);
});
}
},
)),
),
SizedBox(
height: 10,
),
Text("Adjustment Factors"),
Container(
margin: const EdgeInsets.only(
left: 0,
top: 10,
right: 0,
bottom: 0),
child: Expanded(
flex: 1,
child: FormBuilderDropdown<
TypeOfRoad?>(
name: 'road_type',
autofocus: false,
decoration: normalTextFieldStyle(
"Type of Road", ""),
items: roadType
.map((roadType) =>
DropdownMenuItem<
TypeOfRoad?>(
value: roadType,
child: Text((roadType
.roadType ??
"")),
))
.toList(),
onChanged: (selectedRoad) {
if (selectedRoad != null) {
setState(() {
_roadTypeDeduction =
double.parse(
selectedRoad
.deduction!);
_roadType =
selectedRoad.roadType!;
});
}
},
)),
),
SizedBox(
height: 10,
),
Text("Type of Location"),
Container(
margin: const EdgeInsets.only(
left: 0,
top: 10,
right: 0,
bottom: 0),
child: Expanded(
flex: 1,
child: FormBuilderDropdown<
TypeOfLocation?>(
name: 'loc_type_road',
autofocus: false,
decoration: normalTextFieldStyle(
"Distance to Road", ""),
items: state.loc_type
.map((locTypeRoad) =>
DropdownMenuItem<
TypeOfLocation?>(
value: locTypeRoad,
child: Text((locTypeRoad
.distanceKm ??
"")),
))
.toList(),
onChanged: (selectedLoadRoad) {
if (selectedLoadRoad != null) {
setState(() {
_locTypeRoad = double.parse(
selectedLoadRoad
.allRoadTypes!);
_locRdDistance =
selectedLoadRoad
.distanceKm!;
});
}
},
)),
),
Container(
margin: const EdgeInsets.only(
left: 0,
top: 10,
right: 0,
bottom: 0),
child: Expanded(
flex: 1,
child: FormBuilderDropdown<
TypeOfLocation?>(
name: 'loc_type_pob',
autofocus: false,
decoration: normalTextFieldStyle(
"Distance to Poblacion", ""),
items: state.loc_type
.map((locTypePob) =>
DropdownMenuItem<
TypeOfLocation?>(
value: locTypePob,
child: Text((locTypePob
.distanceKm ??
"")),
))
.toList(),
onChanged: (selectedLocPob) {
if (selectedLocPob != null) {
setState(() {
_locTypePob = double.parse(
selectedLocPob
.localTradingCenter!);
_locPobDistance =
selectedLocPob
.distanceKm!;
});
}
},
)),
),
const SizedBox(height: 10),
Container(
height: 45.0,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: Colors.grey,
width: 1.0,
),
borderRadius:
BorderRadius.circular(5.0),
),
child: Align(
alignment: Alignment.center,
child: Text(
(calculateAdjustment() * 100)
.toString() +
'%'),
),
),
const SizedBox(height: 10),
Container(
height: 45.0,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: Colors.grey,
width: 1.0,
),
borderRadius:
BorderRadius.circular(5.0),
),
child: Align(
alignment: Alignment.center,
child: Text(NumberFormat.currency(
locale: 'en-PH',
symbol: "",
).format(calculateValueAdjustment())),
),
),
const SizedBox(height: 10),
Container(
height: 45.0,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: Colors.grey,
width: 1.0,
),
borderRadius:
BorderRadius.circular(5.0),
),
child: Align(
alignment: Alignment.center,
child: Text(NumberFormat.currency(
locale: 'en-PH',
symbol: "",
).format(calculateMarketValue())),
),
),
const SizedBox(height: 10),
Row(
children: [
Container( Container(
width: 120, margin: const EdgeInsets.only(
height: 60, left: 0,
padding: const EdgeInsets.all(8.0), top: 10,
child: ElevatedButton( right: 0,
onPressed: () async { bottom: 0),
final tempID = child: Expanded(
await SharedPreferences flex: 1,
.getInstance(); child: FormBuilderDropdown<
print(tempID.getInt('landid')); LandAppr?>(
var adjustments = ValueAdjustments( name: 'land_appr_item',
landapprDetailsId: tempID autofocus: false,
.getInt('landid')! - decoration:
1, normalTextFieldStyle(
baseMarketval: "Land Appraisal Items",
_unitValue.toString(), ""),
adjustmentFactors: items: land_appr
_roadType + .map((land_appr) =>
DropdownMenuItem<
LandAppr?>(
value: land_appr,
child: Text((land_appr
.subClass ??
"")),
))
.toList(),
onChanged:
(selectedLandAppr) {
if (selectedLandAppr !=
null) {
setState(() {
_unitValue = double.parse(
selectedLandAppr
.baseMarketval!);
});
}
},
)),
),
SizedBox(
height: 10,
),
Text("Adjustment Factors"),
Container(
margin: const EdgeInsets.only(
left: 0,
top: 10,
right: 0,
bottom: 0),
child: Expanded(
flex: 1,
child: FormBuilderDropdown<
TypeOfRoad?>(
name: 'road_type',
autofocus: false,
decoration:
normalTextFieldStyle(
"Type of Road", ""),
items: roadType
.map((roadType) =>
DropdownMenuItem<
TypeOfRoad?>(
value: roadType,
child: Text((roadType
.roadType ??
"")),
))
.toList(),
onChanged: (selectedRoad) {
if (selectedRoad != null) {
setState(() {
_roadTypeDeduction =
double.parse(
selectedRoad
.deduction!);
_roadType = selectedRoad
.roadType!;
});
}
},
)),
),
SizedBox(
height: 10,
),
Text("Type of Location"),
Container(
margin: const EdgeInsets.only(
left: 0,
top: 10,
right: 0,
bottom: 0),
child: Expanded(
flex: 1,
child: FormBuilderDropdown<
TypeOfLocation?>(
name: 'loc_type_road',
autofocus: false,
decoration:
normalTextFieldStyle(
"Distance to Road",
""),
items: state.loc_type
.map((locTypeRoad) =>
DropdownMenuItem<
TypeOfLocation?>(
value: locTypeRoad,
child: Text((locTypeRoad
.distanceKm ??
"")),
))
.toList(),
onChanged:
(selectedLoadRoad) {
if (selectedLoadRoad !=
null) {
setState(() {
_locTypeRoad = double
.parse(selectedLoadRoad
.allRoadTypes!);
_locRdDistance =
selectedLoadRoad
.distanceKm!;
});
}
},
)),
),
Container(
margin: const EdgeInsets.only(
left: 0,
top: 10,
right: 0,
bottom: 0),
child: Expanded(
flex: 1,
child: FormBuilderDropdown<
TypeOfLocation?>(
name: 'loc_type_pob',
autofocus: false,
decoration:
normalTextFieldStyle(
"Distance to Poblacion",
""),
items: state.loc_type
.map((locTypePob) =>
DropdownMenuItem<
TypeOfLocation?>(
value: locTypePob,
child: Text((locTypePob
.distanceKm ??
"")),
))
.toList(),
onChanged: (selectedLocPob) {
if (selectedLocPob !=
null) {
setState(() {
_locTypePob = double
.parse(selectedLocPob
.localTradingCenter!);
_locPobDistance =
selectedLocPob
.distanceKm!;
});
}
},
)),
),
const SizedBox(height: 10),
Container(
height: 45.0,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: Colors.grey,
width: 1.0,
),
borderRadius:
BorderRadius.circular(5.0),
),
child: Align(
alignment: Alignment.center,
child: Text(
(calculateAdjustment() * 100)
.toString() +
'%'),
),
),
const SizedBox(height: 10),
Container(
height: 45.0,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: Colors.grey,
width: 1.0,
),
borderRadius:
BorderRadius.circular(5.0),
),
child: Align(
alignment: Alignment.center,
child: Text(NumberFormat.currency(
locale: 'en-PH',
symbol: "",
).format(
calculateValueAdjustment())),
),
),
const SizedBox(height: 10),
Container(
height: 45.0,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: Colors.grey,
width: 1.0,
),
borderRadius:
BorderRadius.circular(5.0),
),
child: Align(
alignment: Alignment.center,
child: Text(NumberFormat.currency(
locale: 'en-PH',
symbol: "",
).format(calculateMarketValue())),
),
),
const SizedBox(height: 10),
Row(
children: [
Container(
width: 120,
height: 60,
padding:
const EdgeInsets.all(8.0),
child: ElevatedButton(
onPressed: () async {
final tempID =
await SharedPreferences
.getInstance();
print(tempID
.getInt('landid'));
var adjustments = ValueAdjustments(
landapprDetailsId:
tempID.getInt(
'landid')! -
1,
baseMarketval:
_unitValue
.toString(),
adjustmentFactors: _roadType +
' , ' + ' , ' +
_locPobDistance + _locPobDistance +
' km from road , ' + ' km from road , ' +
_locPobDistance + _locPobDistance +
' km from poblacion', ' km from poblacion',
adjustment: adjustment:
calculateAdjustment() calculateAdjustment()
.toString(), .toString(),
valueAdjustment: valueAdjustment:
calculateValueAdjustment() calculateValueAdjustment()
.toString(), .toString(),
marketValue: marketValue:
calculateMarketValue() calculateMarketValue()
.toString()); .toString());
context context
.read< .read<
LandValueAdjustmentsBloc>() LandValueAdjustmentsBloc>()
.add( .add(AddLandValueAdjustments(
AddLandValueAdjustments(
val_adj: val_adj:
adjustments)); adjustments));
}, },
style: ElevatedButton.styleFrom( style:
primary: Colors.black, ElevatedButton.styleFrom(
primary: Colors.black,
),
child: const Text("Submit"),
),
), ),
child: const Text("Submit"), const SizedBox(
), width:
), 5), // Use SizedBox for horizontal spacing in a Row
const SizedBox( Container(
width: width: 120,
5), // Use SizedBox for horizontal spacing in a Row height: 60,
Container( padding:
width: 120, const EdgeInsets.all(8.0),
height: 60, child: ElevatedButton(
padding: const EdgeInsets.all(8.0), onPressed: () {
child: ElevatedButton( context
onPressed: () { .read<
context LandValueAdjustmentsBloc>()
.read< .add(
LandValueAdjustmentsBloc>() const LoadLandValueAdjustments());
.add( },
const LoadLandValueAdjustments()); style:
}, ElevatedButton.styleFrom(
style: ElevatedButton.styleFrom( primary: Colors.black,
primary: Colors.black, ),
child: const Text("Cancel"),
),
), ),
child: const Text("Cancel"), ],
), )
),
], ],
) ),
], ),
), ),
), ));
), }
)); if (state is TypeOfLocationErrorState) {
} return SomethingWentWrong(
return Container(); message: onError,
}, onpressed: () {
); context
} .read<TypeOfLocationBloc>()
return Container(); .add(LoadTypeOfLocation());
}, },
); );
}
return Container();
},
);
}
if (state is LandAppraisalErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context
.read<LandAppraisalBloc>()
.add(LoadLandAppraisal());
},
);
}
return Container();
},
);
}
if (state is LandValueAdjustmentsErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context
.read<LandValueAdjustmentsBloc>()
.add(LoadLandValueAdjustments());
},
);
}
return Container();
});
} }
if (state is LandValueAdjustmentsErrorState) {
return Container(); return Text(state.error);
}); }
} return Container(
if (state is LandValueAdjustmentsErrorState) { child: Text("Land Value Adjustment"),
return Text(state.error); );
} }),
return Container( ),
child: Text("Land Value Adjustment"), );
);
});
} }
} }

View File

@ -68,23 +68,17 @@ class _AddPropertyAssessmentModal extends State<AddPropertyAssessmentModal> {
calculateAssessmentValue() { calculateAssessmentValue() {
switch (_actualUse) { switch (_actualUse) {
case "Residential": case "Residential":
return _unitValue * 0.20; return (_unitValue * 0.20).ceil();
break;
case "Agricultural": case "Agricultural":
return _unitValue * 0.40; return (_unitValue * 0.40).ceil();
break;
case "Commercial": case "Commercial":
return _unitValue * 0.50; return (_unitValue * 0.50).ceil();
break;
case "Industrial": case "Industrial":
return _unitValue * 0.50; return (_unitValue * 0.50).ceil();
break;
case "Mineral": case "Mineral":
return _unitValue * 0.50; return (_unitValue * 0.50).ceil();
break;
case "Timberland": case "Timberland":
return _unitValue * 0.20; return (_unitValue * 0.20).ceil();
break;
default: default:
} }
} }
@ -335,7 +329,7 @@ class _AddPropertyAssessmentModal extends State<AddPropertyAssessmentModal> {
onpressed: () { onpressed: () {
context context
.read<LandValueAdjustmentsBloc>() .read<LandValueAdjustmentsBloc>()
.add(LoadLandValueAdjustments()); .add(const LoadLandValueAdjustments());
}, },
); );
} }
@ -348,7 +342,7 @@ class _AddPropertyAssessmentModal extends State<AddPropertyAssessmentModal> {
onpressed: () { onpressed: () {
context context
.read<LandPropertyAssessmentBloc>() .read<LandPropertyAssessmentBloc>()
.add(LoadLandPropertyAssessment()); .add(const LoadLandPropertyAssessment());
}, },
); );
} }

View File

@ -1,5 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.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:intl/intl.dart';
import 'package:unit2/bloc/passo/land/land_appraisal/land_appraisal_bloc.dart'; import 'package:unit2/bloc/passo/land/land_appraisal/land_appraisal_bloc.dart';
import 'package:unit2/model/passo/land_appr.dart'; import 'package:unit2/model/passo/land_appr.dart';
@ -32,229 +34,249 @@ class _LandAppraisal extends State<LandAppraisal> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BlocConsumer<LandAppraisalBloc, LandAppraisalState>( return Scaffold(
listener: (context, state) { body: ProgressHUD(
// TODO: implement listener padding: const EdgeInsets.all(24),
}, builder: (context, state) { backgroundColor: Colors.black87,
final state = context.watch<LandAppraisalBloc>().state; indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
if (state is LandAppraisalLoaded) { child: BlocConsumer<LandAppraisalBloc, LandAppraisalState>(
return Column( listener: (context, state) {
children: [ if (state is LandAppraisalLoading) {
Expanded( final progress = ProgressHUD.of(context);
child: SingleChildScrollView( progress!.showWithText("Please wait...");
child: Padding( }
padding: const EdgeInsets.all(15.0), if (state is LandAppraisalLoaded) {
child: Column( final progress = ProgressHUD.of(context);
children: [ progress?.dismiss();
Container( }
margin: const EdgeInsets.only( if (state is LandAppraisalErrorState) {
left: 0, top: 20, right: 0, bottom: 10), final progress = ProgressHUD.of(context);
child: const Text('LAND APPRAISAL', progress?.dismiss();
style: TextStyle( }
fontWeight: FontWeight.bold, fontSize: 18), }, builder: (context, state) {
textAlign: TextAlign.left), final state = context.watch<LandAppraisalBloc>().state;
), if (state is LandAppraisalLoaded) {
Align( return Column(
alignment: Alignment.topRight, children: [
child: ElevatedButton( Expanded(
style: ElevatedButton.styleFrom( child: SingleChildScrollView(
backgroundColor: Colors.red, child: Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
children: [
Container(
margin: const EdgeInsets.only(
left: 0, top: 20, right: 0, bottom: 10),
child: const Text('LAND APPRAISAL',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 18),
textAlign: TextAlign.left),
), ),
onPressed: () { Align(
context alignment: Alignment.topRight,
.read<LandAppraisalBloc>() child: ElevatedButton(
.add(ShowLandAppraisal()); style: ElevatedButton.styleFrom(
}, backgroundColor: Colors.red,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Text('ADD ITEM'), // <-- Text
const SizedBox(
width: 5,
), ),
const Icon( onPressed: () {
// <-- Icon context
Icons.add, .read<LandAppraisalBloc>()
size: 24.0, .add(ShowLandAppraisal());
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Text('ADD ITEM'), // <-- Text
const SizedBox(
width: 5,
),
const Icon(
// <-- Icon
Icons.add,
size: 24.0,
),
],
), ),
], ),
), ),
), SingleChildScrollView(
), scrollDirection: Axis.horizontal,
SingleChildScrollView( child: DataTable(
scrollDirection: Axis.horizontal, // ignore: prefer_const_literals_to_create_immutables
child: DataTable( columns: [
// ignore: prefer_const_literals_to_create_immutables const DataColumn(
columns: [ label: Text('Classification'),
const DataColumn( ),
label: Text('Classification'), const DataColumn(
), label: Text('Sub-Classification'),
const DataColumn( ),
label: Text('Sub-Classification'), const DataColumn(
), label: Text('Area'),
const DataColumn( ),
label: Text('Area'), const DataColumn(
), label: Text('Unit Value'),
const DataColumn( ),
label: Text('Unit Value'), const DataColumn(
), label: Text('Base MArket Value'),
const DataColumn( ),
label: Text('Base MArket Value'), const DataColumn(
), label: Text('Action'),
const DataColumn( )
label: Text('Action'),
)
],
rows: state.land_appr.map((dataRow) {
return DataRow(
cells: [
DataCell(Text(dataRow.classification!)),
DataCell(Text(dataRow.subClass!)),
DataCell(Text(dataRow.area!)),
DataCell(Text(
((double.parse(dataRow.unitValue!)))
.toString())),
DataCell(Text(
((double.parse(dataRow.baseMarketval!)))
.toString())),
DataCell(Row(
children: [
InkWell(
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.delete,
color: Colors.white,
size: 20.0,
),
),
onTap: () {
deleteItem(dataRow.id!);
},
),
SizedBox(
width: 10,
),
InkWell(
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.edit,
color: Colors.white,
size: 20.0,
),
),
onTap: () {},
),
],
))
], ],
); rows: state.land_appr.map((dataRow) {
}).toList())) return DataRow(
cells: [
DataCell(Text(dataRow.classification!)),
DataCell(Text(dataRow.subClass!)),
DataCell(Text(dataRow.area!)),
DataCell(Text(
((double.parse(dataRow.unitValue!)))
.toString())),
DataCell(Text(((double.parse(
dataRow.baseMarketval!)))
.toString())),
DataCell(Row(
children: [
InkWell(
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.delete,
color: Colors.white,
size: 20.0,
),
),
onTap: () {
deleteItem(dataRow.id!);
},
),
SizedBox(
width: 10,
),
InkWell(
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.edit,
color: Colors.white,
size: 20.0,
),
),
onTap: () {},
),
],
))
],
);
}).toList()))
],
),
),
)),
// Padding(
// padding: const EdgeInsets.only(left: 20.0, right: 20.0),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Text(
// 'Total',
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
// ),
// Text(
// NumberFormat.currency(locale: 'en-PH', symbol: "")
// .format('1.0'),
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
// )
// ],
// ),
// ),
Padding(
padding: const EdgeInsets.all(15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
CustomButton(
icon: const Icon(Icons.chevron_left_rounded,
color: Colors.white),
onPressed: () {
{
widget.PrevBtn();
}
;
},
),
CustomButton(
icon: const Icon(Icons.chevron_right_rounded,
color: Colors.white),
onPressed: () {
{
widget.NextBtn();
}
;
},
)
],
),
),
],
);
}
if (state is LandAppraisalDeletedState) {
if (state.success) {
WidgetsBinding.instance.addPostFrameCallback((_) {
successAlert(context, "Deletion Successful",
"Extra item has been deleted successfully", () {
Navigator.of(context).pop();
context
.read<LandAppraisalBloc>()
.add(const LoadLandAppraisal());
});
});
}
}
if (state is ShowAddLandAppraisalScreen) {
return ConstrainedBox(
constraints: BoxConstraints(maxHeight: 1000.0),
child: AlertDialog(
insetPadding: EdgeInsets.symmetric(
horizontal: 20.0,
vertical: 10.0,
),
title: Text(
'ADD LAND APPRAISAL',
textAlign: TextAlign.center,
),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: AddLandAppraisalModal()),
], ],
), ),
), ),
)), );
// Padding( }
// padding: const EdgeInsets.only(left: 20.0, right: 20.0), if (state is LandAppraisalErrorState) {
// child: Row( return SomethingWentWrong(
// mainAxisAlignment: MainAxisAlignment.spaceBetween, message: onError,
// children: [ onpressed: () {
// Text( context.read<LandAppraisalBloc>().add(LoadLandAppraisal());
// 'Total', },
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), );
// ), }
// Text( return Container();
// NumberFormat.currency(locale: 'en-PH', symbol: "") }),
// .format('1.0'), ),
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), );
// )
// ],
// ),
// ),
Padding(
padding: const EdgeInsets.all(15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
CustomButton(
icon: const Icon(Icons.chevron_left_rounded,
color: Colors.white),
onPressed: () {
{
widget.PrevBtn();
}
;
},
),
CustomButton(
icon: const Icon(Icons.chevron_right_rounded,
color: Colors.white),
onPressed: () {
{
widget.NextBtn();
}
;
},
)
],
),
),
],
);
}
if (state is LandAppraisalDeletedState) {
if (state.success) {
WidgetsBinding.instance.addPostFrameCallback((_) {
successAlert(context, "Deletion Successful",
"Extra item has been deleted successfully", () {
Navigator.of(context).pop();
context.read<LandAppraisalBloc>().add(const LoadLandAppraisal());
});
});
}
}
if (state is ShowAddLandAppraisalScreen) {
return ConstrainedBox(
constraints: BoxConstraints(maxHeight: 1000.0),
child: AlertDialog(
insetPadding: EdgeInsets.symmetric(
horizontal: 20.0,
vertical: 10.0,
),
title: Text(
'ADD LAND APPRAISAL',
textAlign: TextAlign.center,
),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: AddLandAppraisalModal()),
],
),
),
);
}
if (state is LandAppraisalErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context.read<LandAppraisalBloc>().add(LoadLandAppraisal());
},
);
}
return Container();
});
} }
} }

View File

@ -1,5 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:unit2/bloc/passo/land/other_improvements/other_improvements_bloc.dart'; import 'package:unit2/bloc/passo/land/other_improvements/other_improvements_bloc.dart';
import 'package:unit2/screens/passo/Land/add_land/AddOtherImprovementModal.dart'; import 'package:unit2/screens/passo/Land/add_land/AddOtherImprovementModal.dart';
import 'package:unit2/utils/alerts.dart'; import 'package:unit2/utils/alerts.dart';
@ -30,234 +32,254 @@ class _OtherImprovementPage extends State<OtherImprovementPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BlocConsumer<OtherImprovementsBloc, OtherImprovementsState>( return Scaffold(
listener: (context, state) { body: ProgressHUD(
// TODO: implement listener padding: const EdgeInsets.all(24),
}, builder: (context, state) { backgroundColor: Colors.black87,
final state = context.watch<OtherImprovementsBloc>().state; indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
if (state is OtherImprovementLoaded) { child: BlocConsumer<OtherImprovementsBloc, OtherImprovementsState>(
return Column( listener: (context, state) {
children: [ if (state is OtherImprovementLoading) {
Expanded( final progress = ProgressHUD.of(context);
child: SingleChildScrollView( progress!.showWithText("Please wait...");
child: Padding( }
padding: const EdgeInsets.all(15.0), if (state is OtherImprovementLoaded) {
child: Column( final progress = ProgressHUD.of(context);
children: [ progress?.dismiss();
Container( }
margin: const EdgeInsets.only( if (state is OtherImprovementErrorState) {
left: 0, top: 20, right: 0, bottom: 10), final progress = ProgressHUD.of(context);
child: const Text('OTHER IMPROVEMENTS', progress?.dismiss();
style: TextStyle( }
fontWeight: FontWeight.bold, fontSize: 18), }, builder: (context, state) {
textAlign: TextAlign.left), final state = context.watch<OtherImprovementsBloc>().state;
), if (state is OtherImprovementLoaded) {
Align( return Column(
alignment: Alignment.topRight, children: [
child: ElevatedButton( Expanded(
style: ElevatedButton.styleFrom( child: SingleChildScrollView(
backgroundColor: Colors.red, child: Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
children: [
Container(
margin: const EdgeInsets.only(
left: 0, top: 20, right: 0, bottom: 10),
child: const Text('OTHER IMPROVEMENTS',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 18),
textAlign: TextAlign.left),
), ),
onPressed: () { Align(
context alignment: Alignment.topRight,
.read<OtherImprovementsBloc>() child: ElevatedButton(
.add(ShowOtherImprovement()); style: ElevatedButton.styleFrom(
}, backgroundColor: Colors.red,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Text('ADD ITEM'), // <-- Text
const SizedBox(
width: 5,
), ),
const Icon( onPressed: () {
// <-- Icon context
Icons.add, .read<OtherImprovementsBloc>()
size: 24.0, .add(ShowOtherImprovement());
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Text('ADD ITEM'), // <-- Text
const SizedBox(
width: 5,
),
const Icon(
// <-- Icon
Icons.add,
size: 24.0,
),
],
), ),
], ),
), ),
), SingleChildScrollView(
), scrollDirection: Axis.horizontal,
SingleChildScrollView( child: DataTable(
scrollDirection: Axis.horizontal, // ignore: prefer_const_literals_to_create_immutables
child: DataTable( columns: [
// ignore: prefer_const_literals_to_create_immutables const DataColumn(
columns: [ label: Text('Kinds of Tress'),
const DataColumn( ),
label: Text('Kinds of Tress'), const DataColumn(
), label: Text('Sub-Class / Age'),
const DataColumn( ),
label: Text('Sub-Class / Age'), const DataColumn(
), label: Text('Type of Tree'),
const DataColumn( ),
label: Text('Type of Tree'), const DataColumn(
), label: Text('No.'),
const DataColumn( ),
label: Text('No.'), const DataColumn(
), label: Text('No. of Productive'),
const DataColumn( ),
label: Text('No. of Productive'), const DataColumn(
), label: Text('No. of Non-Productive'),
const DataColumn( ),
label: Text('No. of Non-Productive'), const DataColumn(
), label: Text('Unit Value'),
const DataColumn( ),
label: Text('Unit Value'), const DataColumn(
), label: Text('Base Market Value'),
const DataColumn( ),
label: Text('Base Market Value'), const DataColumn(
), label: Text('Action'),
const DataColumn( )
label: Text('Action'),
)
],
rows: state.other_imp.map((dataRow) {
return DataRow(
cells: [
DataCell(Text(dataRow.kindsOfTrees!)),
DataCell(Text(dataRow.subclassAge!)),
DataCell(Text(dataRow.fruitBearing!
? "Fruit Bearing"
: "Non-Fruit Bearing")),
DataCell(Text(dataRow.quantity.toString()!)),
DataCell(
Text(dataRow.noOfProductive.toString()!)),
DataCell(Text(
dataRow.noOfNonproductive.toString()!)),
DataCell(Text(dataRow.unitValue.toString()!)),
DataCell(
Text(dataRow.baseMarketval.toString()!)),
DataCell(Row(
children: [
InkWell(
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.delete,
color: Colors.white,
size: 20.0,
),
),
onTap: () {
deleteItem(dataRow.id!);
},
),
SizedBox(
width: 10,
),
InkWell(
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.edit,
color: Colors.white,
size: 20.0,
),
),
onTap: () {},
),
],
))
], ],
); rows: state.other_imp.map((dataRow) {
}).toList())) return DataRow(
], cells: [
DataCell(Text(dataRow.kindsOfTrees!)),
DataCell(Text(dataRow.subclassAge!)),
DataCell(Text(dataRow.fruitBearing!
? "Fruit Bearing"
: "Non-Fruit Bearing")),
DataCell(
Text(dataRow.quantity.toString()!)),
DataCell(Text(
dataRow.noOfProductive.toString()!)),
DataCell(Text(dataRow.noOfNonproductive
.toString()!)),
DataCell(
Text(dataRow.unitValue.toString()!)),
DataCell(Text(
dataRow.baseMarketval.toString()!)),
DataCell(Row(
children: [
InkWell(
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.delete,
color: Colors.white,
size: 20.0,
),
),
onTap: () {
deleteItem(dataRow.id!);
},
),
SizedBox(
width: 10,
),
InkWell(
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.edit,
color: Colors.white,
size: 20.0,
),
),
onTap: () {},
),
],
))
],
);
}).toList()))
],
),
),
)),
// Padding(
// padding: const EdgeInsets.only(left: 20.0, right: 20.0),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Text(
// 'Total',
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
// ),
// Text(
// NumberFormat.currency(locale: 'en-PH', symbol: "")
// .format('1.0'),
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
// )
// ],
// ),
// ),
Padding(
padding: const EdgeInsets.all(15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
CustomButton(
icon: const Icon(Icons.chevron_left_rounded,
color: Colors.white),
onPressed: () {
{
widget.PrevBtn();
}
;
},
),
CustomButton(
icon: const Icon(Icons.chevron_right_rounded,
color: Colors.white),
onPressed: () {
{
widget.NextBtn();
}
;
},
)
],
),
),
],
);
}
if (state is OtherImprovementDeletedState) {
if (state.success) {
WidgetsBinding.instance.addPostFrameCallback((_) {
successAlert(context, "Deletion Successful",
"Extra item has been deleted successfully", () {
Navigator.of(context).pop();
context
.read<OtherImprovementsBloc>()
.add(const LoadOtherImprovement());
});
});
}
}
if (state is ShowAddOtherImprovementScreen) {
return ConstrainedBox(
constraints: BoxConstraints(maxHeight: 1000.0),
child: AlertDialog(
insetPadding: EdgeInsets.symmetric(
horizontal: 20.0,
vertical: 10.0,
),
title: Text(
'ADD OTHER IMPROVEMENTS',
textAlign: TextAlign.center,
),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [Expanded(child: AddOtherImprovementModal())],
), ),
), ),
)), );
// Padding( }
// padding: const EdgeInsets.only(left: 20.0, right: 20.0), return Container();
// child: Row( }),
// mainAxisAlignment: MainAxisAlignment.spaceBetween, ),
// children: [ );
// Text(
// 'Total',
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
// ),
// Text(
// NumberFormat.currency(locale: 'en-PH', symbol: "")
// .format('1.0'),
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
// )
// ],
// ),
// ),
Padding(
padding: const EdgeInsets.all(15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
CustomButton(
icon: const Icon(Icons.chevron_left_rounded,
color: Colors.white),
onPressed: () {
{
widget.PrevBtn();
}
;
},
),
CustomButton(
icon: const Icon(Icons.chevron_right_rounded,
color: Colors.white),
onPressed: () {
{
widget.NextBtn();
}
;
},
)
],
),
),
],
);
}
if (state is OtherImprovementDeletedState) {
if (state.success) {
WidgetsBinding.instance.addPostFrameCallback((_) {
successAlert(context, "Deletion Successful",
"Extra item has been deleted successfully", () {
Navigator.of(context).pop();
context
.read<OtherImprovementsBloc>()
.add(const LoadOtherImprovement());
});
});
}
}
if (state is ShowAddOtherImprovementScreen) {
return ConstrainedBox(
constraints: BoxConstraints(maxHeight: 1000.0),
child: AlertDialog(
insetPadding: EdgeInsets.symmetric(
horizontal: 20.0,
vertical: 10.0,
),
title: Text(
'ADD OTHER IMPROVEMENTS',
textAlign: TextAlign.center,
),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [Expanded(child: AddOtherImprovementModal())],
),
),
);
}
return Container();
});
} }
} }

View File

@ -1,5 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:unit2/bloc/passo/land/land_property_assessment/land_property_assessment_bloc.dart'; import 'package:unit2/bloc/passo/land/land_property_assessment/land_property_assessment_bloc.dart';
import 'package:unit2/screens/passo/Land/add_land/AddPropertyAssessmentModal.dart'; import 'package:unit2/screens/passo/Land/add_land/AddPropertyAssessmentModal.dart';
import 'package:unit2/utils/alerts.dart'; import 'package:unit2/utils/alerts.dart';
@ -30,214 +32,232 @@ class _LandPropertyAssessmentPage extends State<LandPropertyAssessmentPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BlocConsumer<LandPropertyAssessmentBloc, return Scaffold(
LandPropertyAssessmentState>(listener: (context, state) { body: ProgressHUD(
// TODO: implement listener padding: const EdgeInsets.all(24),
}, builder: (context, state) { backgroundColor: Colors.black87,
final state = context.watch<LandPropertyAssessmentBloc>().state; indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
if (state is LandPropertyAssessmentLoaded) { child: BlocConsumer<LandPropertyAssessmentBloc,
return Column( LandPropertyAssessmentState>(listener: (context, state) {
children: [ if (state is LandPropertyAssessmentLoading) {
Expanded( final progress = ProgressHUD.of(context);
child: SingleChildScrollView( progress!.showWithText("Please wait...");
child: Padding( }
padding: const EdgeInsets.all(15.0), if (state is LandPropertyAssessmentLoaded) {
child: Column( final progress = ProgressHUD.of(context);
children: [ progress?.dismiss();
Container( }
margin: const EdgeInsets.only( if (state is LandPropertyAssessmentErrorState) {
left: 0, top: 20, right: 0, bottom: 10), final progress = ProgressHUD.of(context);
child: const Text('PROPERTY ASSESSMENT', progress?.dismiss();
style: TextStyle( }
fontWeight: FontWeight.bold, fontSize: 18), }, builder: (context, state) {
textAlign: TextAlign.left), final state = context.watch<LandPropertyAssessmentBloc>().state;
), if (state is LandPropertyAssessmentLoaded) {
Align( return Column(
alignment: Alignment.topRight, children: [
child: ElevatedButton( Expanded(
style: ElevatedButton.styleFrom( child: SingleChildScrollView(
backgroundColor: Colors.red, child: Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
children: [
Container(
margin: const EdgeInsets.only(
left: 0, top: 20, right: 0, bottom: 10),
child: const Text('PROPERTY ASSESSMENT',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 18),
textAlign: TextAlign.left),
), ),
onPressed: () { Align(
context alignment: Alignment.topRight,
.read<LandPropertyAssessmentBloc>() child: ElevatedButton(
.add(ShowLandPropertyAssessment()); style: ElevatedButton.styleFrom(
}, backgroundColor: Colors.red,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Text('ADD ITEM'), // <-- Text
const SizedBox(
width: 5,
), ),
const Icon( onPressed: () {
// <-- Icon context
Icons.add, .read<LandPropertyAssessmentBloc>()
size: 24.0, .add(ShowLandPropertyAssessment());
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Text('ADD ITEM'), // <-- Text
const SizedBox(
width: 5,
),
const Icon(
// <-- Icon
Icons.add,
size: 24.0,
),
],
), ),
], ),
), ),
), SingleChildScrollView(
), scrollDirection: Axis.horizontal,
SingleChildScrollView( child: DataTable(
scrollDirection: Axis.horizontal, // ignore: prefer_const_literals_to_create_immutables
child: DataTable( columns: [
// ignore: prefer_const_literals_to_create_immutables const DataColumn(
columns: [ label: Text('Actual Use'),
const DataColumn( ),
label: Text('Actual Use'), const DataColumn(
), label: Text('Market Value'),
const DataColumn( ),
label: Text('Market Value'), const DataColumn(
), label: Text('Assessment Level'),
const DataColumn( ),
label: Text('Assessment Level'), const DataColumn(
), label: Text('Assessed Value'),
const DataColumn( ),
label: Text('Assessed Value'), const DataColumn(
), label: Text('Action'),
const DataColumn( )
label: Text('Action'),
)
],
rows: state.assessment.map((dataRow) {
return DataRow(
cells: [
DataCell(Text(dataRow.actualUse!)),
DataCell(Text(dataRow.marketval!)),
DataCell(
Text(dataRow.assessmentLevel! + '%')),
DataCell(Text(dataRow.assessedValue!)),
DataCell(Row(
children: [
InkWell(
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.delete,
color: Colors.white,
size: 20.0,
),
),
onTap: () {
deleteItem(dataRow.id!);
},
),
SizedBox(
width: 10,
),
InkWell(
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.edit,
color: Colors.white,
size: 20.0,
),
),
onTap: () {},
),
],
))
], ],
); rows: state.assessment.map((dataRow) {
}).toList())) return DataRow(
], cells: [
DataCell(Text(dataRow.actualUse!)),
DataCell(Text(dataRow.marketval!)),
DataCell(
Text(dataRow.assessmentLevel! + '%')),
DataCell(Text(dataRow.assessedValue!)),
DataCell(Row(
children: [
InkWell(
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.delete,
color: Colors.white,
size: 20.0,
),
),
onTap: () {
deleteItem(dataRow.id!);
},
),
SizedBox(
width: 10,
),
InkWell(
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.edit,
color: Colors.white,
size: 20.0,
),
),
onTap: () {},
),
],
))
],
);
}).toList()))
],
),
),
)),
// Padding(
// padding: const EdgeInsets.only(left: 20.0, right: 20.0),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Text(
// 'Total',
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
// ),
// Text(
// NumberFormat.currency(locale: 'en-PH', symbol: "")
// .format('1.0'),
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
// )
// ],
// ),
// ),
Padding(
padding: const EdgeInsets.all(15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
CustomButton(
icon: const Icon(Icons.chevron_left_rounded,
color: Colors.white),
onPressed: () {
{
widget.PrevBtn();
}
;
},
),
CustomButton(
icon: const Icon(Icons.chevron_right_rounded,
color: Colors.white),
onPressed: () {
{
widget.NextBtn();
}
;
},
)
],
),
),
],
);
}
if (state is LandPropertyAssessmentDeletedState) {
if (state.success) {
WidgetsBinding.instance.addPostFrameCallback((_) {
successAlert(context, "Deletion Successful",
"Extra item has been deleted successfully", () {
Navigator.of(context).pop();
context
.read<LandPropertyAssessmentBloc>()
.add(const LoadLandPropertyAssessment());
});
});
}
}
if (state is ShowAddLandPropertyAssessmentScreen) {
return ConstrainedBox(
constraints: BoxConstraints(maxHeight: 1000.0),
child: AlertDialog(
insetPadding: EdgeInsets.symmetric(
horizontal: 20.0,
vertical: 10.0,
),
title: Text(
'ADD PROPERTY ASSESSMENT',
textAlign: TextAlign.center,
),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [Expanded(child: AddPropertyAssessmentModal())],
), ),
), ),
)), );
// Padding( }
// padding: const EdgeInsets.only(left: 20.0, right: 20.0), return Container();
// child: Row( }),
// mainAxisAlignment: MainAxisAlignment.spaceBetween, ),
// children: [ );
// Text(
// 'Total',
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
// ),
// Text(
// NumberFormat.currency(locale: 'en-PH', symbol: "")
// .format('1.0'),
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
// )
// ],
// ),
// ),
Padding(
padding: const EdgeInsets.all(15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
CustomButton(
icon: const Icon(Icons.chevron_left_rounded,
color: Colors.white),
onPressed: () {
{
widget.PrevBtn();
}
;
},
),
CustomButton(
icon: const Icon(Icons.chevron_right_rounded,
color: Colors.white),
onPressed: () {
{
widget.NextBtn();
}
;
},
)
],
),
),
],
);
}
if (state is LandPropertyAssessmentDeletedState) {
if (state.success) {
WidgetsBinding.instance.addPostFrameCallback((_) {
successAlert(context, "Deletion Successful",
"Extra item has been deleted successfully", () {
Navigator.of(context).pop();
context
.read<LandPropertyAssessmentBloc>()
.add(const LoadLandPropertyAssessment());
});
});
}
}
if (state is ShowAddLandPropertyAssessmentScreen) {
return ConstrainedBox(
constraints: BoxConstraints(maxHeight: 1000.0),
child: AlertDialog(
insetPadding: EdgeInsets.symmetric(
horizontal: 20.0,
vertical: 10.0,
),
title: Text(
'ADD PROPERTY ASSESSMENT',
textAlign: TextAlign.center,
),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [Expanded(child: AddPropertyAssessmentModal())],
),
),
);
}
return Container();
});
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:unit2/bloc/passo/land/land_value_adjustments/land_value_adjustments_bloc.dart'; import 'package:unit2/bloc/passo/land/land_value_adjustments/land_value_adjustments_bloc.dart';
import 'package:unit2/screens/passo/Land/add_land/AddLandValueAdjustmentModal.dart'; import 'package:unit2/screens/passo/Land/add_land/AddLandValueAdjustmentModal.dart';
import 'package:unit2/utils/alerts.dart'; import 'package:unit2/utils/alerts.dart';
@ -14,14 +16,6 @@ class ValueAdjustmentPage extends StatefulWidget {
} }
class _ValueAdjustmentPage extends State<ValueAdjustmentPage> { class _ValueAdjustmentPage extends State<ValueAdjustmentPage> {
// double _totalMarketValue(items) {
// double total = 0;
// items.forEach((row) {
// total += double.parse(row);
// });
// return total;
// }
void deleteItem(int itemId) { void deleteItem(int itemId) {
context context
.read<LandValueAdjustmentsBloc>() .read<LandValueAdjustmentsBloc>()
@ -30,217 +24,237 @@ class _ValueAdjustmentPage extends State<ValueAdjustmentPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BlocConsumer<LandValueAdjustmentsBloc, LandValueAdjustmentsState>( return Scaffold(
listener: (context, state) { body: ProgressHUD(
// TODO: implement listener padding: const EdgeInsets.all(24),
}, builder: (context, state) { backgroundColor: Colors.black87,
final state = context.watch<LandValueAdjustmentsBloc>().state; indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
if (state is LandValueAdjustmentsLoaded) { child:
return Column( BlocConsumer<LandValueAdjustmentsBloc, LandValueAdjustmentsState>(
children: [ listener: (context, state) {
Expanded( if (state is LandValueAdjustmentsLoading) {
child: SingleChildScrollView( final progress = ProgressHUD.of(context);
child: Padding( progress!.showWithText("Please wait...");
padding: const EdgeInsets.all(15.0), }
child: Column( if (state is LandValueAdjustmentsLoaded) {
children: [ final progress = ProgressHUD.of(context);
Container( progress?.dismiss();
margin: const EdgeInsets.only( }
left: 0, top: 20, right: 0, bottom: 10), if (state is LandValueAdjustmentsErrorState) {
child: const Text('VALUE ADJUSTMENTS', final progress = ProgressHUD.of(context);
style: TextStyle( progress?.dismiss();
fontWeight: FontWeight.bold, fontSize: 18), }
textAlign: TextAlign.left), }, builder: (context, state) {
), final state = context.watch<LandValueAdjustmentsBloc>().state;
Align( if (state is LandValueAdjustmentsLoaded) {
alignment: Alignment.topRight, return Column(
child: ElevatedButton( children: [
style: ElevatedButton.styleFrom( Expanded(
backgroundColor: Colors.red, child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
children: [
Container(
margin: const EdgeInsets.only(
left: 0, top: 20, right: 0, bottom: 10),
child: const Text('VALUE ADJUSTMENTS',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 18),
textAlign: TextAlign.left),
), ),
onPressed: () { Align(
context alignment: Alignment.topRight,
.read<LandValueAdjustmentsBloc>() child: ElevatedButton(
.add(ShowLandValueAdjustments()); style: ElevatedButton.styleFrom(
}, backgroundColor: Colors.red,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Text('ADD ITEM'), // <-- Text
const SizedBox(
width: 5,
), ),
const Icon( onPressed: () {
// <-- Icon context
Icons.add, .read<LandValueAdjustmentsBloc>()
size: 24.0, .add(ShowLandValueAdjustments());
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Text('ADD ITEM'), // <-- Text
const SizedBox(
width: 5,
),
const Icon(
// <-- Icon
Icons.add,
size: 24.0,
),
],
), ),
], ),
), ),
), SingleChildScrollView(
), scrollDirection: Axis.horizontal,
SingleChildScrollView( child: DataTable(
scrollDirection: Axis.horizontal, // ignore: prefer_const_literals_to_create_immutables
child: DataTable( columns: [
// ignore: prefer_const_literals_to_create_immutables const DataColumn(
columns: [ label: Text('Base Market Value'),
const DataColumn( ),
label: Text('Base Market Value'), const DataColumn(
), label: Text('Adjustment Factors'),
const DataColumn( ),
label: Text('Adjustment Factors'), const DataColumn(
), label: Text('% Adjustment'),
const DataColumn( ),
label: Text('% Adjustment'), const DataColumn(
), label: Text('Value Adjustment'),
const DataColumn( ),
label: Text('Value Adjustment'), const DataColumn(
), label: Text('Market Value'),
const DataColumn( ),
label: Text('Market Value'), const DataColumn(
), label: Text('Action'),
const DataColumn( )
label: Text('Action'),
)
],
rows: state.val_adj.map((dataRow) {
return DataRow(
cells: [
DataCell(Text(dataRow.baseMarketval!)),
DataCell(Text(dataRow.adjustmentFactors!)),
DataCell(Text(dataRow.adjustment!)),
DataCell(Text(dataRow.valueAdjustment!)),
DataCell(Text(dataRow.marketValue!)),
DataCell(Row(
children: [
InkWell(
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.delete,
color: Colors.white,
size: 20.0,
),
),
onTap: () {
deleteItem(dataRow.id!);
},
),
SizedBox(
width: 10,
),
InkWell(
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.edit,
color: Colors.white,
size: 20.0,
),
),
onTap: () {},
),
],
))
], ],
); rows: state.val_adj.map((dataRow) {
}).toList())) return DataRow(
], cells: [
DataCell(Text(dataRow.baseMarketval!)),
DataCell(
Text(dataRow.adjustmentFactors!)),
DataCell(Text(dataRow.adjustment!)),
DataCell(Text(dataRow.valueAdjustment!)),
DataCell(Text(dataRow.marketValue!)),
DataCell(Row(
children: [
InkWell(
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.delete,
color: Colors.white,
size: 20.0,
),
),
onTap: () {
deleteItem(dataRow.id!);
},
),
SizedBox(
width: 10,
),
InkWell(
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.edit,
color: Colors.white,
size: 20.0,
),
),
onTap: () {},
),
],
))
],
);
}).toList()))
],
),
),
)),
// Padding(
// padding: const EdgeInsets.only(left: 20.0, right: 20.0),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Text(
// 'Total',
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
// ),
// Text(
// NumberFormat.currency(locale: 'en-PH', symbol: "")
// .format('1.0'),
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
// )
// ],
// ),
// ),
Padding(
padding: const EdgeInsets.all(15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
CustomButton(
icon: const Icon(Icons.chevron_left_rounded,
color: Colors.white),
onPressed: () {
{
widget.PrevBtn();
}
;
},
),
CustomButton(
icon: const Icon(Icons.chevron_right_rounded,
color: Colors.white),
onPressed: () {
{
widget.NextBtn();
}
;
},
)
],
),
),
],
);
}
if (state is LandValueAdjustmentsDeletedState) {
if (state.success) {
WidgetsBinding.instance.addPostFrameCallback((_) {
successAlert(context, "Deletion Successful",
"Extra item has been deleted successfully", () {
Navigator.of(context).pop();
context
.read<LandValueAdjustmentsBloc>()
.add(const LoadLandValueAdjustments());
});
});
}
}
if (state is ShowAddLandValueAdjustmentsScreen) {
return ConstrainedBox(
constraints: BoxConstraints(maxHeight: 1000.0),
child: AlertDialog(
insetPadding: EdgeInsets.symmetric(
horizontal: 20.0,
vertical: 10.0,
),
title: Text(
'ADD VALUE ADJUSTMENTS',
textAlign: TextAlign.center,
),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [Expanded(child: AddLandValueAdjustmentModal())],
), ),
), ),
)), );
// Padding( }
// padding: const EdgeInsets.only(left: 20.0, right: 20.0), return Container();
// child: Row( }),
// mainAxisAlignment: MainAxisAlignment.spaceBetween, ),
// children: [ );
// Text(
// 'Total',
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
// ),
// Text(
// NumberFormat.currency(locale: 'en-PH', symbol: "")
// .format('1.0'),
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
// )
// ],
// ),
// ),
Padding(
padding: const EdgeInsets.all(15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
CustomButton(
icon: const Icon(Icons.chevron_left_rounded,
color: Colors.white),
onPressed: () {
{
widget.PrevBtn();
}
;
},
),
CustomButton(
icon: const Icon(Icons.chevron_right_rounded,
color: Colors.white),
onPressed: () {
{
widget.NextBtn();
}
;
},
)
],
),
),
],
);
}
if (state is LandValueAdjustmentsDeletedState) {
if (state.success) {
WidgetsBinding.instance.addPostFrameCallback((_) {
successAlert(context, "Deletion Successful",
"Extra item has been deleted successfully", () {
Navigator.of(context).pop();
context
.read<LandValueAdjustmentsBloc>()
.add(const LoadLandValueAdjustments());
});
});
}
}
if (state is ShowAddLandValueAdjustmentsScreen) {
return ConstrainedBox(
constraints: BoxConstraints(maxHeight: 1000.0),
child: AlertDialog(
insetPadding: EdgeInsets.symmetric(
horizontal: 20.0,
vertical: 10.0,
),
title: Text(
'ADD VALUE ADJUSTMENTS',
textAlign: TextAlign.center,
),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [Expanded(child: AddLandValueAdjustmentModal())],
),
),
);
}
return Container();
});
} }
} }

View File

@ -70,22 +70,22 @@ class _AddPropertyAssessmentEditModal
calculateAssessmentValue() { calculateAssessmentValue() {
switch (_actualUse) { switch (_actualUse) {
case "Residential": case "Residential":
return _unitValue * 0.20; return (_unitValue * 0.20).ceil();
break; break;
case "Agricultural": case "Agricultural":
return _unitValue * 0.40; return (_unitValue * 0.40).ceil();
break; break;
case "Commercial": case "Commercial":
return _unitValue * 0.50; return (_unitValue * 0.50).ceil();
break; break;
case "Industrial": case "Industrial":
return _unitValue * 0.50; return (_unitValue * 0.50).ceil();
break; break;
case "Mineral": case "Mineral":
return _unitValue * 0.50; return (_unitValue * 0.50).ceil();
break; break;
case "Timberland": case "Timberland":
return _unitValue * 0.20; return (_unitValue * 0.20).ceil();
break; break;
default: default:
} }
@ -278,7 +278,7 @@ class _AddPropertyAssessmentEditModal
child: ElevatedButton( child: ElevatedButton(
onPressed: () async { onPressed: () async {
var assessment = LandPropertyAssessment( var assessment = LandPropertyAssessment(
landapprDetailsId: widget.tempId, landapprDetailsId: 35,
actualUse: _actualUse, actualUse: _actualUse,
marketval: _unitValue.toString(), marketval: _unitValue.toString(),
assessmentLevel: _assessmentLevel, assessmentLevel: _assessmentLevel,
@ -287,7 +287,7 @@ class _AddPropertyAssessmentEditModal
.toString(), .toString(),
totalMarketval: '0', totalMarketval: '0',
totalAssessedval: '0'); totalAssessedval: '0');
print(assessment.toJson());
context context
.read<LandPropertyAssessmentBloc>() .read<LandPropertyAssessmentBloc>()
.add(AddLandPropertyAssessment( .add(AddLandPropertyAssessment(

View File

@ -266,10 +266,8 @@ class _LandAppraisalEdit extends State<LandAppraisalEdit> {
alignment: Alignment.topCenter, alignment: Alignment.topCenter,
child: Container( child: Container(
child: ConstrainedBox( child: ConstrainedBox(
constraints: BoxConstraints(maxHeight: 500), constraints: const BoxConstraints(maxHeight: 500),
child: Container( child: AddLandAppraisalEditModal(widget.faasId),
child: AddLandAppraisalEditModal(widget.faasId),
),
), ),
), ),
), ),
@ -283,7 +281,7 @@ class _LandAppraisalEdit extends State<LandAppraisalEdit> {
message: onError, message: onError,
onpressed: () { onpressed: () {
context.read<LandAppraisalBloc>().add(LoadLandAppraisalEdit( context.read<LandAppraisalBloc>().add(LoadLandAppraisalEdit(
land_appr: <LandAppr>[], id: widget.faasId!)); land_appr: const <LandAppr>[], id: widget.faasId!));
}, },
); );
} }

View File

@ -53,6 +53,7 @@ import 'package:unit2/screens/passo/Test%20Envi/speed_dial.dart';
import 'package:unit2/theme-data.dart/colors.dart'; import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/global_context.dart'; import 'package:unit2/utils/global_context.dart';
import 'package:unit2/utils/text_container.dart'; import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/empty_data.dart';
import 'package:unit2/widgets/error_state.dart'; import 'package:unit2/widgets/error_state.dart';
import 'package:flutter_speed_dial/flutter_speed_dial.dart'; import 'package:flutter_speed_dial/flutter_speed_dial.dart';
@ -72,6 +73,11 @@ class BuildingHome extends StatelessWidget {
context.read<PropertyInfoBloc>().add(DeleteBuildingFaas(id: itemId)); context.read<PropertyInfoBloc>().add(DeleteBuildingFaas(id: itemId));
} }
void triggerBlocEvent() {
final myBloc = BlocProvider.of<PropertyInfoBloc>(context);
myBloc.add(LoadPropertyInfo());
}
return Scaffold( return Scaffold(
body: ProgressHUD( body: ProgressHUD(
backgroundColor: Colors.black87, backgroundColor: Colors.black87,
@ -101,24 +107,30 @@ class BuildingHome extends StatelessWidget {
}, },
builder: (context, state) { builder: (context, state) {
if (state is PropertyInfoLoaded) { if (state is PropertyInfoLoaded) {
List<PropertyInfo> propertyList = state.property_info; if (state.property_info.isNotEmpty) {
return Container( List<PropertyInfo> propertyList = state.property_info;
padding: const EdgeInsets.symmetric(horizontal: 12), return Container(
child: Column( padding: const EdgeInsets.symmetric(horizontal: 12),
children: [ child: Column(
Expanded( children: [
child: ListView.builder( Expanded(
shrinkWrap: true, child: ListView.builder(
itemCount: propertyList.length, shrinkWrap: true,
itemBuilder: (BuildContext context, int index) { itemCount: propertyList.length,
return _listCard(propertyList[index], context, itemBuilder: (BuildContext context, int index) {
index, deleteItem); return _listCard(propertyList[index], context,
}, index, deleteItem);
},
),
), ),
), ],
], ),
), );
); } else {
return const EmptyData(
message:
"You don't have any building faas added. Please click + to add");
}
} }
if (state is PropertyInfoErrorState) { if (state is PropertyInfoErrorState) {
return SomethingWentWrong( return SomethingWentWrong(
@ -206,7 +218,7 @@ class BuildingHome extends StatelessWidget {
BlocProvider( BlocProvider(
create: (context) => create: (context) =>
MemorandaBloc()..add(LoadMemoranda())), MemorandaBloc()..add(LoadMemoranda())),
], child: AddBuilding()); ], child: AddBuilding(triggerBlocEvent));
})); }));
}), }),
SpeedDialChild( SpeedDialChild(

View File

@ -5,17 +5,10 @@ import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:unit2/bloc/passo/barangay/barangay_bloc.dart'; import 'package:unit2/bloc/passo/barangay/barangay_bloc.dart';
import 'package:unit2/bloc/passo/bulding/additional_item/additional_item_bloc.dart'; import 'package:unit2/bloc/passo/bulding/additional_item/additional_item_bloc.dart';
import 'package:unit2/bloc/passo/bulding/additional_items_edit/additional_items_edit_bloc.dart';
import 'package:unit2/bloc/passo/bulding/class_components/class_components_bloc.dart'; import 'package:unit2/bloc/passo/bulding/class_components/class_components_bloc.dart';
import 'package:unit2/bloc/passo/bulding/general_description/general_description_bloc.dart';
import 'package:unit2/bloc/passo/bulding/landref/landref_bloc.dart';
import 'package:unit2/bloc/passo/bulding/location/location_bloc.dart';
import 'package:unit2/bloc/passo/bulding/property_appraisal/property_appraisal_bloc.dart'; import 'package:unit2/bloc/passo/bulding/property_appraisal/property_appraisal_bloc.dart';
import 'package:unit2/bloc/passo/bulding/property_appraisal_edit/property_appraisal_edit_bloc.dart';
import 'package:unit2/bloc/passo/bulding/property_assessment/property_assessment_bloc.dart'; import 'package:unit2/bloc/passo/bulding/property_assessment/property_assessment_bloc.dart';
import 'package:unit2/bloc/passo/bulding/property_assessment_edit/property_assessment_edit_bloc.dart';
import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart'; import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart';
import 'package:unit2/bloc/passo/bulding/structural_material/structural_material_bloc.dart';
import 'package:unit2/bloc/passo/bulding/unit_construct/unit_construct_bloc.dart'; import 'package:unit2/bloc/passo/bulding/unit_construct/unit_construct_bloc.dart';
import 'package:unit2/bloc/passo/land/land_appraisal/land_appraisal_bloc.dart'; import 'package:unit2/bloc/passo/land/land_appraisal/land_appraisal_bloc.dart';
import 'package:unit2/bloc/passo/land/land_boundaries_edit/land_boundaries_edit_bloc.dart'; import 'package:unit2/bloc/passo/land/land_boundaries_edit/land_boundaries_edit_bloc.dart';
@ -38,42 +31,40 @@ import 'package:unit2/bloc/passo/municipality/municipality_bloc.dart';
import 'package:unit2/bloc/passo/signatories/signatories_bloc.dart'; import 'package:unit2/bloc/passo/signatories/signatories_bloc.dart';
import 'package:unit2/bloc/user/user_bloc.dart'; import 'package:unit2/bloc/user/user_bloc.dart';
import 'package:unit2/model/passo/additional_items.dart';
import 'package:unit2/model/passo/general_description.dart';
import 'package:unit2/model/passo/land_appr.dart'; import 'package:unit2/model/passo/land_appr.dart';
import 'package:unit2/model/passo/land_ext.dart'; import 'package:unit2/model/passo/land_ext.dart';
import 'package:unit2/model/passo/land_property_assessment.dart'; import 'package:unit2/model/passo/land_property_assessment.dart';
import 'package:unit2/model/passo/land_property_boundaries.dart'; import 'package:unit2/model/passo/land_property_boundaries.dart';
import 'package:unit2/model/passo/land_property_loc.dart'; import 'package:unit2/model/passo/land_property_loc.dart';
import 'package:unit2/model/passo/land_property_owner.dart'; import 'package:unit2/model/passo/land_property_owner.dart';
import 'package:unit2/model/passo/land_ref.dart';
import 'package:unit2/model/passo/land_value_adjustment.dart'; import 'package:unit2/model/passo/land_value_adjustment.dart';
import 'package:unit2/model/passo/other_improvements.dart'; import 'package:unit2/model/passo/other_improvements.dart';
import 'package:unit2/model/passo/property_appraisal.dart'; import 'package:unit2/model/passo/property_appraisal.dart';
import 'package:unit2/model/passo/property_appraisal_edit.dart';
import 'package:unit2/model/passo/property_assessment_edit.dart';
import 'package:unit2/model/passo/property_info.dart';
import 'package:unit2/model/passo/structural_materials_ii.dart';
import 'package:unit2/model/passo/structureMaterial.dart';
import 'package:unit2/model/profile/basic_information/primary-information.dart'; import 'package:unit2/model/profile/basic_information/primary-information.dart';
import 'package:unit2/screens/passo/Building/add_building.dart'; import 'package:unit2/screens/passo/Building/add_building.dart';
import 'package:unit2/screens/passo/Building/edit_building.dart';
import 'package:unit2/screens/passo/Land/add_land.dart'; import 'package:unit2/screens/passo/Land/add_land.dart';
import 'package:unit2/screens/passo/Land/edit_land.dart'; import 'package:unit2/screens/passo/Land/edit_land.dart';
import 'package:unit2/screens/passo/Test%20Envi/multi_dropdown.dart';
import 'package:unit2/screens/passo/Test%20Envi/speed_dial.dart';
import 'package:unit2/theme-data.dart/colors.dart'; import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/alerts.dart';
import 'package:unit2/utils/text_container.dart'; import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/empty_data.dart';
import 'package:unit2/widgets/error_state.dart'; import 'package:unit2/widgets/error_state.dart';
import 'package:flutter_speed_dial/flutter_speed_dial.dart'; import 'package:flutter_speed_dial/flutter_speed_dial.dart';
import '../../model/passo/bldg_loc.dart';
class LandHome extends StatelessWidget { class LandHome extends StatelessWidget {
const LandHome({super.key}); const LandHome({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
void deleteItem(int itemId) {
context.read<LandPropertyOwnerInfoBloc>().add(DeleteLandFaas(id: itemId));
}
void triggerBlocEvent() {
final myBloc = BlocProvider.of<PropertyInfoBloc>(context);
myBloc.add(LoadPropertyInfo());
}
int? profileId; int? profileId;
String? token; String? token;
Profile profile; Profile profile;
@ -104,24 +95,30 @@ class LandHome extends StatelessWidget {
}, },
builder: (context, state) { builder: (context, state) {
if (state is LandLoaded) { if (state is LandLoaded) {
List<LandPropertyOwner> propertyList = state.land; if (state.land.isNotEmpty) {
return Container( List<LandPropertyOwner> propertyList = state.land;
padding: const EdgeInsets.symmetric(horizontal: 12), return Container(
child: Column( padding: const EdgeInsets.symmetric(horizontal: 12),
children: [ child: Column(
Expanded( children: [
child: ListView.builder( Expanded(
shrinkWrap: true, child: ListView.builder(
itemCount: propertyList.length, shrinkWrap: true,
itemBuilder: (BuildContext context, int index) { itemCount: propertyList.length,
return _listCard( itemBuilder: (BuildContext context, int index) {
propertyList[index], context, index); return _listCard(propertyList[index], context,
}, index, deleteItem);
},
),
), ),
), ],
], ),
), );
); } else {
return const EmptyData(
message:
"You don't have any land faas added. Please click + to add");
}
} }
if (state is LandErrorState) { if (state is LandErrorState) {
return SomethingWentWrong( return SomethingWentWrong(
@ -133,6 +130,20 @@ class LandHome extends StatelessWidget {
}, },
); );
} }
if (state is LandFaasDeletedState) {
if (state.success) {
WidgetsBinding.instance.addPostFrameCallback((_) {
successAlert(context, "Deletion Successful",
"Land FAAS Data has been deleted successfully", () {
Navigator.of(context).pop();
context
.read<LandPropertyOwnerInfoBloc>()
.add(const LoadLand());
});
});
}
}
return Container(); return Container();
}, },
); );
@ -195,7 +206,7 @@ class LandHome extends StatelessWidget {
BlocProvider( BlocProvider(
create: (context) => create: (context) =>
MemorandaBloc()..add(LoadMemoranda())), MemorandaBloc()..add(LoadMemoranda())),
], child: AddBuilding()); ], child: AddBuilding(triggerBlocEvent));
})); }));
}), }),
SpeedDialChild( SpeedDialChild(
@ -281,7 +292,7 @@ class LandHome extends StatelessWidget {
} }
} }
Card _listCard(LandPropertyOwner property_info, context, index) { Card _listCard(LandPropertyOwner property_info, context, index, deleteItem) {
return Card( return Card(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
@ -417,7 +428,13 @@ Card _listCard(LandPropertyOwner 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,
),
], ],
), ),
), ),

View File

@ -72,4 +72,29 @@ class LandServices {
} }
return response; return response;
} }
Future<http.Response> remove(id) async {
String path = Url.instance.getLandOwnerInfo();
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();
}
}
} }

View File

@ -0,0 +1,26 @@
import 'package:sqflite/sqflite.dart' as sql;
class SQLHeper {
static Future<void> createTables(sql.Database database) async {
await database.execute("""CREATE TABLE property_info (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
assessed_by_id TEXT,
assessed_by_name TEXT,
date_created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
date_modified TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
trans_code TEXT,
tdn TEXT,
pin TEXT,
owner TEXT,
address TEXT,
telno TEXT,
tin TEXT,
admin_user TEXT,
admin_address TEXT,
admin_telno TEXT,
admin_tin TEXT,
faas_type TEXT
)
""");
}
}

View File

@ -5,17 +5,17 @@ class Url {
String host() { String host() {
// return '192.168.10.183:3000'; // return '192.168.10.183:3000';
return 'agusandelnorte.gov.ph'; // return 'agusandelnorte.gov.ph';
// return "192.168.10.219:3000"; // return "192.168.10.219:3000";
// return "192.168.10.241"; // return "192.168.10.241";
// return "192.168.10.221:3004"; // return "192.168.10.221:3004";
// return "playweb.agusandelnorte.gov.ph"; return "playweb.agusandelnorte.gov.ph";
// return 'devapi.agusandelnorte.gov.ph:3004'; // return 'devapi.agusandelnorte.gov.ph:3004';
// return "192.168.10.218:8000"; // return "192.168.10.218:8000";
} }
String prefixHost() { String prefixHost() {
return "https"; return "https";
// return "http"; // return "http";
} }
@ -347,7 +347,8 @@ class Url {
String getBarangays() { String getBarangays() {
return "/api/web_app/location/barangay/"; return "/api/web_app/location/barangay/";
} }
String getPurok(){
String getPurok() {
return "/api/web_app/location/purok/"; return "/api/web_app/location/purok/";
} }

View File

@ -989,6 +989,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.8.3" version: "1.8.3"
path_drawing:
dependency: transitive
description:
name: path_drawing
sha256: bbb1934c0cbb03091af082a6389ca2080345291ef07a5fa6d6e078ba8682f977
url: "https://pub.dev"
source: hosted
version: "1.0.1"
path_parsing: path_parsing:
dependency: transitive dependency: transitive
description: description:
@ -1411,21 +1419,21 @@ packages:
source: hosted source: hosted
version: "1.10.0" version: "1.10.0"
sqflite: sqflite:
dependency: transitive dependency: "direct main"
description: description:
name: sqflite name: sqflite
sha256: b4d6710e1200e96845747e37338ea8a819a12b51689a3bcf31eff0003b37a0b9 sha256: "591f1602816e9c31377d5f008c2d9ef7b8aca8941c3f89cc5fd9d84da0c38a9a"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.8+4" version: "2.3.0"
sqflite_common: sqflite_common:
dependency: transitive dependency: transitive
description: description:
name: sqflite_common name: sqflite_common
sha256: "8f7603f3f8f126740bc55c4ca2d1027aab4b74a1267a3e31ce51fe40e3b65b8f" sha256: "1b92f368f44b0dee2425bb861cfa17b6f6cf3961f762ff6f941d20b33355660a"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.4.5+1" version: "2.5.0"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
@ -1755,5 +1763,10 @@ packages:
source: hosted source: hosted
version: "3.1.2" version: "3.1.2"
sdks: sdks:
<<<<<<< HEAD
dart: ">=3.1.0-185.0.dev <4.0.0"
flutter: ">=3.7.0"
=======
dart: ">=3.1.0 <4.0.0" dart: ">=3.1.0 <4.0.0"
flutter: ">=3.10.0" flutter: ">=3.10.0"
>>>>>>> develop

View File

@ -96,6 +96,9 @@ dependencies:
syncfusion_flutter_pdfviewer: ^23.1.36 syncfusion_flutter_pdfviewer: ^23.1.36
url_launcher: ^6.1.14 url_launcher: ^6.1.14
share_plus: ^7.1.0 share_plus: ^7.1.0
animated_splash_screen: ^1.3.0
sqflite: ^2.3.0
device_info_plus: ^9.0.3 device_info_plus: ^9.0.3
better_open_file: ^3.6.4 better_open_file: ^3.6.4
dependency_overrides: dependency_overrides: