fixed pupspec.lock

feature/passo/PASSO-#1-Sync-data-from-device-to-postgre-and-vice-versa
PGAN-MIS 2023-10-09 11:32:16 +08:00
commit 71c8f306b5
29 changed files with 2757 additions and 2309 deletions

1
.gitignore vendored
View File

@ -31,6 +31,7 @@ migrate_working_dir/
.pub-cache/
.pub/
/build/
pubspeck.lock
# Symbolication related
app.*.symbols

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

@ -580,16 +580,17 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
propertyAssessments.add(ass);
context.read<PropertyAssessmentBloc>()
..add(UpdatePropertyAssessment(
assessment:
propertyAssessments[0]));
context
.read<PropertyAssessmentBloc>()
.add(UpdatePropertyAssessment(
assessment:
propertyAssessments[0]));
widget.function();
},
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,365 +107,421 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
@override
Widget build(BuildContext context) {
return BlocBuilder<LandValueAdjustmentsBloc, LandValueAdjustmentsState>(
buildWhen: (previous, current) {
return false;
}, builder: (context, state) {
if (state is ShowAddLandValueAdjustmentsScreen) {
return BlocConsumer<LandAppraisalBloc, LandAppraisalState>(
listener: (context, state) {
// TODO: implement listener
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) {
if (state is LandAppraisalLoaded) {
final land_appr = state.land_appr;
return BlocConsumer<TypeOfRoadBloc, TypeOfRoadState>(
listener: (context, state) {
// TODO: implement listener
},
builder: (context, state) {
if (state is TypeOfRoadLoaded) {
final roadType = state.road_type;
return BlocConsumer<TypeOfLocationBloc, TypeOfLocationState>(
listener: (context, state) {
// TODO: implement listener
},
builder: (context, state) {
if (state is TypeOfLocationLoaded) {
return FormBuilder(
key: otherImpKey,
onChanged: () {
otherImpKey.currentState?.save();
},
autovalidateMode: AutovalidateMode.disabled,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: SingleChildScrollView(
if (state is ShowAddLandValueAdjustmentsScreen) {
return BlocConsumer<LandAppraisalBloc, LandAppraisalState>(
listener: (context, state) {
// TODO: implement listener
}, builder: (context, state) {
if (state is LandAppraisalLoaded) {
final land_appr = state.land_appr;
return BlocConsumer<TypeOfRoadBloc, TypeOfRoadState>(
listener: (context, state) {
// TODO: implement listener
},
builder: (context, state) {
if (state is TypeOfRoadLoaded) {
final roadType = state.road_type;
return BlocConsumer<TypeOfLocationBloc,
TypeOfLocationState>(
listener: (context, state) {
// TODO: implement listener
},
builder: (context, state) {
if (state is TypeOfLocationLoaded) {
return FormBuilder(
key: otherImpKey,
onChanged: () {
otherImpKey.currentState?.save();
},
autovalidateMode: AutovalidateMode.disabled,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
margin: const EdgeInsets.only(
left: 0,
top: 10,
right: 0,
bottom: 0),
child: Expanded(
flex: 1,
child:
FormBuilderDropdown<LandAppr?>(
name: 'land_appr_item',
autofocus: false,
decoration: normalTextFieldStyle(
"Land Appraisal Items", ""),
items: land_appr
.map((land_appr) =>
DropdownMenuItem<
LandAppr?>(
value: land_appr,
child: Text((land_appr
.subClass ??
"")),
))
.toList(),
onChanged: (selectedLandAppr) {
if (selectedLandAppr != null) {
setState(() {
_unitValue = double.parse(
selectedLandAppr
.baseMarketval!);
});
}
},
)),
),
SizedBox(
height: 10,
),
Text("Adjustment Factors"),
Container(
margin: const EdgeInsets.only(
left: 0,
top: 10,
right: 0,
bottom: 0),
child: Expanded(
flex: 1,
child: FormBuilderDropdown<
TypeOfRoad?>(
name: 'road_type',
autofocus: false,
decoration: normalTextFieldStyle(
"Type of Road", ""),
items: roadType
.map((roadType) =>
DropdownMenuItem<
TypeOfRoad?>(
value: roadType,
child: Text((roadType
.roadType ??
"")),
))
.toList(),
onChanged: (selectedRoad) {
if (selectedRoad != null) {
setState(() {
_roadTypeDeduction =
double.parse(
selectedRoad
.deduction!);
_roadType =
selectedRoad.roadType!;
});
}
},
)),
),
SizedBox(
height: 10,
),
Text("Type of Location"),
Container(
margin: const EdgeInsets.only(
left: 0,
top: 10,
right: 0,
bottom: 0),
child: Expanded(
flex: 1,
child: FormBuilderDropdown<
TypeOfLocation?>(
name: 'loc_type_road',
autofocus: false,
decoration: normalTextFieldStyle(
"Distance to Road", ""),
items: state.loc_type
.map((locTypeRoad) =>
DropdownMenuItem<
TypeOfLocation?>(
value: locTypeRoad,
child: Text((locTypeRoad
.distanceKm ??
"")),
))
.toList(),
onChanged: (selectedLoadRoad) {
if (selectedLoadRoad != null) {
setState(() {
_locTypeRoad = double.parse(
selectedLoadRoad
.allRoadTypes!);
_locRdDistance =
selectedLoadRoad
.distanceKm!;
});
}
},
)),
),
Container(
margin: const EdgeInsets.only(
left: 0,
top: 10,
right: 0,
bottom: 0),
child: Expanded(
flex: 1,
child: FormBuilderDropdown<
TypeOfLocation?>(
name: 'loc_type_pob',
autofocus: false,
decoration: normalTextFieldStyle(
"Distance to Poblacion", ""),
items: state.loc_type
.map((locTypePob) =>
DropdownMenuItem<
TypeOfLocation?>(
value: locTypePob,
child: Text((locTypePob
.distanceKm ??
"")),
))
.toList(),
onChanged: (selectedLocPob) {
if (selectedLocPob != null) {
setState(() {
_locTypePob = double.parse(
selectedLocPob
.localTradingCenter!);
_locPobDistance =
selectedLocPob
.distanceKm!;
});
}
},
)),
),
const SizedBox(height: 10),
Container(
height: 45.0,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: Colors.grey,
width: 1.0,
),
borderRadius:
BorderRadius.circular(5.0),
),
child: Align(
alignment: Alignment.center,
child: Text(
(calculateAdjustment() * 100)
.toString() +
'%'),
),
),
const SizedBox(height: 10),
Container(
height: 45.0,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: Colors.grey,
width: 1.0,
),
borderRadius:
BorderRadius.circular(5.0),
),
child: Align(
alignment: Alignment.center,
child: Text(NumberFormat.currency(
locale: 'en-PH',
symbol: "",
).format(calculateValueAdjustment())),
),
),
const SizedBox(height: 10),
Container(
height: 45.0,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: Colors.grey,
width: 1.0,
),
borderRadius:
BorderRadius.circular(5.0),
),
child: Align(
alignment: Alignment.center,
child: Text(NumberFormat.currency(
locale: 'en-PH',
symbol: "",
).format(calculateMarketValue())),
),
),
const SizedBox(height: 10),
Row(
children: [
child: Container(
child: SingleChildScrollView(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
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 +
margin: const EdgeInsets.only(
left: 0,
top: 10,
right: 0,
bottom: 0),
child: Expanded(
flex: 1,
child: FormBuilderDropdown<
LandAppr?>(
name: 'land_appr_item',
autofocus: false,
decoration:
normalTextFieldStyle(
"Land Appraisal Items",
""),
items: land_appr
.map((land_appr) =>
DropdownMenuItem<
LandAppr?>(
value: land_appr,
child: Text((land_appr
.subClass ??
"")),
))
.toList(),
onChanged:
(selectedLandAppr) {
if (selectedLandAppr !=
null) {
setState(() {
_unitValue = double.parse(
selectedLandAppr
.baseMarketval!);
});
}
},
)),
),
SizedBox(
height: 10,
),
Text("Adjustment Factors"),
Container(
margin: const EdgeInsets.only(
left: 0,
top: 10,
right: 0,
bottom: 0),
child: Expanded(
flex: 1,
child: FormBuilderDropdown<
TypeOfRoad?>(
name: 'road_type',
autofocus: false,
decoration:
normalTextFieldStyle(
"Type of Road", ""),
items: roadType
.map((roadType) =>
DropdownMenuItem<
TypeOfRoad?>(
value: roadType,
child: Text((roadType
.roadType ??
"")),
))
.toList(),
onChanged: (selectedRoad) {
if (selectedRoad != null) {
setState(() {
_roadTypeDeduction =
double.parse(
selectedRoad
.deduction!);
_roadType = selectedRoad
.roadType!;
});
}
},
)),
),
SizedBox(
height: 10,
),
Text("Type of Location"),
Container(
margin: const EdgeInsets.only(
left: 0,
top: 10,
right: 0,
bottom: 0),
child: Expanded(
flex: 1,
child: FormBuilderDropdown<
TypeOfLocation?>(
name: 'loc_type_road',
autofocus: false,
decoration:
normalTextFieldStyle(
"Distance to Road",
""),
items: state.loc_type
.map((locTypeRoad) =>
DropdownMenuItem<
TypeOfLocation?>(
value: locTypeRoad,
child: Text((locTypeRoad
.distanceKm ??
"")),
))
.toList(),
onChanged:
(selectedLoadRoad) {
if (selectedLoadRoad !=
null) {
setState(() {
_locTypeRoad = double
.parse(selectedLoadRoad
.allRoadTypes!);
_locRdDistance =
selectedLoadRoad
.distanceKm!;
});
}
},
)),
),
Container(
margin: const EdgeInsets.only(
left: 0,
top: 10,
right: 0,
bottom: 0),
child: Expanded(
flex: 1,
child: FormBuilderDropdown<
TypeOfLocation?>(
name: 'loc_type_pob',
autofocus: false,
decoration:
normalTextFieldStyle(
"Distance to Poblacion",
""),
items: state.loc_type
.map((locTypePob) =>
DropdownMenuItem<
TypeOfLocation?>(
value: locTypePob,
child: Text((locTypePob
.distanceKm ??
"")),
))
.toList(),
onChanged: (selectedLocPob) {
if (selectedLocPob !=
null) {
setState(() {
_locTypePob = double
.parse(selectedLocPob
.localTradingCenter!);
_locPobDistance =
selectedLocPob
.distanceKm!;
});
}
},
)),
),
const SizedBox(height: 10),
Container(
height: 45.0,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: Colors.grey,
width: 1.0,
),
borderRadius:
BorderRadius.circular(5.0),
),
child: Align(
alignment: Alignment.center,
child: Text(
(calculateAdjustment() * 100)
.toString() +
'%'),
),
),
const SizedBox(height: 10),
Container(
height: 45.0,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: Colors.grey,
width: 1.0,
),
borderRadius:
BorderRadius.circular(5.0),
),
child: Align(
alignment: Alignment.center,
child: Text(NumberFormat.currency(
locale: 'en-PH',
symbol: "",
).format(
calculateValueAdjustment())),
),
),
const SizedBox(height: 10),
Container(
height: 45.0,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: Colors.grey,
width: 1.0,
),
borderRadius:
BorderRadius.circular(5.0),
),
child: Align(
alignment: Alignment.center,
child: Text(NumberFormat.currency(
locale: 'en-PH',
symbol: "",
).format(calculateMarketValue())),
),
),
const SizedBox(height: 10),
Row(
children: [
Container(
width: 120,
height: 60,
padding:
const EdgeInsets.all(8.0),
child: ElevatedButton(
onPressed: () async {
final tempID =
await SharedPreferences
.getInstance();
print(tempID
.getInt('landid'));
var adjustments = ValueAdjustments(
landapprDetailsId:
tempID.getInt(
'landid')! -
1,
baseMarketval:
_unitValue
.toString(),
adjustmentFactors: _roadType +
' , ' +
_locPobDistance +
' km from road , ' +
_locPobDistance +
' km from poblacion',
adjustment:
calculateAdjustment()
.toString(),
valueAdjustment:
calculateValueAdjustment()
.toString(),
marketValue:
calculateMarketValue()
.toString());
adjustment:
calculateAdjustment()
.toString(),
valueAdjustment:
calculateValueAdjustment()
.toString(),
marketValue:
calculateMarketValue()
.toString());
context
.read<
LandValueAdjustmentsBloc>()
.add(
AddLandValueAdjustments(
context
.read<
LandValueAdjustmentsBloc>()
.add(AddLandValueAdjustments(
val_adj:
adjustments));
},
style: ElevatedButton.styleFrom(
primary: Colors.black,
},
style:
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
Container(
width: 120,
height: 60,
padding: const EdgeInsets.all(8.0),
child: ElevatedButton(
onPressed: () {
context
.read<
LandValueAdjustmentsBloc>()
.add(
const LoadLandValueAdjustments());
},
style: ElevatedButton.styleFrom(
primary: Colors.black,
const SizedBox(
width:
5), // Use SizedBox for horizontal spacing in a Row
Container(
width: 120,
height: 60,
padding:
const EdgeInsets.all(8.0),
child: ElevatedButton(
onPressed: () {
context
.read<
LandValueAdjustmentsBloc>()
.add(
const LoadLandValueAdjustments());
},
style:
ElevatedButton.styleFrom(
primary: Colors.black,
),
child: const Text("Cancel"),
),
),
child: const Text("Cancel"),
),
),
],
)
],
)
],
),
),
),
),
),
));
}
return Container();
},
);
}
return Container();
},
);
));
}
if (state is TypeOfLocationErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context
.read<TypeOfLocationBloc>()
.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();
});
}
return Container();
});
}
if (state is LandValueAdjustmentsErrorState) {
return Text(state.error);
}
return Container(
child: Text("Land Value Adjustment"),
);
});
if (state is LandValueAdjustmentsErrorState) {
return Text(state.error);
}
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,229 +34,249 @@ class _LandAppraisal extends State<LandAppraisal> {
@override
Widget build(BuildContext context) {
return BlocConsumer<LandAppraisalBloc, LandAppraisalState>(
listener: (context, state) {
// TODO: implement listener
}, builder: (context, state) {
final state = context.watch<LandAppraisalBloc>().state;
if (state is LandAppraisalLoaded) {
return Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
children: [
Container(
margin: const EdgeInsets.only(
left: 0, top: 20, right: 0, bottom: 10),
child: const Text('LAND APPRAISAL',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 18),
textAlign: TextAlign.left),
),
Align(
alignment: Alignment.topRight,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red,
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) {
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) {
return Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
children: [
Container(
margin: const EdgeInsets.only(
left: 0, top: 20, right: 0, bottom: 10),
child: const Text('LAND APPRAISAL',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 18),
textAlign: TextAlign.left),
),
onPressed: () {
context
.read<LandAppraisalBloc>()
.add(ShowLandAppraisal());
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Text('ADD ITEM'), // <-- Text
const SizedBox(
width: 5,
Align(
alignment: Alignment.topRight,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red,
),
const Icon(
// <-- Icon
Icons.add,
size: 24.0,
onPressed: () {
context
.read<LandAppraisalBloc>()
.add(ShowLandAppraisal());
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Text('ADD ITEM'), // <-- Text
const SizedBox(
width: 5,
),
const Icon(
// <-- Icon
Icons.add,
size: 24.0,
),
],
),
],
),
),
),
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
// ignore: prefer_const_literals_to_create_immutables
columns: [
const DataColumn(
label: Text('Classification'),
),
const DataColumn(
label: Text('Sub-Classification'),
),
const DataColumn(
label: Text('Area'),
),
const DataColumn(
label: Text('Unit Value'),
),
const DataColumn(
label: Text('Base MArket Value'),
),
const DataColumn(
label: Text('Action'),
)
],
rows: state.land_appr.map((dataRow) {
return DataRow(
cells: [
DataCell(Text(dataRow.classification!)),
DataCell(Text(dataRow.subClass!)),
DataCell(Text(dataRow.area!)),
DataCell(Text(
((double.parse(dataRow.unitValue!)))
.toString())),
DataCell(Text(
((double.parse(dataRow.baseMarketval!)))
.toString())),
DataCell(Row(
children: [
InkWell(
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.delete,
color: Colors.white,
size: 20.0,
),
),
onTap: () {
deleteItem(dataRow.id!);
},
),
SizedBox(
width: 10,
),
InkWell(
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.edit,
color: Colors.white,
size: 20.0,
),
),
onTap: () {},
),
],
))
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
// ignore: prefer_const_literals_to_create_immutables
columns: [
const DataColumn(
label: Text('Classification'),
),
const DataColumn(
label: Text('Sub-Classification'),
),
const DataColumn(
label: Text('Area'),
),
const DataColumn(
label: Text('Unit Value'),
),
const DataColumn(
label: Text('Base MArket Value'),
),
const DataColumn(
label: Text('Action'),
)
],
);
}).toList()))
rows: state.land_appr.map((dataRow) {
return DataRow(
cells: [
DataCell(Text(dataRow.classification!)),
DataCell(Text(dataRow.subClass!)),
DataCell(Text(dataRow.area!)),
DataCell(Text(
((double.parse(dataRow.unitValue!)))
.toString())),
DataCell(Text(((double.parse(
dataRow.baseMarketval!)))
.toString())),
DataCell(Row(
children: [
InkWell(
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.delete,
color: Colors.white,
size: 20.0,
),
),
onTap: () {
deleteItem(dataRow.id!);
},
),
SizedBox(
width: 10,
),
InkWell(
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.edit,
color: Colors.white,
size: 20.0,
),
),
onTap: () {},
),
],
))
],
);
}).toList()))
],
),
),
)),
// Padding(
// padding: const EdgeInsets.only(left: 20.0, right: 20.0),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Text(
// 'Total',
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
// ),
// Text(
// NumberFormat.currency(locale: 'en-PH', symbol: "")
// .format('1.0'),
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
// )
// ],
// ),
// ),
Padding(
padding: const EdgeInsets.all(15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
CustomButton(
icon: const Icon(Icons.chevron_left_rounded,
color: Colors.white),
onPressed: () {
{
widget.PrevBtn();
}
;
},
),
CustomButton(
icon: const Icon(Icons.chevron_right_rounded,
color: Colors.white),
onPressed: () {
{
widget.NextBtn();
}
;
},
)
],
),
),
],
);
}
if (state is LandAppraisalDeletedState) {
if (state.success) {
WidgetsBinding.instance.addPostFrameCallback((_) {
successAlert(context, "Deletion Successful",
"Extra item has been deleted successfully", () {
Navigator.of(context).pop();
context
.read<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),
// 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()),
],
),
),
);
}
if (state is LandAppraisalErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context.read<LandAppraisalBloc>().add(LoadLandAppraisal());
},
);
}
return Container();
});
);
}
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_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,234 +32,254 @@ class _OtherImprovementPage extends State<OtherImprovementPage> {
@override
Widget build(BuildContext context) {
return BlocConsumer<OtherImprovementsBloc, OtherImprovementsState>(
listener: (context, state) {
// TODO: implement listener
}, builder: (context, state) {
final state = context.watch<OtherImprovementsBloc>().state;
if (state is OtherImprovementLoaded) {
return Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
children: [
Container(
margin: const EdgeInsets.only(
left: 0, top: 20, right: 0, bottom: 10),
child: const Text('OTHER IMPROVEMENTS',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 18),
textAlign: TextAlign.left),
),
Align(
alignment: Alignment.topRight,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red,
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) {
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) {
return Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
children: [
Container(
margin: const EdgeInsets.only(
left: 0, top: 20, right: 0, bottom: 10),
child: const Text('OTHER IMPROVEMENTS',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 18),
textAlign: TextAlign.left),
),
onPressed: () {
context
.read<OtherImprovementsBloc>()
.add(ShowOtherImprovement());
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Text('ADD ITEM'), // <-- Text
const SizedBox(
width: 5,
Align(
alignment: Alignment.topRight,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red,
),
const Icon(
// <-- Icon
Icons.add,
size: 24.0,
onPressed: () {
context
.read<OtherImprovementsBloc>()
.add(ShowOtherImprovement());
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Text('ADD ITEM'), // <-- Text
const SizedBox(
width: 5,
),
const Icon(
// <-- Icon
Icons.add,
size: 24.0,
),
],
),
],
),
),
),
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
// ignore: prefer_const_literals_to_create_immutables
columns: [
const DataColumn(
label: Text('Kinds of Tress'),
),
const DataColumn(
label: Text('Sub-Class / Age'),
),
const DataColumn(
label: Text('Type of Tree'),
),
const DataColumn(
label: Text('No.'),
),
const DataColumn(
label: Text('No. of Productive'),
),
const DataColumn(
label: Text('No. of Non-Productive'),
),
const DataColumn(
label: Text('Unit Value'),
),
const DataColumn(
label: Text('Base Market Value'),
),
const DataColumn(
label: Text('Action'),
)
],
rows: state.other_imp.map((dataRow) {
return DataRow(
cells: [
DataCell(Text(dataRow.kindsOfTrees!)),
DataCell(Text(dataRow.subclassAge!)),
DataCell(Text(dataRow.fruitBearing!
? "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: () {},
),
],
))
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
// ignore: prefer_const_literals_to_create_immutables
columns: [
const DataColumn(
label: Text('Kinds of Tress'),
),
const DataColumn(
label: Text('Sub-Class / Age'),
),
const DataColumn(
label: Text('Type of Tree'),
),
const DataColumn(
label: Text('No.'),
),
const DataColumn(
label: Text('No. of Productive'),
),
const DataColumn(
label: Text('No. of Non-Productive'),
),
const DataColumn(
label: Text('Unit Value'),
),
const DataColumn(
label: Text('Base Market Value'),
),
const DataColumn(
label: Text('Action'),
)
],
);
}).toList()))
],
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: () {},
),
],
))
],
);
}).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),
// 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();
});
);
}
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,214 +32,232 @@ class _LandPropertyAssessmentPage extends State<LandPropertyAssessmentPage> {
@override
Widget build(BuildContext context) {
return BlocConsumer<LandPropertyAssessmentBloc,
LandPropertyAssessmentState>(listener: (context, state) {
// TODO: implement listener
}, builder: (context, state) {
final state = context.watch<LandPropertyAssessmentBloc>().state;
if (state is LandPropertyAssessmentLoaded) {
return Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
children: [
Container(
margin: const EdgeInsets.only(
left: 0, top: 20, right: 0, bottom: 10),
child: const Text('PROPERTY ASSESSMENT',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 18),
textAlign: TextAlign.left),
),
Align(
alignment: Alignment.topRight,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red,
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) {
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) {
return Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
children: [
Container(
margin: const EdgeInsets.only(
left: 0, top: 20, right: 0, bottom: 10),
child: const Text('PROPERTY ASSESSMENT',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 18),
textAlign: TextAlign.left),
),
onPressed: () {
context
.read<LandPropertyAssessmentBloc>()
.add(ShowLandPropertyAssessment());
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Text('ADD ITEM'), // <-- Text
const SizedBox(
width: 5,
Align(
alignment: Alignment.topRight,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red,
),
const Icon(
// <-- Icon
Icons.add,
size: 24.0,
onPressed: () {
context
.read<LandPropertyAssessmentBloc>()
.add(ShowLandPropertyAssessment());
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Text('ADD ITEM'), // <-- Text
const SizedBox(
width: 5,
),
const Icon(
// <-- Icon
Icons.add,
size: 24.0,
),
],
),
],
),
),
),
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
// ignore: prefer_const_literals_to_create_immutables
columns: [
const DataColumn(
label: Text('Actual Use'),
),
const DataColumn(
label: Text('Market Value'),
),
const DataColumn(
label: Text('Assessment Level'),
),
const DataColumn(
label: Text('Assessed Value'),
),
const DataColumn(
label: Text('Action'),
)
],
rows: state.assessment.map((dataRow) {
return DataRow(
cells: [
DataCell(Text(dataRow.actualUse!)),
DataCell(Text(dataRow.marketval!)),
DataCell(
Text(dataRow.assessmentLevel! + '%')),
DataCell(Text(dataRow.assessedValue!)),
DataCell(Row(
children: [
InkWell(
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.delete,
color: Colors.white,
size: 20.0,
),
),
onTap: () {
deleteItem(dataRow.id!);
},
),
SizedBox(
width: 10,
),
InkWell(
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.edit,
color: Colors.white,
size: 20.0,
),
),
onTap: () {},
),
],
))
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
// ignore: prefer_const_literals_to_create_immutables
columns: [
const DataColumn(
label: Text('Actual Use'),
),
const DataColumn(
label: Text('Market Value'),
),
const DataColumn(
label: Text('Assessment Level'),
),
const DataColumn(
label: Text('Assessed Value'),
),
const DataColumn(
label: Text('Action'),
)
],
);
}).toList()))
],
rows: state.assessment.map((dataRow) {
return DataRow(
cells: [
DataCell(Text(dataRow.actualUse!)),
DataCell(Text(dataRow.marketval!)),
DataCell(
Text(dataRow.assessmentLevel! + '%')),
DataCell(Text(dataRow.assessedValue!)),
DataCell(Row(
children: [
InkWell(
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.delete,
color: Colors.white,
size: 20.0,
),
),
onTap: () {
deleteItem(dataRow.id!);
},
),
SizedBox(
width: 10,
),
InkWell(
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.edit,
color: Colors.white,
size: 20.0,
),
),
onTap: () {},
),
],
))
],
);
}).toList()))
],
),
),
)),
// Padding(
// padding: const EdgeInsets.only(left: 20.0, right: 20.0),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Text(
// 'Total',
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
// ),
// Text(
// NumberFormat.currency(locale: 'en-PH', symbol: "")
// .format('1.0'),
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
// )
// ],
// ),
// ),
Padding(
padding: const EdgeInsets.all(15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
CustomButton(
icon: const Icon(Icons.chevron_left_rounded,
color: Colors.white),
onPressed: () {
{
widget.PrevBtn();
}
;
},
),
CustomButton(
icon: const Icon(Icons.chevron_right_rounded,
color: Colors.white),
onPressed: () {
{
widget.NextBtn();
}
;
},
)
],
),
),
],
);
}
if (state is LandPropertyAssessmentDeletedState) {
if (state.success) {
WidgetsBinding.instance.addPostFrameCallback((_) {
successAlert(context, "Deletion Successful",
"Extra item has been deleted successfully", () {
Navigator.of(context).pop();
context
.read<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),
// 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();
});
);
}
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_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,217 +24,237 @@ class _ValueAdjustmentPage extends State<ValueAdjustmentPage> {
@override
Widget build(BuildContext context) {
return BlocConsumer<LandValueAdjustmentsBloc, LandValueAdjustmentsState>(
listener: (context, state) {
// TODO: implement listener
}, builder: (context, state) {
final state = context.watch<LandValueAdjustmentsBloc>().state;
if (state is LandValueAdjustmentsLoaded) {
return Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
children: [
Container(
margin: const EdgeInsets.only(
left: 0, top: 20, right: 0, bottom: 10),
child: const Text('VALUE ADJUSTMENTS',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 18),
textAlign: TextAlign.left),
),
Align(
alignment: Alignment.topRight,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red,
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) {
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) {
return Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
children: [
Container(
margin: const EdgeInsets.only(
left: 0, top: 20, right: 0, bottom: 10),
child: const Text('VALUE ADJUSTMENTS',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 18),
textAlign: TextAlign.left),
),
onPressed: () {
context
.read<LandValueAdjustmentsBloc>()
.add(ShowLandValueAdjustments());
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Text('ADD ITEM'), // <-- Text
const SizedBox(
width: 5,
Align(
alignment: Alignment.topRight,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red,
),
const Icon(
// <-- Icon
Icons.add,
size: 24.0,
onPressed: () {
context
.read<LandValueAdjustmentsBloc>()
.add(ShowLandValueAdjustments());
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Text('ADD ITEM'), // <-- Text
const SizedBox(
width: 5,
),
const Icon(
// <-- Icon
Icons.add,
size: 24.0,
),
],
),
],
),
),
),
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
// ignore: prefer_const_literals_to_create_immutables
columns: [
const DataColumn(
label: Text('Base Market Value'),
),
const DataColumn(
label: Text('Adjustment Factors'),
),
const DataColumn(
label: Text('% Adjustment'),
),
const DataColumn(
label: Text('Value Adjustment'),
),
const DataColumn(
label: Text('Market Value'),
),
const DataColumn(
label: Text('Action'),
)
],
rows: state.val_adj.map((dataRow) {
return DataRow(
cells: [
DataCell(Text(dataRow.baseMarketval!)),
DataCell(Text(dataRow.adjustmentFactors!)),
DataCell(Text(dataRow.adjustment!)),
DataCell(Text(dataRow.valueAdjustment!)),
DataCell(Text(dataRow.marketValue!)),
DataCell(Row(
children: [
InkWell(
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.delete,
color: Colors.white,
size: 20.0,
),
),
onTap: () {
deleteItem(dataRow.id!);
},
),
SizedBox(
width: 10,
),
InkWell(
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.edit,
color: Colors.white,
size: 20.0,
),
),
onTap: () {},
),
],
))
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
// ignore: prefer_const_literals_to_create_immutables
columns: [
const DataColumn(
label: Text('Base Market Value'),
),
const DataColumn(
label: Text('Adjustment Factors'),
),
const DataColumn(
label: Text('% Adjustment'),
),
const DataColumn(
label: Text('Value Adjustment'),
),
const DataColumn(
label: Text('Market Value'),
),
const DataColumn(
label: Text('Action'),
)
],
);
}).toList()))
],
rows: state.val_adj.map((dataRow) {
return DataRow(
cells: [
DataCell(Text(dataRow.baseMarketval!)),
DataCell(
Text(dataRow.adjustmentFactors!)),
DataCell(Text(dataRow.adjustment!)),
DataCell(Text(dataRow.valueAdjustment!)),
DataCell(Text(dataRow.marketValue!)),
DataCell(Row(
children: [
InkWell(
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.delete,
color: Colors.white,
size: 20.0,
),
),
onTap: () {
deleteItem(dataRow.id!);
},
),
SizedBox(
width: 10,
),
InkWell(
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.edit,
color: Colors.white,
size: 20.0,
),
),
onTap: () {},
),
],
))
],
);
}).toList()))
],
),
),
)),
// Padding(
// padding: const EdgeInsets.only(left: 20.0, right: 20.0),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Text(
// 'Total',
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
// ),
// Text(
// NumberFormat.currency(locale: 'en-PH', symbol: "")
// .format('1.0'),
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
// )
// ],
// ),
// ),
Padding(
padding: const EdgeInsets.all(15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
CustomButton(
icon: const Icon(Icons.chevron_left_rounded,
color: Colors.white),
onPressed: () {
{
widget.PrevBtn();
}
;
},
),
CustomButton(
icon: const Icon(Icons.chevron_right_rounded,
color: Colors.white),
onPressed: () {
{
widget.NextBtn();
}
;
},
)
],
),
),
],
);
}
if (state is LandValueAdjustmentsDeletedState) {
if (state.success) {
WidgetsBinding.instance.addPostFrameCallback((_) {
successAlert(context, "Deletion Successful",
"Extra item has been deleted successfully", () {
Navigator.of(context).pop();
context
.read<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),
// 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();
});
);
}
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,10 +266,8 @@ class _LandAppraisalEdit extends State<LandAppraisalEdit> {
alignment: Alignment.topCenter,
child: Container(
child: ConstrainedBox(
constraints: BoxConstraints(maxHeight: 500),
child: Container(
child: AddLandAppraisalEditModal(widget.faasId),
),
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,24 +107,30 @@ class BuildingHome extends StatelessWidget {
},
builder: (context, state) {
if (state is PropertyInfoLoaded) {
List<PropertyInfo> propertyList = state.property_info;
return Container(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Column(
children: [
Expanded(
child: ListView.builder(
shrinkWrap: true,
itemCount: propertyList.length,
itemBuilder: (BuildContext context, int index) {
return _listCard(propertyList[index], context,
index, deleteItem);
},
if (state.property_info.isNotEmpty) {
List<PropertyInfo> propertyList = state.property_info;
return Container(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Column(
children: [
Expanded(
child: ListView.builder(
shrinkWrap: true,
itemCount: propertyList.length,
itemBuilder: (BuildContext context, int index) {
return _listCard(propertyList[index], context,
index, deleteItem);
},
),
),
),
],
),
);
],
),
);
} else {
return const EmptyData(
message:
"You don't have any building faas added. Please click + to add");
}
}
if (state is PropertyInfoErrorState) {
return SomethingWentWrong(
@ -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,24 +95,30 @@ class LandHome extends StatelessWidget {
},
builder: (context, state) {
if (state is LandLoaded) {
List<LandPropertyOwner> propertyList = state.land;
return Container(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Column(
children: [
Expanded(
child: ListView.builder(
shrinkWrap: true,
itemCount: propertyList.length,
itemBuilder: (BuildContext context, int index) {
return _listCard(
propertyList[index], context, index);
},
if (state.land.isNotEmpty) {
List<LandPropertyOwner> propertyList = state.land;
return Container(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Column(
children: [
Expanded(
child: ListView.builder(
shrinkWrap: true,
itemCount: propertyList.length,
itemBuilder: (BuildContext context, int index) {
return _listCard(propertyList[index], context,
index, deleteItem);
},
),
),
),
],
),
);
],
),
);
} else {
return const EmptyData(
message:
"You don't have any land faas added. Please click + to add");
}
}
if (state is LandErrorState) {
return SomethingWentWrong(
@ -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

@ -1,4 +1,8 @@
import 'package:flutter/material.dart';
<<<<<<< HEAD
=======
import 'package:flutter/src/widgets/placeholder.dart';
>>>>>>> develop
import 'package:qr_flutter/qr_flutter.dart';
import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/global.dart';
@ -12,12 +16,12 @@ class QRFullScreenImage extends StatelessWidget {
return Scaffold(
appBar: AppBar(
centerTitle: true,
backgroundColor: primary,
title: const Text("Profile QR Code"),
),
body: Center(
child: QrImageView(data: uuid, size: blockSizeVertical * 50),
),
);
backgroundColor: primary,title: const Text("Profile QR Code"),),
body: Center(
child: QrImageView(
data: uuid,
size: blockSizeVertical * 50
),
),);
}
}

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";
}

View File

@ -981,6 +981,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:
@ -1403,7 +1411,7 @@ packages:
source: hosted
version: "1.10.0"
sqflite:
dependency: transitive
dependency: "direct main"
description:
name: sqflite
sha256: "591f1602816e9c31377d5f008c2d9ef7b8aca8941c3f89cc5fd9d84da0c38a9a"
@ -1747,5 +1755,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.1.0 <4.0.0"
dart: ">=3.1.0-185.0.dev <4.0.0"
flutter: ">=3.13.0"

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: