Added delete on Land Faas;Added auto-refresh/auto-reload on adding new faas

feature/passo/PASSO-#1-Sync-data-from-device-to-postgre-and-vice-versa
cyzoox 2023-09-25 14:39:55 +08:00
parent b560340ebc
commit 75cfe68bd1
17 changed files with 1627 additions and 1330 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -589,7 +589,7 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: primary, backgroundColor: primary,
foregroundColor: Colors.red), foregroundColor: Colors.red),
child: SizedBox( child: const SizedBox(
width: 200, width: 200,
height: 50, height: 50,
child: Align( child: Align(
@ -604,7 +604,7 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
), ),
), ),
), ),
SizedBox( const SizedBox(
height: 30, height: 30,
), ),
]), ]),
@ -613,10 +613,26 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
], ],
); );
} }
if (state is MemorandaErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context.read<MemorandaBloc>().add(LoadMemoranda());
},
);
}
return Container(); return Container();
}, },
); );
} }
if (state is SignatoriesErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context.read<SignatoriesBloc>().add(LoadSignatories());
},
);
}
return Container(); return Container();
}, },
))); )));

View File

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

View File

@ -12,6 +12,8 @@ import 'package:unit2/model/passo/land_value_adjustment.dart';
import 'package:unit2/model/passo/type_of_location.dart'; import 'package:unit2/model/passo/type_of_location.dart';
import 'package:unit2/model/passo/type_of_road.dart'; import 'package:unit2/model/passo/type_of_road.dart';
import 'package:unit2/theme-data.dart/form-style.dart'; import 'package:unit2/theme-data.dart/form-style.dart';
import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/error_state.dart';
class AddLandValueAdjustmentModal extends StatefulWidget { class AddLandValueAdjustmentModal extends StatefulWidget {
// final List<UnitConstruct> unit; // final List<UnitConstruct> unit;
@ -444,15 +446,44 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
), ),
)); ));
} }
if (state is TypeOfLocationErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context
.read<TypeOfLocationBloc>()
.add(LoadTypeOfLocation());
},
);
}
return Container(); return Container();
}, },
); );
} }
if (state is LandAppraisalErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context
.read<LandAppraisalBloc>()
.add(LoadLandAppraisal());
},
);
}
return Container(); return Container();
}, },
); );
} }
if (state is LandValueAdjustmentsErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context
.read<LandValueAdjustmentsBloc>()
.add(LoadLandValueAdjustments());
},
);
}
return Container(); return Container();
}); });
} }

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -72,6 +72,11 @@ class BuildingHome extends StatelessWidget {
context.read<PropertyInfoBloc>().add(DeleteBuildingFaas(id: itemId)); context.read<PropertyInfoBloc>().add(DeleteBuildingFaas(id: itemId));
} }
void triggerBlocEvent() {
final myBloc = BlocProvider.of<PropertyInfoBloc>(context);
myBloc.add(LoadPropertyInfo());
}
return Scaffold( return Scaffold(
body: ProgressHUD( body: ProgressHUD(
backgroundColor: Colors.black87, backgroundColor: Colors.black87,
@ -206,7 +211,7 @@ class BuildingHome extends StatelessWidget {
BlocProvider( BlocProvider(
create: (context) => create: (context) =>
MemorandaBloc()..add(LoadMemoranda())), MemorandaBloc()..add(LoadMemoranda())),
], child: AddBuilding()); ], child: AddBuilding(triggerBlocEvent));
})); }));
}), }),
SpeedDialChild( SpeedDialChild(

View File

@ -5,17 +5,10 @@ import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:unit2/bloc/passo/barangay/barangay_bloc.dart'; import 'package:unit2/bloc/passo/barangay/barangay_bloc.dart';
import 'package:unit2/bloc/passo/bulding/additional_item/additional_item_bloc.dart'; import 'package:unit2/bloc/passo/bulding/additional_item/additional_item_bloc.dart';
import 'package:unit2/bloc/passo/bulding/additional_items_edit/additional_items_edit_bloc.dart';
import 'package:unit2/bloc/passo/bulding/class_components/class_components_bloc.dart'; import 'package:unit2/bloc/passo/bulding/class_components/class_components_bloc.dart';
import 'package:unit2/bloc/passo/bulding/general_description/general_description_bloc.dart';
import 'package:unit2/bloc/passo/bulding/landref/landref_bloc.dart';
import 'package:unit2/bloc/passo/bulding/location/location_bloc.dart';
import 'package:unit2/bloc/passo/bulding/property_appraisal/property_appraisal_bloc.dart'; import 'package:unit2/bloc/passo/bulding/property_appraisal/property_appraisal_bloc.dart';
import 'package:unit2/bloc/passo/bulding/property_appraisal_edit/property_appraisal_edit_bloc.dart';
import 'package:unit2/bloc/passo/bulding/property_assessment/property_assessment_bloc.dart'; import 'package:unit2/bloc/passo/bulding/property_assessment/property_assessment_bloc.dart';
import 'package:unit2/bloc/passo/bulding/property_assessment_edit/property_assessment_edit_bloc.dart';
import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart'; import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart';
import 'package:unit2/bloc/passo/bulding/structural_material/structural_material_bloc.dart';
import 'package:unit2/bloc/passo/bulding/unit_construct/unit_construct_bloc.dart'; import 'package:unit2/bloc/passo/bulding/unit_construct/unit_construct_bloc.dart';
import 'package:unit2/bloc/passo/land/land_appraisal/land_appraisal_bloc.dart'; import 'package:unit2/bloc/passo/land/land_appraisal/land_appraisal_bloc.dart';
import 'package:unit2/bloc/passo/land/land_boundaries_edit/land_boundaries_edit_bloc.dart'; import 'package:unit2/bloc/passo/land/land_boundaries_edit/land_boundaries_edit_bloc.dart';
@ -38,42 +31,39 @@ import 'package:unit2/bloc/passo/municipality/municipality_bloc.dart';
import 'package:unit2/bloc/passo/signatories/signatories_bloc.dart'; import 'package:unit2/bloc/passo/signatories/signatories_bloc.dart';
import 'package:unit2/bloc/user/user_bloc.dart'; import 'package:unit2/bloc/user/user_bloc.dart';
import 'package:unit2/model/passo/additional_items.dart';
import 'package:unit2/model/passo/general_description.dart';
import 'package:unit2/model/passo/land_appr.dart'; import 'package:unit2/model/passo/land_appr.dart';
import 'package:unit2/model/passo/land_ext.dart'; import 'package:unit2/model/passo/land_ext.dart';
import 'package:unit2/model/passo/land_property_assessment.dart'; import 'package:unit2/model/passo/land_property_assessment.dart';
import 'package:unit2/model/passo/land_property_boundaries.dart'; import 'package:unit2/model/passo/land_property_boundaries.dart';
import 'package:unit2/model/passo/land_property_loc.dart'; import 'package:unit2/model/passo/land_property_loc.dart';
import 'package:unit2/model/passo/land_property_owner.dart'; import 'package:unit2/model/passo/land_property_owner.dart';
import 'package:unit2/model/passo/land_ref.dart';
import 'package:unit2/model/passo/land_value_adjustment.dart'; import 'package:unit2/model/passo/land_value_adjustment.dart';
import 'package:unit2/model/passo/other_improvements.dart'; import 'package:unit2/model/passo/other_improvements.dart';
import 'package:unit2/model/passo/property_appraisal.dart'; import 'package:unit2/model/passo/property_appraisal.dart';
import 'package:unit2/model/passo/property_appraisal_edit.dart';
import 'package:unit2/model/passo/property_assessment_edit.dart';
import 'package:unit2/model/passo/property_info.dart';
import 'package:unit2/model/passo/structural_materials_ii.dart';
import 'package:unit2/model/passo/structureMaterial.dart';
import 'package:unit2/model/profile/basic_information/primary-information.dart'; import 'package:unit2/model/profile/basic_information/primary-information.dart';
import 'package:unit2/screens/passo/Building/add_building.dart'; import 'package:unit2/screens/passo/Building/add_building.dart';
import 'package:unit2/screens/passo/Building/edit_building.dart';
import 'package:unit2/screens/passo/Land/add_land.dart'; import 'package:unit2/screens/passo/Land/add_land.dart';
import 'package:unit2/screens/passo/Land/edit_land.dart'; import 'package:unit2/screens/passo/Land/edit_land.dart';
import 'package:unit2/screens/passo/Test%20Envi/multi_dropdown.dart';
import 'package:unit2/screens/passo/Test%20Envi/speed_dial.dart';
import 'package:unit2/theme-data.dart/colors.dart'; import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/alerts.dart';
import 'package:unit2/utils/text_container.dart'; import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/error_state.dart'; import 'package:unit2/widgets/error_state.dart';
import 'package:flutter_speed_dial/flutter_speed_dial.dart'; import 'package:flutter_speed_dial/flutter_speed_dial.dart';
import '../../model/passo/bldg_loc.dart';
class LandHome extends StatelessWidget { class LandHome extends StatelessWidget {
const LandHome({super.key}); const LandHome({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
void deleteItem(int itemId) {
context.read<LandPropertyOwnerInfoBloc>().add(DeleteLandFaas(id: itemId));
}
void triggerBlocEvent() {
final myBloc = BlocProvider.of<PropertyInfoBloc>(context);
myBloc.add(LoadPropertyInfo());
}
int? profileId; int? profileId;
String? token; String? token;
Profile profile; Profile profile;
@ -114,8 +104,8 @@ class LandHome extends StatelessWidget {
shrinkWrap: true, shrinkWrap: true,
itemCount: propertyList.length, itemCount: propertyList.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return _listCard( return _listCard(propertyList[index], context,
propertyList[index], context, index); index, deleteItem);
}, },
), ),
), ),
@ -133,6 +123,20 @@ class LandHome extends StatelessWidget {
}, },
); );
} }
if (state is LandFaasDeletedState) {
if (state.success) {
WidgetsBinding.instance.addPostFrameCallback((_) {
successAlert(context, "Deletion Successful",
"Land FAAS Data has been deleted successfully", () {
Navigator.of(context).pop();
context
.read<LandPropertyOwnerInfoBloc>()
.add(const LoadLand());
});
});
}
}
return Container(); return Container();
}, },
); );
@ -195,7 +199,7 @@ class LandHome extends StatelessWidget {
BlocProvider( BlocProvider(
create: (context) => create: (context) =>
MemorandaBloc()..add(LoadMemoranda())), MemorandaBloc()..add(LoadMemoranda())),
], child: AddBuilding()); ], child: AddBuilding(triggerBlocEvent));
})); }));
}), }),
SpeedDialChild( SpeedDialChild(
@ -281,7 +285,7 @@ class LandHome extends StatelessWidget {
} }
} }
Card _listCard(LandPropertyOwner property_info, context, index) { Card _listCard(LandPropertyOwner property_info, context, index, deleteItem) {
return Card( return Card(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
@ -417,7 +421,13 @@ Card _listCard(LandPropertyOwner property_info, context, index) {
], ],
), ),
), ),
IconButton(onPressed: () {}, icon: const Icon(Icons.chevron_right)), IconButton(
onPressed: () {
deleteItem(property_info.id);
},
icon: const Icon(Icons.delete_rounded),
color: primary,
),
], ],
), ),
), ),

View File

@ -72,4 +72,29 @@ class LandServices {
} }
return response; return response;
} }
Future<http.Response> remove(id) async {
String path = Url.instance.getLandOwnerInfo();
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
Map<String, String> params = {
"id": id.toString(),
};
try {
http.Response response = await Request.instance
.deleteRequest(path: path, headers: headers, body: {}, param: params);
print(id);
if (response.statusCode == 200) {
print(response.body);
return response;
} else {
throw Exception(response.reasonPhrase);
}
} catch (e) {
throw e.toString();
}
}
} }

View File

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