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 {
emit(AdditionalItemsLoading());
try {
// final tempID = await SharedPreferences.getInstance();
// print(tempID.getInt('tempid'));
// final additionalItem = await GetAdditionalItems.getAdditionalItems(
// tempID.getInt('tempid'));
emit(AdditionalItemsLoaded(globalAdditionalItems));
} catch (e) {
emit(AdditionalItemsErrorState(e.toString()));
@ -42,7 +37,7 @@ class AdditionalItemBloc
emit(AdditionalItemsLoaded(globalAdditionalItems));
} else {
emit(AdditionalItemsErrorState('error'));
emit(const AdditionalItemsErrorState('error'));
}
} catch (e) {
emit(AdditionalItemsErrorState(e.toString()));
@ -56,7 +51,7 @@ class AdditionalItemBloc
if (response.statusCode == 200) {
globalAdditionalItems
.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
extends Bloc<PropertyAppraisalEvent, PropertyAppraisalState> {
PropertyAppraisalBloc() : super(PropertyAppraisalInitial()) {
PropertyAppraisalBloc() : super(PropertyAppraisalLoading()) {
List<PropertyAppraisal> globalPropertyAppraisal = [];
on<LoadPropertyAppraisal>((event, emit) async {
emit(PropertyAppraisalLoading());
try {
final appraisal = await PropertyAppraisalServices.instance.fetch();
print(appraisal);
emit(PropertyAppraisalLoaded(appraisal));
// final appraisal = await PropertyAppraisalServices.instance.fetch();
// print(appraisal);
emit(PropertyAppraisalLoaded(PropertyAppraisal()));
} catch (e) {
emit(PropertyAppraisalErrorState(e.toString()));
}

View File

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

View File

@ -59,6 +59,11 @@ class LandPropertyOwnerInfoBloc
print(event.land_loc.id!);
print('Land LOc');
print(response.statusCode);
if (response.statusCode == 200) {
emit(ShowLandLocSuccessAlertState());
} else {
emit(ShowLandLocErrorAlertState());
}
});
on<UpdateLandBoundaries>((event, emit) async {
@ -67,6 +72,21 @@ class LandPropertyOwnerInfoBloc
.update(event.land_boundaries, event.land_boundaries.id))!;
print('Land Boundaries');
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
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
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>();
class AddBuilding extends StatefulWidget {
Function triggerBlocEvent;
AddBuilding(this.triggerBlocEvent);
@override
_AddBuilding createState() => _AddBuilding();
}
@ -293,6 +295,7 @@ class _AddBuilding extends State<AddBuilding> {
}
void onSAveAll() {
return Navigator.of(context).pop();
Navigator.of(context).pop();
widget.triggerBlocEvent();
}
}

View File

@ -3,6 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:intl/intl.dart';
import 'package:shared_preferences/shared_preferences.dart';
@ -509,7 +510,37 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocConsumer<AdditionalItemBloc, AdditionalItemState>(
child: BlocConsumer<PropertyAppraisalBloc, PropertyAppraisalState>(
listener: (context, state) {
if (state is PropertyAppraisalLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
print('app_load');
}
if (state is PropertyAppraisalErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
if (state is PropertyAppraisalLoaded) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
if (state is ShowPropertyAppraisalSuccessAlertState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
widget.NextBtn();
}
if (state is ShowPropertyAppraisalErrorAlertState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
Fluttertoast.showToast(
msg: "Slow internet connection, please try again!");
}
},
builder: (context, state) {
if (state is PropertyAppraisalLoaded) {
return BlocConsumer<AdditionalItemBloc, AdditionalItemState>(
listener: (context, state) {
if (state is AdditionalItemsLoading) {
final progress = ProgressHUD.of(context);
@ -536,7 +567,8 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
left: 0, top: 20, right: 0, bottom: 20),
child: const Text('PROPERTY APPRAISAL',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 18),
fontWeight: FontWeight.bold,
fontSize: 18),
textAlign: TextAlign.left),
),
Row(
@ -546,7 +578,8 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
child: Text(
"Unit Construction Cost",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 13),
fontWeight: FontWeight.bold,
fontSize: 13),
textAlign: TextAlign.left,
),
),
@ -568,7 +601,8 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
child: Text(
"Building Core",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 13),
fontWeight: FontWeight.bold,
fontSize: 13),
textAlign: TextAlign.left,
),
),
@ -588,14 +622,15 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
child: Text(
"Sub-total",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 13),
fontWeight: FontWeight.bold,
fontSize: 13),
textAlign: TextAlign.left,
),
),
Container(
child: Text(
(double.parse(formKey
.currentState!.value['total_area']) *
(double.parse(formKey.currentState!
.value['total_area']) *
double.parse(formKey.currentState!
.value['bldg_type'].unitValue))
.toString(),
@ -612,7 +647,8 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
child: Text(
"Cost of Additional Items",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 13),
fontWeight: FontWeight.bold,
fontSize: 13),
textAlign: TextAlign.left,
),
),
@ -632,13 +668,15 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
child: Text(
"Sub-total",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 13),
fontWeight: FontWeight.bold,
fontSize: 13),
textAlign: TextAlign.left,
),
),
Container(
child: Text(
calculateAdditionalItems(state.items).toString(),
calculateAdditionalItems(state.items)
.toString(),
textAlign: TextAlign.right,
),
)
@ -652,7 +690,8 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
child: Text(
"Total Construction Cost",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 13),
fontWeight: FontWeight.bold,
fontSize: 13),
textAlign: TextAlign.left,
),
),
@ -661,8 +700,10 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
calculateTotalConstructionCost(
(double.parse(formKey.currentState!
.value['total_area']) *
double.parse(formKey.currentState!
.value['bldg_type'].unitValue)),
double.parse(formKey
.currentState!
.value['bldg_type']
.unitValue)),
state.items)
.toString(),
textAlign: TextAlign.right,
@ -678,7 +719,8 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
child: Text(
"Depreciation Rate",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 13),
fontWeight: FontWeight.bold,
fontSize: 13),
textAlign: TextAlign.left,
),
),
@ -688,7 +730,8 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
child: FormBuilderTextField(
name: 'depRate',
decoration: normalTextFieldStyle("", ""),
validator: FormBuilderValidators.compose([]),
validator:
FormBuilderValidators.compose([]),
onChanged: (value) {
setState(() {
depRate = double.parse(value!);
@ -706,7 +749,8 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
child: Text(
"Depreciation Cost",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 13),
fontWeight: FontWeight.bold,
fontSize: 13),
textAlign: TextAlign.left,
),
),
@ -715,8 +759,10 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
calculateDepCost(
(double.parse(formKey.currentState!
.value['total_area']) *
double.parse(formKey.currentState!
.value['bldg_type'].unitValue)),
double.parse(formKey
.currentState!
.value['bldg_type']
.unitValue)),
state.items,
depRate)
.toString(),
@ -733,7 +779,8 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
child: Text(
"Total % Depreciation",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 13),
fontWeight: FontWeight.bold,
fontSize: 13),
textAlign: TextAlign.left,
),
),
@ -753,7 +800,8 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
child: Text(
"Market Value",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 13),
fontWeight: FontWeight.bold,
fontSize: 13),
textAlign: TextAlign.left,
),
),
@ -762,8 +810,10 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
calculateMarketValue(
(double.parse(formKey.currentState!
.value['total_area']) *
double.parse(formKey.currentState!
.value['bldg_type'].unitValue)),
double.parse(formKey
.currentState!
.value['bldg_type']
.unitValue)),
state.items,
depRate)
.toString(),
@ -794,9 +844,11 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
child: const Text(
'PROPERTY ASSESSMENT',
style: TextStyle(
fontWeight: FontWeight.bold,
fontWeight:
FontWeight.bold,
fontSize: 18),
textAlign: TextAlign.left),
textAlign:
TextAlign.left),
),
Column(
children: [
@ -805,77 +857,89 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
Container(
width: 100,
margin:
const EdgeInsets.only(
top: 15, left: 15),
const EdgeInsets
.only(
top: 15,
left: 15),
padding:
const EdgeInsets.all(
5.0),
const EdgeInsets
.all(5.0),
child: const Text(
'Actual Use',
style: TextStyle(
fontWeight:
FontWeight.bold,
FontWeight
.bold,
fontSize: 13,
),
textAlign:
TextAlign.center,
textAlign: TextAlign
.center,
),
),
Container(
width: 100,
margin:
const EdgeInsets.only(
top: 15, left: 15),
const EdgeInsets
.only(
top: 15,
left: 15),
padding:
const EdgeInsets.all(
5.0),
const EdgeInsets
.all(5.0),
child: const Text(
'Market Value',
style: TextStyle(
fontWeight:
FontWeight.bold,
FontWeight
.bold,
fontSize: 13,
),
textAlign:
TextAlign.center,
textAlign: TextAlign
.center,
),
),
Container(
width: 100,
margin:
const EdgeInsets.only(
top: 15, left: 15),
const EdgeInsets
.only(
top: 15,
left: 15),
padding:
const EdgeInsets.all(
5.0),
const EdgeInsets
.all(5.0),
child: const Text(
'Ass. Level',
style: TextStyle(
fontWeight:
FontWeight.bold,
FontWeight
.bold,
fontSize: 13,
),
textAlign:
TextAlign.center,
textAlign: TextAlign
.center,
),
),
Container(
width: 100,
margin:
const EdgeInsets.only(
top: 15, left: 15),
const EdgeInsets
.only(
top: 15,
left: 15),
padding:
const EdgeInsets.all(
5.0),
const EdgeInsets
.all(5.0),
child: const Text(
'Ass. Value',
style: TextStyle(
fontWeight:
FontWeight.bold,
FontWeight
.bold,
fontSize: 13,
),
textAlign:
TextAlign.center,
textAlign: TextAlign
.center,
),
),
],
@ -887,102 +951,72 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
Container(
width: 100,
margin:
const EdgeInsets.only(
const EdgeInsets
.only(
top: 15,
left: 15),
padding:
const EdgeInsets.all(
5.0),
const EdgeInsets
.all(5.0),
child: Text(
formKey.currentState
?.value[
'actual_use']!,
style: TextStyle(
fontWeight:
FontWeight.bold,
FontWeight
.bold,
fontSize: 13,
),
textAlign:
TextAlign.center,
TextAlign
.center,
),
),
Container(
width: 100,
margin:
const EdgeInsets.only(
const EdgeInsets
.only(
top: 15,
left: 15),
padding:
const EdgeInsets.all(
5.0),
const EdgeInsets
.all(5.0),
child: Text(
calculateMarketValue(
(double.parse(formKey
.currentState!
.value[
'total_area']) *
double.parse(formKey
.currentState!
.value[
'bldg_type']
.unitValue)),
state.items,
depRate)
.toString(),
style: TextStyle(
fontWeight:
FontWeight.bold,
fontSize: 13,
),
textAlign:
TextAlign.center,
),
),
Container(
width: 100,
margin:
const EdgeInsets.only(
top: 15,
left: 15),
padding:
const EdgeInsets.all(
5.0),
child: Text(
assessmentLevel(
calculateMarketValue(
(double.parse(formKey.currentState!.value[
'total_area']) *
double.parse(formKey
.currentState!
.value[
'bldg_type']
.value['bldg_type']
.unitValue)),
state.items,
depRate)
.toString(),
formKey.currentState
?.value[
'actual_use']),
style: TextStyle(
fontWeight:
FontWeight.bold,
FontWeight
.bold,
fontSize: 13,
),
textAlign:
TextAlign.center,
TextAlign
.center,
),
),
Container(
width: 100,
margin:
const EdgeInsets.only(
const EdgeInsets
.only(
top: 15,
left: 15),
padding:
const EdgeInsets.all(
5.0),
const EdgeInsets
.all(5.0),
child: Text(
assessmentValue(
assessmentLevel(
calculateMarketValue(
(double.parse(formKey.currentState!.value['total_area']) *
double.parse(formKey
@ -996,15 +1030,45 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
.toString(),
formKey.currentState
?.value[
'actual_use'])
.toString(),
'actual_use']),
style: TextStyle(
fontWeight:
FontWeight.bold,
FontWeight
.bold,
fontSize: 13,
),
textAlign:
TextAlign.center,
TextAlign
.center,
),
),
Container(
width: 100,
margin:
const EdgeInsets
.only(
top: 15,
left: 15),
padding:
const EdgeInsets
.all(5.0),
child: Text(
assessmentValue(
calculateMarketValue((double.parse(formKey.currentState!.value['total_area']) * double.parse(formKey.currentState!.value['bldg_type'].unitValue)), state.items, depRate)
.toString(),
formKey
.currentState
?.value['actual_use'])
.toString(),
style: TextStyle(
fontWeight:
FontWeight
.bold,
fontSize: 13,
),
textAlign:
TextAlign
.center,
),
),
],
@ -1044,11 +1108,12 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
id: 1,
bldgapprDetailsId:
tempID.getInt('tempid')! - 1,
unitconstructCost: formKey.currentState!
.value['bldg_type'].unitValue,
unitconstructCost: formKey
.currentState!
.value['bldg_type']
.unitValue,
buildingCore: 'test',
unitconstructSubtotal:
(double.parse(formKey.currentState!.value['total_area']) *
unitconstructSubtotal: (double.parse(formKey.currentState!.value['total_area']) *
double.parse(formKey
.currentState!
.value['bldg_type']
@ -1070,8 +1135,6 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
context.read<PropertyAppraisalBloc>()
..add(AddPropertyAppraisal(
appraisal: appraisals));
widget.NextBtn();
}
;
},
@ -1085,6 +1148,10 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
}
return Container();
},
);
}
return Container();
},
),
),
);

View File

@ -580,8 +580,9 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
propertyAssessments.add(ass);
context.read<PropertyAssessmentBloc>()
..add(UpdatePropertyAssessment(
context
.read<PropertyAssessmentBloc>()
.add(UpdatePropertyAssessment(
assessment:
propertyAssessments[0]));
widget.function();
@ -589,7 +590,7 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
style: ElevatedButton.styleFrom(
backgroundColor: primary,
foregroundColor: Colors.red),
child: SizedBox(
child: const SizedBox(
width: 200,
height: 50,
child: Align(
@ -604,7 +605,7 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
),
),
),
SizedBox(
const SizedBox(
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();
},
);
}
if (state is SignatoriesErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context.read<SignatoriesBloc>().add(LoadSignatories());
},
);
}
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();
},
);
}
if (state is SignatoriesErrorState) {
return SomethingWentWrong(
message: state.error,
onpressed: () {
context
.read<SignatoriesBloc>()
.add(const LoadSignatories());
},
);
}
return Container();
},
);

View File

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

View File

@ -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:intl/intl.dart';
import 'package:shared_preferences/shared_preferences.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_road.dart';
import 'package:unit2/theme-data.dart/form-style.dart';
import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/error_state.dart';
class AddLandValueAdjustmentModal extends StatefulWidget {
// final List<UnitConstruct> unit;
@ -103,7 +107,12 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
@override
Widget build(BuildContext context) {
return BlocBuilder<LandValueAdjustmentsBloc, LandValueAdjustmentsState>(
return Scaffold(
body: ProgressHUD(
padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocBuilder<LandValueAdjustmentsBloc, LandValueAdjustmentsState>(
buildWhen: (previous, current) {
return false;
}, builder: (context, state) {
@ -121,7 +130,8 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
builder: (context, state) {
if (state is TypeOfRoadLoaded) {
final roadType = state.road_type;
return BlocConsumer<TypeOfLocationBloc, TypeOfLocationState>(
return BlocConsumer<TypeOfLocationBloc,
TypeOfLocationState>(
listener: (context, state) {
// TODO: implement listener
},
@ -139,7 +149,8 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
child: SingleChildScrollView(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
@ -152,12 +163,14 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
bottom: 0),
child: Expanded(
flex: 1,
child:
FormBuilderDropdown<LandAppr?>(
child: FormBuilderDropdown<
LandAppr?>(
name: 'land_appr_item',
autofocus: false,
decoration: normalTextFieldStyle(
"Land Appraisal Items", ""),
decoration:
normalTextFieldStyle(
"Land Appraisal Items",
""),
items: land_appr
.map((land_appr) =>
DropdownMenuItem<
@ -168,8 +181,10 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
"")),
))
.toList(),
onChanged: (selectedLandAppr) {
if (selectedLandAppr != null) {
onChanged:
(selectedLandAppr) {
if (selectedLandAppr !=
null) {
setState(() {
_unitValue = double.parse(
selectedLandAppr
@ -195,7 +210,8 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
TypeOfRoad?>(
name: 'road_type',
autofocus: false,
decoration: normalTextFieldStyle(
decoration:
normalTextFieldStyle(
"Type of Road", ""),
items: roadType
.map((roadType) =>
@ -214,8 +230,8 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
double.parse(
selectedRoad
.deduction!);
_roadType =
selectedRoad.roadType!;
_roadType = selectedRoad
.roadType!;
});
}
},
@ -237,8 +253,10 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
TypeOfLocation?>(
name: 'loc_type_road',
autofocus: false,
decoration: normalTextFieldStyle(
"Distance to Road", ""),
decoration:
normalTextFieldStyle(
"Distance to Road",
""),
items: state.loc_type
.map((locTypeRoad) =>
DropdownMenuItem<
@ -249,11 +267,13 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
"")),
))
.toList(),
onChanged: (selectedLoadRoad) {
if (selectedLoadRoad != null) {
onChanged:
(selectedLoadRoad) {
if (selectedLoadRoad !=
null) {
setState(() {
_locTypeRoad = double.parse(
selectedLoadRoad
_locTypeRoad = double
.parse(selectedLoadRoad
.allRoadTypes!);
_locRdDistance =
selectedLoadRoad
@ -275,8 +295,10 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
TypeOfLocation?>(
name: 'loc_type_pob',
autofocus: false,
decoration: normalTextFieldStyle(
"Distance to Poblacion", ""),
decoration:
normalTextFieldStyle(
"Distance to Poblacion",
""),
items: state.loc_type
.map((locTypePob) =>
DropdownMenuItem<
@ -288,10 +310,11 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
))
.toList(),
onChanged: (selectedLocPob) {
if (selectedLocPob != null) {
if (selectedLocPob !=
null) {
setState(() {
_locTypePob = double.parse(
selectedLocPob
_locTypePob = double
.parse(selectedLocPob
.localTradingCenter!);
_locPobDistance =
@ -341,7 +364,8 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
child: Text(NumberFormat.currency(
locale: 'en-PH',
symbol: "",
).format(calculateValueAdjustment())),
).format(
calculateValueAdjustment())),
),
),
const SizedBox(height: 10),
@ -371,21 +395,24 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
Container(
width: 120,
height: 60,
padding: const EdgeInsets.all(8.0),
padding:
const EdgeInsets.all(8.0),
child: ElevatedButton(
onPressed: () async {
final tempID =
await SharedPreferences
.getInstance();
print(tempID.getInt('landid'));
print(tempID
.getInt('landid'));
var adjustments = ValueAdjustments(
landapprDetailsId: tempID
.getInt('landid')! -
landapprDetailsId:
tempID.getInt(
'landid')! -
1,
baseMarketval:
_unitValue.toString(),
adjustmentFactors:
_roadType +
_unitValue
.toString(),
adjustmentFactors: _roadType +
' , ' +
_locPobDistance +
' km from road , ' +
@ -404,12 +431,12 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
context
.read<
LandValueAdjustmentsBloc>()
.add(
AddLandValueAdjustments(
.add(AddLandValueAdjustments(
val_adj:
adjustments));
},
style: ElevatedButton.styleFrom(
style:
ElevatedButton.styleFrom(
primary: Colors.black,
),
child: const Text("Submit"),
@ -421,7 +448,8 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
Container(
width: 120,
height: 60,
padding: const EdgeInsets.all(8.0),
padding:
const EdgeInsets.all(8.0),
child: ElevatedButton(
onPressed: () {
context
@ -430,7 +458,8 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
.add(
const LoadLandValueAdjustments());
},
style: ElevatedButton.styleFrom(
style:
ElevatedButton.styleFrom(
primary: Colors.black,
),
child: const Text("Cancel"),
@ -444,7 +473,13 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
),
));
}
return Container();
if (state is TypeOfLocationErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context
.read<TypeOfLocationBloc>()
.add(LoadTypeOfLocation());
},
);
}
@ -452,7 +487,30 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
},
);
}
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();
});
}
@ -462,6 +520,8 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
return Container(
child: Text("Land Value Adjustment"),
);
});
}),
),
);
}
}

View File

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

View File

@ -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/land/land_appraisal/land_appraisal_bloc.dart';
import 'package:unit2/model/passo/land_appr.dart';
@ -32,9 +34,25 @@ class _LandAppraisal extends State<LandAppraisal> {
@override
Widget build(BuildContext context) {
return BlocConsumer<LandAppraisalBloc, LandAppraisalState>(
return Scaffold(
body: ProgressHUD(
padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocConsumer<LandAppraisalBloc, LandAppraisalState>(
listener: (context, state) {
// TODO: implement listener
if (state is LandAppraisalLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is LandAppraisalLoaded) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
if (state is LandAppraisalErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
}, builder: (context, state) {
final state = context.watch<LandAppraisalBloc>().state;
if (state is LandAppraisalLoaded) {
@ -114,8 +132,8 @@ class _LandAppraisal extends State<LandAppraisal> {
DataCell(Text(
((double.parse(dataRow.unitValue!)))
.toString())),
DataCell(Text(
((double.parse(dataRow.baseMarketval!)))
DataCell(Text(((double.parse(
dataRow.baseMarketval!)))
.toString())),
DataCell(Row(
children: [
@ -219,7 +237,9 @@ class _LandAppraisal extends State<LandAppraisal> {
successAlert(context, "Deletion Successful",
"Extra item has been deleted successfully", () {
Navigator.of(context).pop();
context.read<LandAppraisalBloc>().add(const LoadLandAppraisal());
context
.read<LandAppraisalBloc>()
.add(const LoadLandAppraisal());
});
});
}
@ -255,6 +275,8 @@ class _LandAppraisal extends State<LandAppraisal> {
);
}
return Container();
});
}),
),
);
}
}

View File

@ -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:unit2/bloc/passo/land/other_improvements/other_improvements_bloc.dart';
import 'package:unit2/screens/passo/Land/add_land/AddOtherImprovementModal.dart';
import 'package:unit2/utils/alerts.dart';
@ -30,9 +32,25 @@ class _OtherImprovementPage extends State<OtherImprovementPage> {
@override
Widget build(BuildContext context) {
return BlocConsumer<OtherImprovementsBloc, OtherImprovementsState>(
return Scaffold(
body: ProgressHUD(
padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocConsumer<OtherImprovementsBloc, OtherImprovementsState>(
listener: (context, state) {
// TODO: implement listener
if (state is OtherImprovementLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is OtherImprovementLoaded) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
if (state is OtherImprovementErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
}, builder: (context, state) {
final state = context.watch<OtherImprovementsBloc>().state;
if (state is OtherImprovementLoaded) {
@ -120,14 +138,16 @@ class _OtherImprovementPage extends State<OtherImprovementPage> {
DataCell(Text(dataRow.fruitBearing!
? "Fruit Bearing"
: "Non-Fruit Bearing")),
DataCell(Text(dataRow.quantity.toString()!)),
DataCell(
Text(dataRow.noOfProductive.toString()!)),
Text(dataRow.quantity.toString()!)),
DataCell(Text(
dataRow.noOfNonproductive.toString()!)),
DataCell(Text(dataRow.unitValue.toString()!)),
dataRow.noOfProductive.toString()!)),
DataCell(Text(dataRow.noOfNonproductive
.toString()!)),
DataCell(
Text(dataRow.baseMarketval.toString()!)),
Text(dataRow.unitValue.toString()!)),
DataCell(Text(
dataRow.baseMarketval.toString()!)),
DataCell(Row(
children: [
InkWell(
@ -258,6 +278,8 @@ class _OtherImprovementPage extends State<OtherImprovementPage> {
);
}
return Container();
});
}),
),
);
}
}

View File

@ -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:unit2/bloc/passo/land/land_property_assessment/land_property_assessment_bloc.dart';
import 'package:unit2/screens/passo/Land/add_land/AddPropertyAssessmentModal.dart';
import 'package:unit2/utils/alerts.dart';
@ -30,9 +32,25 @@ class _LandPropertyAssessmentPage extends State<LandPropertyAssessmentPage> {
@override
Widget build(BuildContext context) {
return BlocConsumer<LandPropertyAssessmentBloc,
return Scaffold(
body: ProgressHUD(
padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocConsumer<LandPropertyAssessmentBloc,
LandPropertyAssessmentState>(listener: (context, state) {
// TODO: implement listener
if (state is LandPropertyAssessmentLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is LandPropertyAssessmentLoaded) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
if (state is LandPropertyAssessmentErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
}, builder: (context, state) {
final state = context.watch<LandPropertyAssessmentBloc>().state;
if (state is LandPropertyAssessmentLoaded) {
@ -238,6 +256,8 @@ class _LandPropertyAssessmentPage extends State<LandPropertyAssessmentPage> {
);
}
return Container();
});
}),
),
);
}
}

View File

@ -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:searchfield/searchfield.dart';
import 'package:shared_preferences/shared_preferences.dart';
@ -12,6 +14,8 @@ import 'package:unit2/model/passo/memoranda.dart';
import 'package:unit2/model/passo/signatories.dart';
import 'package:unit2/screens/passo/Land/add_land.dart';
import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/error_state.dart';
class LandSignatories extends StatefulWidget {
Function onSAve;
@ -28,22 +32,54 @@ class _LandSignatories extends State<LandSignatories> {
String _memoranda = "";
@override
Widget build(BuildContext context) {
return BlocConsumer<LandExtBloc, LandExtState>(
return Scaffold(
body: ProgressHUD(
padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocConsumer<LandExtBloc, LandExtState>(
listener: (context, state) {
// TODO: implement listener
if (state is LandExtLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is LandExtErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
},
builder: (context, state) {
if (state is LandExtLoaded) {
return BlocConsumer<SignatoriesBloc, SignatoriesState>(
listener: (context, state) {
// TODO: implement listener
if (state is SignatoriesLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is SignatoriesErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
},
builder: (context, state) {
if (state is SignatoriesLoaded) {
final signatories = state.signatories;
return BlocConsumer<MemorandaBloc, MemorandaState>(
listener: (context, state) {
// TODO: implement listener
if (state is MemorandaLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is MemorandaLoaded) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
if (state is MemorandaErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
},
builder: (context, state) {
if (state is MemorandaLoaded) {
@ -55,11 +91,13 @@ class _LandSignatories extends State<LandSignatories> {
left: 0, top: 20, right: 0, bottom: 10),
child: const Text('PROPERTY ASSESSMENT cont..',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 18),
fontWeight: FontWeight.bold,
fontSize: 18),
textAlign: TextAlign.left),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
mainAxisAlignment:
MainAxisAlignment.spaceAround,
children: [
Row(
children: [
@ -98,7 +136,8 @@ class _LandSignatories extends State<LandSignatories> {
),
const Text(
'EFFECTIVITY OF ASSESSMENT / REASSESSMENT :',
style: TextStyle(fontWeight: FontWeight.bold),
style:
TextStyle(fontWeight: FontWeight.bold),
),
const SizedBox(
height: 20,
@ -139,7 +178,8 @@ class _LandSignatories extends State<LandSignatories> {
left: 0, top: 40, right: 0, bottom: 10),
child: const Text('SIGNATORIES',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 18),
fontWeight: FontWeight.bold,
fontSize: 18),
textAlign: TextAlign.left),
),
const SizedBox(
@ -154,7 +194,8 @@ class _LandSignatories extends State<LandSignatories> {
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
mainAxisAlignment:
MainAxisAlignment.spaceAround,
children: [
Column(
children: [
@ -189,8 +230,8 @@ class _LandSignatories extends State<LandSignatories> {
initialValue: DateTime.now(),
inputType: InputType.date,
initialTime:
const TimeOfDay(hour: 8, minute: 0),
initialTime: const TimeOfDay(
hour: 8, minute: 0),
// locale: const Locale.fromSubtags(languageCode: 'fr'),
),
),
@ -206,10 +247,12 @@ class _LandSignatories extends State<LandSignatories> {
alignment: Alignment.centerLeft,
child: Text(
'RECOMMENDING APPROVAL:',
style: TextStyle(fontWeight: FontWeight.bold),
style:
TextStyle(fontWeight: FontWeight.bold),
)),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
mainAxisAlignment:
MainAxisAlignment.spaceAround,
children: [
Column(
children: [
@ -244,8 +287,8 @@ class _LandSignatories extends State<LandSignatories> {
initialValue: DateTime.now(),
inputType: InputType.date,
initialTime:
const TimeOfDay(hour: 8, minute: 0),
initialTime: const TimeOfDay(
hour: 8, minute: 0),
// locale: const Locale.fromSubtags(languageCode: 'fr'),
),
),
@ -301,8 +344,8 @@ class _LandSignatories extends State<LandSignatories> {
initialValue: DateTime.now(),
inputType: InputType.date,
initialTime:
const TimeOfDay(hour: 8, minute: 0),
initialTime: const TimeOfDay(
hour: 8, minute: 0),
// locale: const Locale.fromSubtags(languageCode: 'fr'),
),
),
@ -338,7 +381,8 @@ class _LandSignatories extends State<LandSignatories> {
child: ListTile(
title: Text(
'${memoranda.memoranda}',
overflow: TextOverflow.ellipsis,
overflow:
TextOverflow.ellipsis,
),
),
))
@ -365,7 +409,8 @@ class _LandSignatories extends State<LandSignatories> {
height: 30,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text('Sworn Statement No. :'),
SizedBox(
@ -374,7 +419,8 @@ class _LandSignatories extends State<LandSignatories> {
child: FormBuilderTextField(
name: 'sworn_statement_land',
decoration: InputDecoration(),
validator: FormBuilderValidators.compose([]),
validator:
FormBuilderValidators.compose([]),
),
),
],
@ -383,7 +429,8 @@ class _LandSignatories extends State<LandSignatories> {
height: 30,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text('Date Received:'),
SizedBox(
@ -407,7 +454,8 @@ class _LandSignatories extends State<LandSignatories> {
height: 30,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text('Date of Entry in the Rec. of Ass. :'),
SizedBox(
@ -431,7 +479,8 @@ class _LandSignatories extends State<LandSignatories> {
height: 30,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text('By:'),
SizedBox(
@ -440,7 +489,8 @@ class _LandSignatories extends State<LandSignatories> {
child: FormBuilderTextField(
name: 'by_land',
decoration: InputDecoration(),
validator: FormBuilderValidators.compose([]),
validator:
FormBuilderValidators.compose([]),
),
),
],
@ -457,19 +507,24 @@ class _LandSignatories extends State<LandSignatories> {
tempID.getInt('landid')! - 1,
taxable: isTaxable,
exempt: isExempt,
qtr: int.parse(
landKey.currentState!.value['land_qtr']),
yr: int.parse(
landKey.currentState!.value['land_yr']),
appraisedbyName: landKey.currentState!.value['appraised_by_land'].firstname +
qtr: int.parse(landKey
.currentState!.value['land_qtr']),
yr: int.parse(landKey
.currentState!.value['land_yr']),
appraisedbyName: landKey
.currentState!
.value['appraised_by_land']
.firstname +
' ' +
landKey
.currentState!
.value['appraised_by_land']
.middlename +
' ' +
landKey.currentState!
.value['appraised_by_land'].lastname,
landKey
.currentState!
.value['appraised_by_land']
.lastname,
appraisedbyDate: landKey
.currentState!.value['app_date_land'],
recommendapprName: landKey
@ -477,20 +532,11 @@ class _LandSignatories extends State<LandSignatories> {
.value['rec_approval_land']
.firstname +
' ' +
landKey
.currentState!
.value['rec_approval_land']
.middlename +
landKey.currentState!.value['rec_approval_land'].middlename +
' ' +
landKey.currentState!
.value['rec_approval_land'].lastname,
recommendapprDate: landKey
.currentState!.value['rec_date_land'],
approvedbyName: landKey.currentState!.value['apprvd_by_land'].firstname +
' ' +
landKey.currentState!.value['apprvd_by_land'].middlename +
' ' +
landKey.currentState!.value['apprvd_by_land'].lastname,
landKey.currentState!.value['rec_approval_land'].lastname,
recommendapprDate: landKey.currentState!.value['rec_date_land'],
approvedbyName: landKey.currentState!.value['apprvd_by_land'].firstname + ' ' + landKey.currentState!.value['apprvd_by_land'].middlename + ' ' + landKey.currentState!.value['apprvd_by_land'].lastname,
approvedbyDate: landKey.currentState!.value['apprvd_by_date_land'],
memoranda: _memoranda,
swornstatementNo: landKey.currentState!.value['sworn_statement_land'],
@ -498,9 +544,10 @@ class _LandSignatories extends State<LandSignatories> {
entryDateAssessment: landKey.currentState!.value['date_of_entry_land'],
entryDateBy: landKey.currentState!.value['by_land']);
print(ext.toJson());
context.read<LandExtBloc>()
..add(UpdateLandExt(landext: ext));
widget.onSAve();
// widget.onSAve();
},
style: ElevatedButton.styleFrom(
backgroundColor: primary,
@ -526,7 +573,13 @@ class _LandSignatories extends State<LandSignatories> {
],
));
}
return Container();
if (state is MemorandaErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context
.read<MemorandaBloc>()
.add(LoadMemoranda());
},
);
}
@ -534,8 +587,30 @@ class _LandSignatories extends State<LandSignatories> {
},
);
}
if (state is SignatoriesErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context.read<SignatoriesBloc>().add(LoadSignatories());
},
);
}
return Container();
},
);
}
if (state is LandExtErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context.read<LandExtBloc>().add(LoadLandExt());
},
);
}
return Container();
},
),
),
);
}
}

View File

@ -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:unit2/bloc/passo/land/land_value_adjustments/land_value_adjustments_bloc.dart';
import 'package:unit2/screens/passo/Land/add_land/AddLandValueAdjustmentModal.dart';
import 'package:unit2/utils/alerts.dart';
@ -14,14 +16,6 @@ class ValueAdjustmentPage extends StatefulWidget {
}
class _ValueAdjustmentPage extends State<ValueAdjustmentPage> {
// double _totalMarketValue(items) {
// double total = 0;
// items.forEach((row) {
// total += double.parse(row);
// });
// return total;
// }
void deleteItem(int itemId) {
context
.read<LandValueAdjustmentsBloc>()
@ -30,9 +24,26 @@ class _ValueAdjustmentPage extends State<ValueAdjustmentPage> {
@override
Widget build(BuildContext context) {
return BlocConsumer<LandValueAdjustmentsBloc, LandValueAdjustmentsState>(
return Scaffold(
body: ProgressHUD(
padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child:
BlocConsumer<LandValueAdjustmentsBloc, LandValueAdjustmentsState>(
listener: (context, state) {
// TODO: implement listener
if (state is LandValueAdjustmentsLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is LandValueAdjustmentsLoaded) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
if (state is LandValueAdjustmentsErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
}, builder: (context, state) {
final state = context.watch<LandValueAdjustmentsBloc>().state;
if (state is LandValueAdjustmentsLoaded) {
@ -107,7 +118,8 @@ class _ValueAdjustmentPage extends State<ValueAdjustmentPage> {
return DataRow(
cells: [
DataCell(Text(dataRow.baseMarketval!)),
DataCell(Text(dataRow.adjustmentFactors!)),
DataCell(
Text(dataRow.adjustmentFactors!)),
DataCell(Text(dataRow.adjustment!)),
DataCell(Text(dataRow.valueAdjustment!)),
DataCell(Text(dataRow.marketValue!)),
@ -241,6 +253,8 @@ class _ValueAdjustmentPage extends State<ValueAdjustmentPage> {
);
}
return Container();
});
}),
),
);
}
}

View File

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

View File

@ -266,13 +266,11 @@ class _LandAppraisalEdit extends State<LandAppraisalEdit> {
alignment: Alignment.topCenter,
child: Container(
child: ConstrainedBox(
constraints: BoxConstraints(maxHeight: 500),
child: Container(
constraints: const BoxConstraints(maxHeight: 500),
child: AddLandAppraisalEditModal(widget.faasId),
),
),
),
),
],
),
),
@ -283,7 +281,7 @@ class _LandAppraisalEdit extends State<LandAppraisalEdit> {
message: onError,
onpressed: () {
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/utils/global_context.dart';
import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/empty_data.dart';
import 'package:unit2/widgets/error_state.dart';
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
@ -72,6 +73,11 @@ class BuildingHome extends StatelessWidget {
context.read<PropertyInfoBloc>().add(DeleteBuildingFaas(id: itemId));
}
void triggerBlocEvent() {
final myBloc = BlocProvider.of<PropertyInfoBloc>(context);
myBloc.add(LoadPropertyInfo());
}
return Scaffold(
body: ProgressHUD(
backgroundColor: Colors.black87,
@ -101,6 +107,7 @@ class BuildingHome extends StatelessWidget {
},
builder: (context, state) {
if (state is PropertyInfoLoaded) {
if (state.property_info.isNotEmpty) {
List<PropertyInfo> propertyList = state.property_info;
return Container(
padding: const EdgeInsets.symmetric(horizontal: 12),
@ -119,6 +126,11 @@ class BuildingHome extends StatelessWidget {
],
),
);
} else {
return const EmptyData(
message:
"You don't have any building faas added. Please click + to add");
}
}
if (state is PropertyInfoErrorState) {
return SomethingWentWrong(
@ -206,7 +218,7 @@ class BuildingHome extends StatelessWidget {
BlocProvider(
create: (context) =>
MemorandaBloc()..add(LoadMemoranda())),
], child: AddBuilding());
], child: AddBuilding(triggerBlocEvent));
}));
}),
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/bulding/additional_item/additional_item_bloc.dart';
import 'package:unit2/bloc/passo/bulding/additional_items_edit/additional_items_edit_bloc.dart';
import 'package:unit2/bloc/passo/bulding/class_components/class_components_bloc.dart';
import 'package:unit2/bloc/passo/bulding/general_description/general_description_bloc.dart';
import 'package:unit2/bloc/passo/bulding/landref/landref_bloc.dart';
import 'package:unit2/bloc/passo/bulding/location/location_bloc.dart';
import 'package:unit2/bloc/passo/bulding/property_appraisal/property_appraisal_bloc.dart';
import 'package:unit2/bloc/passo/bulding/property_appraisal_edit/property_appraisal_edit_bloc.dart';
import 'package:unit2/bloc/passo/bulding/property_assessment/property_assessment_bloc.dart';
import 'package:unit2/bloc/passo/bulding/property_assessment_edit/property_assessment_edit_bloc.dart';
import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart';
import 'package:unit2/bloc/passo/bulding/structural_material/structural_material_bloc.dart';
import 'package:unit2/bloc/passo/bulding/unit_construct/unit_construct_bloc.dart';
import 'package:unit2/bloc/passo/land/land_appraisal/land_appraisal_bloc.dart';
import 'package:unit2/bloc/passo/land/land_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/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_ext.dart';
import 'package:unit2/model/passo/land_property_assessment.dart';
import 'package:unit2/model/passo/land_property_boundaries.dart';
import 'package:unit2/model/passo/land_property_loc.dart';
import 'package:unit2/model/passo/land_property_owner.dart';
import 'package:unit2/model/passo/land_ref.dart';
import 'package:unit2/model/passo/land_value_adjustment.dart';
import 'package:unit2/model/passo/other_improvements.dart';
import 'package:unit2/model/passo/property_appraisal.dart';
import 'package:unit2/model/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/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/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/utils/alerts.dart';
import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/empty_data.dart';
import 'package:unit2/widgets/error_state.dart';
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
import '../../model/passo/bldg_loc.dart';
class LandHome extends StatelessWidget {
const LandHome({super.key});
@override
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;
String? token;
Profile profile;
@ -104,6 +95,7 @@ class LandHome extends StatelessWidget {
},
builder: (context, state) {
if (state is LandLoaded) {
if (state.land.isNotEmpty) {
List<LandPropertyOwner> propertyList = state.land;
return Container(
padding: const EdgeInsets.symmetric(horizontal: 12),
@ -114,14 +106,19 @@ class LandHome 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);
},
),
),
],
),
);
} else {
return const EmptyData(
message:
"You don't have any land faas added. Please click + to add");
}
}
if (state is LandErrorState) {
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();
},
);
@ -195,7 +206,7 @@ class LandHome extends StatelessWidget {
BlocProvider(
create: (context) =>
MemorandaBloc()..add(LoadMemoranda())),
], child: AddBuilding());
], child: AddBuilding(triggerBlocEvent));
}));
}),
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(
shape: RoundedRectangleBorder(
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;
}
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,11 +5,11 @@ 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";
}
@ -347,6 +347,7 @@ class Url {
String getBarangays() {
return "/api/web_app/location/barangay/";
}
String getPurok() {
return "/api/web_app/location/purok/";
}

View File

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

View File

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