fixed conflicts

feature/passo/PASSO-#1-Sync-data-from-device-to-postgre-and-vice-versa
PGAN-MIS 2023-09-22 16:16:33 +08:00
commit 4cfa75e8b8
81 changed files with 10239 additions and 5420 deletions

View File

@ -27,6 +27,8 @@ class AdditionalItemBloc
} }
}); });
on<AddAdditionalItems>((event, emit) async { on<AddAdditionalItems>((event, emit) async {
emit(AdditionalItemsLoading());
try {
http.Response response = http.Response response =
(await AdditionalItemsServices.instance.add(event.items))!; (await AdditionalItemsServices.instance.add(event.items))!;
print(response.body); print(response.body);
@ -39,6 +41,11 @@ class AdditionalItemBloc
globalAdditionalItems.add(newAdditional); globalAdditionalItems.add(newAdditional);
emit(AdditionalItemsLoaded(globalAdditionalItems)); emit(AdditionalItemsLoaded(globalAdditionalItems));
} else {
emit(AdditionalItemsErrorState('error'));
}
} catch (e) {
emit(AdditionalItemsErrorState(e.toString()));
} }
}); });
on<DeleteAdditionalItems>((event, emit) async { on<DeleteAdditionalItems>((event, emit) async {

View File

@ -18,7 +18,7 @@ class PropertyAppraisalBloc
emit(PropertyAppraisalLoading()); emit(PropertyAppraisalLoading());
try { try {
final appraisal = await PropertyAppraisalServices.instance.fetch(); final appraisal = await PropertyAppraisalServices.instance.fetch();
print(appraisal);
emit(PropertyAppraisalLoaded(appraisal)); emit(PropertyAppraisalLoaded(appraisal));
} catch (e) { } catch (e) {
emit(PropertyAppraisalErrorState(e.toString())); emit(PropertyAppraisalErrorState(e.toString()));
@ -26,19 +26,21 @@ class PropertyAppraisalBloc
}); });
on<AddPropertyAppraisal>((event, emit) async { on<AddPropertyAppraisal>((event, emit) async {
final tempID = await SharedPreferences.getInstance(); final tempID = await SharedPreferences.getInstance();
emit(PropertyAppraisalLoading());
try {
http.Response response = (await PropertyAppraisalServices.instance http.Response response = (await PropertyAppraisalServices.instance
.update(event.appraisal, tempID.getInt('tempid')! - 1))!; .update(event.appraisal, tempID.getInt('tempid')! - 1))!;
print('Appraisal');
if (response.statusCode == 201) { print(tempID.getInt('tempid')! - 1);
var jsonResponse = jsonDecode(response.body); print(event.appraisal.toJson());
PropertyAppraisal newAppraisal = print(response.body);
PropertyAppraisal.fromJson(jsonResponse['data']); if (response.statusCode == 200) {
print("PA"); emit(ShowPropertyAppraisalSuccessAlertState());
print(newAppraisal); }
print(response.statusCode); } catch (e) {
print('app error');
emit(PropertyAppraisalLoaded(newAppraisal)); print(e.toString());
emit(ShowPropertyAppraisalErrorAlertState());
} }
}); });
} }

View File

@ -26,3 +26,7 @@ class PropertyAppraisalErrorState extends PropertyAppraisalState {
@override @override
List<Object> get props => [error]; List<Object> get props => [error];
} }
class ShowPropertyAppraisalErrorAlertState extends PropertyAppraisalState {}
class ShowPropertyAppraisalSuccessAlertState extends PropertyAppraisalState {}

View File

@ -18,10 +18,11 @@ class PropertyAssessmentBloc
emit(PropertyAssessmentLoading()); emit(PropertyAssessmentLoading());
try { try {
final tempID = await SharedPreferences.getInstance(); final tempID = await SharedPreferences.getInstance();
print(tempID.getInt('tempid')! - 1);
final assessments = await PropertyAssessmentServices.instance final assessments = await PropertyAssessmentServices.instance
.fetch(tempID.getInt('tempid')! + 1); .fetch(tempID.getInt('tempid')! - 1);
print(assessments);
emit(PropertyAssessmentLoaded(assessments)); emit(PropertyAssessmentLoaded(assessments));
} catch (e) { } catch (e) {
emit(PropertyAssessmentErrorState(e.toString())); emit(PropertyAssessmentErrorState(e.toString()));

View File

@ -18,8 +18,6 @@ class PropertyAssessmentEditBloc
on<LoadPropertyAssessmentEdit>((event, emit) async { on<LoadPropertyAssessmentEdit>((event, emit) async {
emit(PropertyAssessmentEditLoading()); emit(PropertyAssessmentEditLoading());
try { try {
final tempID = await SharedPreferences.getInstance();
final assessments = final assessments =
await PropertyAssessmentServices.instance.fetchEdit(event.id); await PropertyAssessmentServices.instance.fetchEdit(event.id);

View File

@ -48,6 +48,7 @@ class PropertyInfoBloc extends Bloc<PropertyInfoEvent, PropertyInfoState> {
} }
}); });
on<UpdatPropertyInfo>(((event, emit) async { on<UpdatPropertyInfo>(((event, emit) async {
emit(PropertyInfoLoading());
final state = this.state; final state = this.state;
try { try {
http.Response response = (await PropertyInfoService.instance http.Response response = (await PropertyInfoService.instance
@ -60,11 +61,17 @@ class PropertyInfoBloc extends Bloc<PropertyInfoEvent, PropertyInfoState> {
})); }));
on<UpdateBldgLoc>(((event, emit) async { on<UpdateBldgLoc>(((event, emit) async {
final state = this.state; final state = this.state;
try { try {
http.Response response = (await PropertyInfoService.instance http.Response response = (await PropertyInfoService.instance
.updateBldg(event.bldg_loc, event.bldg_loc.id))!; .updateBldg(event.bldg_loc, event.bldg_loc.id))!;
print('bldgLoc'); print('bldgLoc');
print(response.statusCode); print(response.statusCode);
if (response.statusCode == 200) {
emit(ShowBldgLocSuccessAlertState());
} else {
emit(ShowBldgLocErrorAlertState());
}
} catch (e) { } catch (e) {
emit(PropertyInfoErrorState(e.toString())); emit(PropertyInfoErrorState(e.toString()));
} }
@ -72,11 +79,17 @@ class PropertyInfoBloc extends Bloc<PropertyInfoEvent, PropertyInfoState> {
on<UpdateLandRef>( on<UpdateLandRef>(
(event, emit) async { (event, emit) async {
final state = this.state; final state = this.state;
emit(PropertyInfoLoading());
try { try {
http.Response response = (await PropertyInfoService.instance http.Response response = (await PropertyInfoService.instance
.updateLandRef(event.land_ref, event.land_ref.id))!; .updateLandRef(event.land_ref, event.land_ref.id))!;
print('landref'); print('landref');
print(response.body); print(response.body);
if (response.statusCode == 200) {
emit(ShowLandRefSuccessAlertState());
} else {
emit(ShowLandRefErrorAlertState());
}
} catch (e) { } catch (e) {
emit(PropertyInfoErrorState(e.toString())); emit(PropertyInfoErrorState(e.toString()));
} }
@ -85,11 +98,17 @@ class PropertyInfoBloc extends Bloc<PropertyInfoEvent, PropertyInfoState> {
on<UpdateGeneralDesc>((event, emit) async { on<UpdateGeneralDesc>((event, emit) async {
final state = this.state; final state = this.state;
emit(PropertyInfoLoading());
try { try {
http.Response response = (await PropertyInfoService.instance http.Response response = (await PropertyInfoService.instance
.updateGenDesc(event.gen_desc, event.gen_desc.id))!; .updateGenDesc(event.gen_desc, event.gen_desc.id))!;
print('genDesc'); print('genDesc');
print(response.body); print(response.body);
if (response.statusCode == 200) {
emit(ShowGenDescSuccessAlertState());
} else {
emit(ShowGenDescErrorAlertState());
}
} catch (e) { } catch (e) {
emit(PropertyInfoErrorState(e.toString())); emit(PropertyInfoErrorState(e.toString()));
} }
@ -97,6 +116,7 @@ class PropertyInfoBloc extends Bloc<PropertyInfoEvent, PropertyInfoState> {
on<UpdateStrucMaterials>((event, emit) async { on<UpdateStrucMaterials>((event, emit) async {
final state = this.state; final state = this.state;
emit(PropertyInfoLoading());
try { try {
final tempID = await SharedPreferences.getInstance(); final tempID = await SharedPreferences.getInstance();
print(tempID.getInt('tempid')! - 1); print(tempID.getInt('tempid')! - 1);
@ -104,9 +124,25 @@ class PropertyInfoBloc extends Bloc<PropertyInfoEvent, PropertyInfoState> {
.update(event.data, event.data.id))!; .update(event.data, event.data.id))!;
print('struc Material'); print('struc Material');
print(response.body); print(response.body);
if (response.statusCode == 200) {
emit(ShowStrucMatSuccessAlertState());
} else {
emit(ShowStrucMatErrorAlertState());
}
} catch (e) { } catch (e) {
emit(PropertyInfoErrorState(e.toString())); emit(PropertyInfoErrorState(e.toString()));
} }
}); });
on<DeleteBuildingFaas>((event, emit) async {
print(event.id);
emit(PropertyInfoLoading());
http.Response response =
(await PropertyInfoService.instance.remove(event.id));
print(response.statusCode);
if (response.statusCode == 200) {
emit(BuildingFaasDeletedState(success: true));
}
});
} }
} }

View File

@ -73,3 +73,16 @@ class UpdateStrucMaterials extends PropertyInfoEvent {
@override @override
List<Object> get props => [data]; List<Object> get props => [data];
} }
class DeleteBuildingFaas extends PropertyInfoEvent {
final int id;
const DeleteBuildingFaas({required this.id});
@override
List<Object> get props => [id];
}
class ShowBldgLocErrorAlert extends PropertyInfoEvent {}
class ShowLandRefErrorAlert extends PropertyInfoEvent {}

View File

@ -24,3 +24,26 @@ class PropertyInfoErrorState extends PropertyInfoState {
@override @override
List<Object> get props => [error]; List<Object> get props => [error];
} }
class BuildingFaasDeletedState extends PropertyInfoState {
final bool success;
const BuildingFaasDeletedState({required this.success});
@override
List<Object> get props => [success];
}
class ShowBldgLocErrorAlertState extends PropertyInfoState {}
class ShowLandRefErrorAlertState extends PropertyInfoState {}
class ShowGenDescErrorAlertState extends PropertyInfoState {}
class ShowStrucMatErrorAlertState extends PropertyInfoState {}
class ShowStrucMatSuccessAlertState extends PropertyInfoState {}
class ShowBldgLocSuccessAlertState extends PropertyInfoState {}
class ShowLandRefSuccessAlertState extends PropertyInfoState {}
class ShowGenDescSuccessAlertState extends PropertyInfoState {}

View File

@ -18,7 +18,7 @@ class LandAppraisalBloc extends Bloc<LandAppraisalEvent, LandAppraisalState> {
final tempID = await SharedPreferences.getInstance(); final tempID = await SharedPreferences.getInstance();
print(tempID.getInt('landid')); print(tempID.getInt('landid'));
final additionalItems = final additionalItems =
await LandAppraisalServices.instance.fetch(tempID.getInt('tempid')); await LandAppraisalServices.instance.fetch(tempID.getInt('landid'));
globalLandAppraisal globalLandAppraisal
.addAll(additionalItems); // Append all items to the list .addAll(additionalItems); // Append all items to the list
@ -27,6 +27,19 @@ class LandAppraisalBloc extends Bloc<LandAppraisalEvent, LandAppraisalState> {
emit(LandAppraisalErrorState(e.toString())); emit(LandAppraisalErrorState(e.toString()));
} }
}); });
on<LoadLandAppraisalEdit>((event, emit) async {
emit(LandAppraisalLoading());
try {
final additionalItems =
await LandAppraisalServices.instance.fetch(event.id);
globalLandAppraisal.clear();
globalLandAppraisal
.addAll(additionalItems); // Append all items to the list
emit(LandAppraisalLoaded(globalLandAppraisal));
} catch (e) {
emit(LandAppraisalErrorState(e.toString()));
}
});
on<AddLandAppraisal>((event, emit) async { on<AddLandAppraisal>((event, emit) async {
http.Response response = http.Response response =
(await LandAppraisalServices.instance.add(event.land_appr))!; (await LandAppraisalServices.instance.add(event.land_appr))!;

View File

@ -16,6 +16,16 @@ class LoadLandAppraisal extends LandAppraisalEvent {
List<Object> get props => [land_appr]; List<Object> get props => [land_appr];
} }
class LoadLandAppraisalEdit extends LandAppraisalEvent {
final List<LandAppr> land_appr;
final int id;
const LoadLandAppraisalEdit({required this.land_appr, required this.id});
@override
List<Object> get props => [land_appr];
}
class AddLandAppraisal extends LandAppraisalEvent { class AddLandAppraisal extends LandAppraisalEvent {
final LandAppr land_appr; final LandAppr land_appr;

View File

@ -0,0 +1,54 @@
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:unit2/model/passo/land_property_boundaries.dart';
import 'package:http/http.dart' as http;
import 'package:unit2/sevices/passo/land/land_boundaries.dart';
part 'land_boundaries_edit_event.dart';
part 'land_boundaries_edit_state.dart';
class LandBoundariesEditBloc
extends Bloc<LandBoundariesEditEvent, LandBoundariesEditState> {
LandBoundariesEditBloc() : super(LandBoundariesEditInitial()) {
on<LoadLandBoundariesEdit>((event, emit) async {
emit(LandBoundariesEditLoading());
try {
final tempID = await SharedPreferences.getInstance();
final assessments =
await LandBoundariesService.instance.fetchEdit(event.id);
emit(LandBoundariesEditLoaded(assessments));
} catch (e) {
emit(LandBoundariesEditErrorState(e.toString()));
}
});
// on<AddLandLocationEdit>((event, emit) async {
// http.Response response = (await LandLocationService.instance
// .addEdit(event.land_loc_edit))!;
// print('Assessment');
// print(response.statusCode);
// print(response.body);
// if (response.statusCode == 201) {
// var jsonResponse = jsonDecode(response.body);
// LandPropertyLoc newAssessment =
// LandPropertyLoc.fromJson(jsonResponse['data']);
// globalLandLocationEdit = newAssessment;
// emit(LandLocationEditLoaded(globalLandBoundariesEdit));
// }
// });
on<UpdateLandBoundariesEdit>((event, emit) async {
http.Response response = (await LandBoundariesService.instance
.updateEdit(event.land_boundaries_edit, event.id))!;
print('landloc edit');
print(response.statusCode);
print(response.body);
// if (response.statusCode == 201) {
// final faas = await PropertyInfoRepository.getUsers();
// emit(FaasLoaded(faas));
// }
});
}
}

View File

@ -0,0 +1,41 @@
part of 'land_boundaries_edit_bloc.dart';
class LandBoundariesEditEvent extends Equatable {
const LandBoundariesEditEvent();
@override
List<Object> get props => [];
}
class LoadLandBoundariesEdit extends LandBoundariesEditEvent {
final LandPropertyBoundaries land_boundaries_edit;
final int? id;
const LoadLandBoundariesEdit(
{required this.land_boundaries_edit, required this.id});
@override
List<Object> get props => [land_boundaries_edit];
}
class AddLandBoundariesEdit extends LandBoundariesEditEvent {
final LandPropertyBoundaries land_boundaries_edit;
const AddLandBoundariesEdit({required this.land_boundaries_edit});
@override
List<Object> get props => [land_boundaries_edit];
}
class UpdateLandBoundariesEdit extends LandBoundariesEditEvent {
// ignore: non_constant_identifier_names
final LandPropertyBoundaries land_boundaries_edit;
final int id;
// ignore: non_constant_identifier_names
const UpdateLandBoundariesEdit(
{required this.land_boundaries_edit, required this.id});
@override
List<Object> get props => [land_boundaries_edit];
}

View File

@ -0,0 +1,28 @@
part of 'land_boundaries_edit_bloc.dart';
class LandBoundariesEditState extends Equatable {
const LandBoundariesEditState();
@override
List<Object> get props => [];
}
class LandBoundariesEditInitial extends LandBoundariesEditState {}
class LandBoundariesEditLoading extends LandBoundariesEditState {}
class LandBoundariesEditLoaded extends LandBoundariesEditState {
LandBoundariesEditLoaded(this.land_boundaries_edit);
final LandPropertyBoundaries land_boundaries_edit;
@override
List<Object> get props => [land_boundaries_edit];
}
class LandBoundariesEditErrorState extends LandBoundariesEditState {
LandBoundariesEditErrorState(this.error);
final String error;
@override
List<Object> get props => [error];
}

View File

@ -0,0 +1,53 @@
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:unit2/model/passo/land_ext.dart';
import 'package:unit2/sevices/passo/land/land_ext.dart';
import 'package:http/http.dart' as http;
part 'land_ext_edit_event.dart';
part 'land_ext_edit_state.dart';
class LandExtEditBloc extends Bloc<LandExtEditEvent, LandExtEditState> {
LandExtEditBloc() : super(LandExtEditInitial()) {
on<LoadLandExtEdit>((event, emit) async {
emit(LandExtEditLoading());
try {
final tempID = await SharedPreferences.getInstance();
final assessments = await LandExtServices.instance.fetchEdit(event.id);
emit(LandExtEditLoaded(assessments));
} catch (e) {
print(e.toString());
emit(LandExtEditErrorState(e.toString()));
}
});
// on<AddLandLocationEdit>((event, emit) async {
// http.Response response = (await LandLocationService.instance
// .addEdit(event.land_loc_edit))!;
// print('Assessment');
// print(response.statusCode);
// print(response.body);
// if (response.statusCode == 201) {
// var jsonResponse = jsonDecode(response.body);
// LandPropertyLoc newAssessment =
// LandPropertyLoc.fromJson(jsonResponse['data']);
// globalLandLocationEdit = newAssessment;
// emit(LandLocationEditLoaded(globalLandLocationEdit));
// }
// });
on<UpdateLandExtEdit>((event, emit) async {
http.Response response = (await LandExtServices.instance
.updateEdit(event.land_ext_edit, event.id))!;
print('landloc edit');
print(response.statusCode);
print(response.body);
// if (response.statusCode == 201) {
// final faas = await PropertyInfoRepository.getUsers();
// emit(FaasLoaded(faas));
// }
});
}
}

View File

@ -0,0 +1,39 @@
part of 'land_ext_edit_bloc.dart';
class LandExtEditEvent extends Equatable {
const LandExtEditEvent();
@override
List<Object> get props => [];
}
class LoadLandExtEdit extends LandExtEditEvent {
final LandExt land_ext_edit;
final int? id;
const LoadLandExtEdit({required this.land_ext_edit, required this.id});
@override
List<Object> get props => [land_ext_edit];
}
class AddLandExtEdit extends LandExtEditEvent {
final LandExt land_ext_edit;
const AddLandExtEdit({required this.land_ext_edit});
@override
List<Object> get props => [land_ext_edit];
}
class UpdateLandExtEdit extends LandExtEditEvent {
// ignore: non_constant_identifier_names
final LandExt land_ext_edit;
final int id;
// ignore: non_constant_identifier_names
const UpdateLandExtEdit({required this.land_ext_edit, required this.id});
@override
List<Object> get props => [land_ext_edit];
}

View File

@ -0,0 +1,28 @@
part of 'land_ext_edit_bloc.dart';
class LandExtEditState extends Equatable {
const LandExtEditState();
@override
List<Object> get props => [];
}
class LandExtEditInitial extends LandExtEditState {}
class LandExtEditLoading extends LandExtEditState {}
class LandExtEditLoaded extends LandExtEditState {
LandExtEditLoaded(this.land_ext_edit);
final LandExt land_ext_edit;
@override
List<Object> get props => [land_ext_edit];
}
class LandExtEditErrorState extends LandExtEditState {
LandExtEditErrorState(this.error);
final String error;
@override
List<Object> get props => [error];
}

View File

@ -0,0 +1,59 @@
import 'dart:convert';
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:unit2/model/passo/land_property_loc.dart';
import 'package:http/http.dart' as http;
import 'package:unit2/sevices/passo/land/land_location.dart';
part 'land_location_edit_event.dart';
part 'land_location_edit_state.dart';
class LandLocationEditBloc
extends Bloc<LandLocationEditEvent, LandLocationEditState> {
LandPropertyLoc globalLandLocationEdit;
LandLocationEditBloc()
: globalLandLocationEdit = LandPropertyLoc(),
super(LandLocationEditInitial()) {
on<LoadLandLocationEdit>((event, emit) async {
emit(LandLocationEditLoading());
try {
final tempID = await SharedPreferences.getInstance();
final assessments =
await LandLocationService.instance.fetchEdit(event.id);
emit(LandLocationEditLoaded(assessments));
} catch (e) {
emit(LandLocationEditErrorState(e.toString()));
}
});
// on<AddLandLocationEdit>((event, emit) async {
// http.Response response = (await LandLocationService.instance
// .addEdit(event.land_loc_edit))!;
// print('Assessment');
// print(response.statusCode);
// print(response.body);
// if (response.statusCode == 201) {
// var jsonResponse = jsonDecode(response.body);
// LandPropertyLoc newAssessment =
// LandPropertyLoc.fromJson(jsonResponse['data']);
// globalLandLocationEdit = newAssessment;
// emit(LandLocationEditLoaded(globalLandLocationEdit));
// }
// });
on<UpdateLandLocationEdit>((event, emit) async {
http.Response response = (await LandLocationService.instance
.updateEdit(event.land_loc_edit, event.id))!;
print('landloc edit');
print(response.statusCode);
print(response.body);
// if (response.statusCode == 201) {
// final faas = await PropertyInfoRepository.getUsers();
// emit(FaasLoaded(faas));
// }
});
}
}

View File

@ -0,0 +1,39 @@
part of 'land_location_edit_bloc.dart';
class LandLocationEditEvent extends Equatable {
const LandLocationEditEvent();
@override
List<Object> get props => [];
}
class LoadLandLocationEdit extends LandLocationEditEvent {
final LandPropertyLoc land_loc_edit;
final int? id;
const LoadLandLocationEdit({required this.land_loc_edit, required this.id});
@override
List<Object> get props => [land_loc_edit];
}
class AddLandLocationEdit extends LandLocationEditEvent {
final LandPropertyLoc land_loc_edit;
const AddLandLocationEdit({required this.land_loc_edit});
@override
List<Object> get props => [land_loc_edit];
}
class UpdateLandLocationEdit extends LandLocationEditEvent {
// ignore: non_constant_identifier_names
final LandPropertyLoc land_loc_edit;
final int id;
// ignore: non_constant_identifier_names
const UpdateLandLocationEdit({required this.land_loc_edit, required this.id});
@override
List<Object> get props => [land_loc_edit];
}

View File

@ -0,0 +1,28 @@
part of 'land_location_edit_bloc.dart';
class LandLocationEditState extends Equatable {
const LandLocationEditState();
@override
List<Object> get props => [];
}
class LandLocationEditInitial extends LandLocationEditState {}
class LandLocationEditLoading extends LandLocationEditState {}
class LandLocationEditLoaded extends LandLocationEditState {
LandLocationEditLoaded(this.land_loc_edit);
final LandPropertyLoc land_loc_edit;
@override
List<Object> get props => [land_loc_edit];
}
class LandLocationEditErrorState extends LandLocationEditState {
LandLocationEditErrorState(this.error);
final String error;
@override
List<Object> get props => [error];
}

View File

@ -29,6 +29,19 @@ class LandPropertyAssessmentBloc
emit(LandPropertyAssessmentErrorState(e.toString())); emit(LandPropertyAssessmentErrorState(e.toString()));
} }
}); });
on<LoadLandPropertyAssessmentEdit>((event, emit) async {
emit(LandPropertyAssessmentLoading());
try {
final additionalItems =
await LandPropertyAssessmentServices.instance.fetch(event.id);
globalLandPropertyAssessment.clear();
globalLandPropertyAssessment
.addAll(additionalItems); // Append all items to the list
emit(LandPropertyAssessmentLoaded(globalLandPropertyAssessment));
} catch (e) {
emit(LandPropertyAssessmentErrorState(e.toString()));
}
});
on<AddLandPropertyAssessment>((event, emit) async { on<AddLandPropertyAssessment>((event, emit) async {
http.Response response = (await LandPropertyAssessmentServices.instance http.Response response = (await LandPropertyAssessmentServices.instance
.add(event.assessment))!; .add(event.assessment))!;

View File

@ -17,6 +17,17 @@ class LoadLandPropertyAssessment extends LandPropertyAssessmentEvent {
List<Object> get props => [assessment]; List<Object> get props => [assessment];
} }
class LoadLandPropertyAssessmentEdit extends LandPropertyAssessmentEvent {
final List<LandPropertyAssessment> assessment;
final int id;
const LoadLandPropertyAssessmentEdit(
{required this.assessment, required this.id});
@override
List<Object> get props => [assessment];
}
class AddLandPropertyAssessment extends LandPropertyAssessmentEvent { class AddLandPropertyAssessment extends LandPropertyAssessmentEvent {
final LandPropertyAssessment assessment; final LandPropertyAssessment assessment;

View File

@ -10,6 +10,7 @@ import 'package:unit2/sevices/passo/land/land_boundaries.dart';
import 'package:unit2/sevices/passo/land/land_location.dart'; import 'package:unit2/sevices/passo/land/land_location.dart';
import 'package:unit2/sevices/passo/land/land_property_owner.dart'; import 'package:unit2/sevices/passo/land/land_property_owner.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:unit2/utils/text_container.dart';
part 'land_property_owner_info_event.dart'; part 'land_property_owner_info_event.dart';
part 'land_property_owner_info_state.dart'; part 'land_property_owner_info_state.dart';
@ -25,33 +26,39 @@ class LandPropertyOwnerInfoBloc
emit(LandErrorState(e.toString())); emit(LandErrorState(e.toString()));
} }
}); });
on<AddPropertyOwnerLand>((event, emit) async { on<AddPropertyOwnerLand>((event, emit) async {
http.Response response = (await LandServices.instance.add(event.land))!; http.Response response = (await LandServices.instance.add(event.land))!;
if (response.statusCode == 201) { if (response.statusCode == 201) {
var jsonResponse = jsonDecode(response.body); var jsonResponse = jsonDecode(response.body);
var details = jsonResponse['data']['details']; var details = jsonResponse['data'];
print(jsonResponse);
if (details != null) {
var id = details['id']; var id = details['id'];
final tempID = await SharedPreferences.getInstance(); final tempID = await SharedPreferences.getInstance();
print(id); print(id);
await tempID.setInt('landid', id + 1); await tempID.setInt('landid', id + 1);
final faas = await LandServices.instance.fetch(); final faas = await LandServices.instance.fetch();
emit(LandLoaded(faas)); emit(LandLoaded(faas));
} else {
print("No 'details' object found in the response.");
// Handle the case when 'details' is missing
}
} }
}); });
on<UpdateLandPropertyOwner>((event, emit) async {
final state = this.state;
http.Response response = (await LandServices.instance
.update(event.land_edit, event.land_edit.id))!;
print('Land LOc');
print(response.body);
});
on<UpdateLandLoc>((event, emit) async { on<UpdateLandLoc>((event, emit) async {
final state = this.state; final state = this.state;
http.Response response = (await LandLocationService.instance http.Response response = (await LandLocationService.instance
.update(event.land_loc, event.land_loc.id))!; .update(event.land_loc, event.land_loc.id))!;
print(event.land_loc.id!);
print('Land LOc'); print('Land LOc');
print(response.body); print(response.statusCode);
}); });
on<UpdateLandBoundaries>((event, emit) async { on<UpdateLandBoundaries>((event, emit) async {

View File

@ -25,6 +25,18 @@ class AddPropertyOwnerLand extends LandPropertyOwnerInfoEvent {
List<Object> get props => [land]; List<Object> get props => [land];
} }
class UpdateLandPropertyOwner extends LandPropertyOwnerInfoEvent {
// ignore: non_constant_identifier_names
final LandPropertyOwner land_edit;
final int id;
// ignore: non_constant_identifier_names
const UpdateLandPropertyOwner({required this.land_edit, required this.id});
@override
List<Object> get props => [land_edit];
}
class UpdateLandLoc extends LandPropertyOwnerInfoEvent { class UpdateLandLoc extends LandPropertyOwnerInfoEvent {
// ignore: non_constant_identifier_names // ignore: non_constant_identifier_names
final LandPropertyLoc land_loc; final LandPropertyLoc land_loc;

View File

@ -17,14 +17,6 @@ class LandLoaded extends LandPropertyOwnerInfoState {
List<Object> get props => [land]; List<Object> get props => [land];
} }
// class PropertyAppraisalLoaded extends AssessorsState {
// PropertyAppraisalLoaded(this.appraisal);
// final List<PropertyAppraisal> appraisal;
// @override
// List<Object> get props => [appraisal];
// }
class LandErrorState extends LandPropertyOwnerInfoState { class LandErrorState extends LandPropertyOwnerInfoState {
const LandErrorState(this.error); const LandErrorState(this.error);
final String error; final String error;

View File

@ -25,6 +25,19 @@ class LandValueAdjustmentsBloc
emit(LandValueAdjustmentsErrorState(e.toString())); emit(LandValueAdjustmentsErrorState(e.toString()));
} }
}); });
on<LoadLandValueAdjustmentsEdit>((event, emit) async {
emit(LandValueAdjustmentsLoading());
try {
final additionalItems =
await ValueAdjustmentsServices.instance.fetch(event.id);
globalLandValueAdjustments.clear();
globalLandValueAdjustments
.addAll(additionalItems); // Append all items to the list
emit(LandValueAdjustmentsLoaded(globalLandValueAdjustments));
} catch (e) {
emit(LandValueAdjustmentsErrorState(e.toString()));
}
});
on<AddLandValueAdjustments>((event, emit) async { on<AddLandValueAdjustments>((event, emit) async {
http.Response response = http.Response response =
(await ValueAdjustmentsServices.instance.add(event.val_adj))!; (await ValueAdjustmentsServices.instance.add(event.val_adj))!;

View File

@ -16,6 +16,16 @@ class LoadLandValueAdjustments extends LandValueAdjustmentsEvent {
List<Object> get props => [val_adj]; List<Object> get props => [val_adj];
} }
class LoadLandValueAdjustmentsEdit extends LandValueAdjustmentsEvent {
final List<ValueAdjustments> val_adj;
final int id;
const LoadLandValueAdjustmentsEdit({required this.val_adj, required this.id});
@override
List<Object> get props => [val_adj];
}
class AddLandValueAdjustments extends LandValueAdjustmentsEvent { class AddLandValueAdjustments extends LandValueAdjustmentsEvent {
final ValueAdjustments val_adj; final ValueAdjustments val_adj;

View File

@ -25,6 +25,21 @@ class OtherImprovementsBloc
emit(OtherImprovementErrorState(e.toString())); emit(OtherImprovementErrorState(e.toString()));
} }
}); });
on<LoadOtherImprovementEdit>((event, emit) async {
emit(OtherImprovementLoading());
try {
final additionalItems =
await OtherImprovementServices.instance.fetch(event.ids);
print(additionalItems);
globalOtherImprovement.clear();
globalOtherImprovement
.addAll(additionalItems); // Append all items to the list
emit(OtherImprovementLoaded(globalOtherImprovement));
} catch (e) {
print(e.toString());
emit(OtherImprovementErrorState(e.toString()));
}
});
on<AddOtherImprovement>((event, emit) async { on<AddOtherImprovement>((event, emit) async {
http.Response response = http.Response response =
(await OtherImprovementServices.instance.add(event.other_imp))!; (await OtherImprovementServices.instance.add(event.other_imp))!;

View File

@ -16,6 +16,16 @@ class LoadOtherImprovement extends OtherImprovementsEvent {
List<Object> get props => [other_imp]; List<Object> get props => [other_imp];
} }
class LoadOtherImprovementEdit extends OtherImprovementsEvent {
final List<OtherImprovements> other_imps;
final int ids;
const LoadOtherImprovementEdit({required this.other_imps, required this.ids});
@override
List<Object> get props => [other_imps];
}
class AddOtherImprovement extends OtherImprovementsEvent { class AddOtherImprovement extends OtherImprovementsEvent {
final OtherImprovements other_imp; final OtherImprovements other_imp;

View File

@ -1,3 +1,5 @@
import 'dart:convert';
import 'package:bloc/bloc.dart'; import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
import 'package:unit2/model/passo/memoranda.dart'; import 'package:unit2/model/passo/memoranda.dart';
@ -7,12 +9,22 @@ part 'memoranda_event.dart';
part 'memoranda_state.dart'; part 'memoranda_state.dart';
class MemorandaBloc extends Bloc<MemorandaEvent, MemorandaState> { class MemorandaBloc extends Bloc<MemorandaEvent, MemorandaState> {
MemorandaBloc() : super(MemorandaInitial()) { MemorandaBloc() : super(MemorandaLoading()) {
on<LoadMemoranda>((event, emit) async { on<LoadMemoranda>((event, emit) async {
emit(MemorandaLoading()); emit(MemorandaLoading());
try { try {
final municipality = await MemorandaServices.instance.fetch(); final response = await MemorandaServices.instance.fetch();
emit(MemorandaLoaded(municipality)); print('Memoranda bloc');
print(response.statusCode);
print(response.body);
if (response.statusCode == 200) {
final List result = jsonDecode(response.body)['data'];
emit(MemorandaLoaded(
result.map(((e) => Memoranda.fromJson(e))).toList()));
} else {
emit(MemorandaErrorState(response.reasonPhrase!));
}
} catch (e) { } catch (e) {
emit(MemorandaErrorState(e.toString())); emit(MemorandaErrorState(e.toString()));
} }

View File

@ -12,15 +12,14 @@ class MemorandaInitial extends MemorandaState {}
class MemorandaLoading extends MemorandaState {} class MemorandaLoading extends MemorandaState {}
class MemorandaLoaded extends MemorandaState { class MemorandaLoaded extends MemorandaState {
MemorandaLoaded(this.memorada);
final List<Memoranda> memorada; final List<Memoranda> memorada;
const MemorandaLoaded(this.memorada);
@override @override
List<Object> get props => [memorada]; List<Object> get props => [memorada];
} }
class MemorandaErrorState extends MemorandaState { class MemorandaErrorState extends MemorandaState {
MemorandaErrorState(this.error); const MemorandaErrorState(this.error);
final String error; final String error;
@override @override

View File

@ -27,6 +27,7 @@ class PropertyAppraisal {
final String? totalpercentDepreciation; final String? totalpercentDepreciation;
final String? marketValue; final String? marketValue;
final String? totalArea; final String? totalArea;
final String? actualUse;
PropertyAppraisal( PropertyAppraisal(
{this.id, {this.id,
@ -44,7 +45,8 @@ class PropertyAppraisal {
this.addItemsSubtotal, this.addItemsSubtotal,
this.totalpercentDepreciation, this.totalpercentDepreciation,
this.marketValue, this.marketValue,
this.totalArea}); this.totalArea,
this.actualUse});
factory PropertyAppraisal.fromJson(Map<String, dynamic> json) => factory PropertyAppraisal.fromJson(Map<String, dynamic> json) =>
PropertyAppraisal( PropertyAppraisal(
@ -68,7 +70,7 @@ class PropertyAppraisal {
totalpercentDepreciation: json["totalpercent_depreciation"], totalpercentDepreciation: json["totalpercent_depreciation"],
marketValue: json["market_value"], marketValue: json["market_value"],
totalArea: json["total_area"], totalArea: json["total_area"],
); actualUse: json["actual_use"]);
Map<String, dynamic> toJson() => { Map<String, dynamic> toJson() => {
"id": id, "id": id,
@ -86,6 +88,7 @@ class PropertyAppraisal {
"add_items_subtotal": addItemsSubtotal, "add_items_subtotal": addItemsSubtotal,
"totalpercent_depreciation": totalpercentDepreciation, "totalpercent_depreciation": totalpercentDepreciation,
"market_value": marketValue, "market_value": marketValue,
"total_area": totalArea "total_area": totalArea,
"actual_use": actualUse
}; };
} }

View File

@ -120,17 +120,34 @@ class _AddBuilding extends State<AddBuilding> {
if (state is PropertyInfoErrorState) { if (state is PropertyInfoErrorState) {
final progress = ProgressHUD.of(context); final progress = ProgressHUD.of(context);
progress?.dismiss(); progress?.dismiss();
}
if (state is ShowGenDescErrorAlertState ||
state is ShowLandRefErrorAlertState ||
state is ShowStrucMatErrorAlertState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
Fluttertoast.showToast( Fluttertoast.showToast(
msg: onError, msg: "Slow internet connection, please try again!");
fontSize: 24, }
toastLength: Toast.LENGTH_LONG, if (state is ShowLandRefSuccessAlertState ||
gravity: ToastGravity.CENTER, state is ShowGenDescSuccessAlertState ||
backgroundColor: Colors.black, state is ShowStrucMatSuccessAlertState) {
textColor: Colors.white); final progress = ProgressHUD.of(context);
progress?.dismiss();
NextBtn();
} }
}, builder: (context, state) { }, builder: (context, state) {
if (state is PropertyInfoLoaded || if (state is PropertyInfoLoading ||
state is PropertyInfoErrorState) { state is PropertyInfoLoaded ||
state is PropertyInfoErrorState ||
state is ShowBldgLocErrorAlertState ||
state is ShowGenDescErrorAlertState ||
state is ShowLandRefErrorAlertState ||
state is ShowStrucMatErrorAlertState ||
state is ShowBldgLocSuccessAlertState ||
state is ShowLandRefSuccessAlertState ||
state is ShowGenDescSuccessAlertState ||
state is ShowStrucMatSuccessAlertState) {
return BlocConsumer<UnitConstructBloc, UnitConstructState>( return BlocConsumer<UnitConstructBloc, UnitConstructState>(
listener: ( listener: (
context, context,

View File

@ -1,6 +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_form_builder/flutter_form_builder.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:form_builder_validators/form_builder_validators.dart'; import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:searchfield/searchfield.dart'; import 'package:searchfield/searchfield.dart';
@ -500,6 +501,7 @@ class _AddExtraItems extends State<AddExtraItems> {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: ElevatedButton( child: ElevatedButton(
onPressed: () async { onPressed: () async {
try {
final tempID = final tempID =
await SharedPreferences.getInstance(); await SharedPreferences.getInstance();
var itemss = AdditionalItems( var itemss = AdditionalItems(
@ -509,12 +511,13 @@ class _AddExtraItems extends State<AddExtraItems> {
classId: _classId, classId: _classId,
className: _className, className: _className,
structType: _structureType, structType: _structureType,
unitValue: unitValue: _withoutBUCC == true
_withoutBUCC == true ? 0 : _unitValue, ? 0
: _unitValue,
baseUnitValue: _unitBase, baseUnitValue: _unitBase,
area: _areaValue, area: _areaValue,
marketValue: marketValue: (_unitValue * _unitBase) *
(_unitValue * _unitBase) * _areaValue, _areaValue,
depreciationRate: _depValue, depreciationRate: _depValue,
adjustedMarketVal: _totalMarketValue( adjustedMarketVal: _totalMarketValue(
_unitValue, _unitValue,
@ -542,6 +545,12 @@ class _AddExtraItems extends State<AddExtraItems> {
context context
.read<AdditionalItemBloc>() .read<AdditionalItemBloc>()
.add(AddAdditionalItems(items: itemss)); .add(AddAdditionalItems(items: itemss));
} catch (e) {
Fluttertoast.showToast(
msg:
"Slow internet connection, please try again!",
);
}
}, },
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
primary: Colors.black, primary: Colors.black,

View File

@ -1,11 +1,15 @@
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/bulding/additional_item/additional_item_bloc.dart'; import 'package:unit2/bloc/passo/bulding/additional_item/additional_item_bloc.dart';
import 'package:unit2/model/passo/class_components.dart'; import 'package:unit2/model/passo/class_components.dart';
import 'package:unit2/model/passo/unit_construct.dart'; import 'package:unit2/model/passo/unit_construct.dart';
import 'package:unit2/screens/passo/Building/add_building_components/AddExtraItems.dart'; import 'package:unit2/screens/passo/Building/add_building_components/AddExtraItems.dart';
import 'package:unit2/utils/alerts.dart'; import 'package:unit2/utils/alerts.dart';
import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/error_state.dart';
import 'package:unit2/widgets/passo/custom_button.dart'; import 'package:unit2/widgets/passo/custom_button.dart';
class AdditionalItemPage extends StatefulWidget { class AdditionalItemPage extends StatefulWidget {
@ -37,9 +41,25 @@ class _AdditionalItemPage extends State<AdditionalItemPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BlocConsumer<AdditionalItemBloc, AdditionalItemState>( return Scaffold(
body: ProgressHUD(
padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocConsumer<AdditionalItemBloc, AdditionalItemState>(
listener: (context, state) { listener: (context, state) {
// TODO: implement listener if (state is AdditionalItemsLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is AdditionalItemsLoaded) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
if (state is AdditionalItemsErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
}, },
builder: (context, state) { builder: (context, state) {
final state = context.watch<AdditionalItemBloc>().state; final state = context.watch<AdditionalItemBloc>().state;
@ -57,7 +77,8 @@ class _AdditionalItemPage extends State<AdditionalItemPage> {
left: 0, top: 20, right: 0, bottom: 10), left: 0, top: 20, right: 0, bottom: 10),
child: const Text('ADDITIONAL ITEMS', child: const Text('ADDITIONAL ITEMS',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 18), fontWeight: FontWeight.bold,
fontSize: 18),
textAlign: TextAlign.left), textAlign: TextAlign.left),
), ),
Align( Align(
@ -175,14 +196,14 @@ class _AdditionalItemPage extends State<AdditionalItemPage> {
children: [ children: [
const Text( const Text(
'Total', 'Total',
style: style: TextStyle(
TextStyle(fontWeight: FontWeight.bold, fontSize: 15), fontWeight: FontWeight.bold, fontSize: 15),
), ),
Text( Text(
NumberFormat.currency(locale: 'en-PH', symbol: "") NumberFormat.currency(locale: 'en-PH', symbol: "")
.format(_totalMarketValue(state.items)), .format(_totalMarketValue(state.items)),
style: style: TextStyle(
TextStyle(fontWeight: FontWeight.bold, fontSize: 15), fontWeight: FontWeight.bold, fontSize: 15),
) )
], ],
), ),
@ -247,50 +268,25 @@ class _AdditionalItemPage extends State<AdditionalItemPage> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Expanded(child: AddExtraItems(widget.unit, widget.options)) Expanded(
child: AddExtraItems(widget.unit, widget.options))
], ],
), ),
), ),
); );
} }
return Container( if (state is AdditionalItemsErrorState) {
child: Column( return SomethingWentWrong(
children: [ message: onError,
Container( onpressed: () {
margin: const EdgeInsets.only( context.read<AdditionalItemBloc>().add(LoadAdditionalItems());
left: 0, top: 20, right: 0, bottom: 10),
child: const Text('ADDITIONAL MATERIALS',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18),
textAlign: TextAlign.left),
),
Align(
alignment: Alignment.topRight,
child: ElevatedButton(
onPressed: () {
context
.read<AdditionalItemBloc>()
.add(ShowAdditionalItems());
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: const [
Text('ADD ITEM'), // <-- Text
SizedBox(
width: 5,
),
Icon(
// <-- Icon
Icons.add,
size: 24.0,
),
],
),
),
),
],
),
);
}, },
); );
} }
return Container();
},
),
),
);
}
} }

View File

@ -4,6 +4,7 @@ import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:flutter_progress_hud/flutter_progress_hud.dart'; import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:fluttertoast/fluttertoast.dart'; import 'package:fluttertoast/fluttertoast.dart';
import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.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/property_info/property_info_bloc.dart'; import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart';
@ -15,7 +16,9 @@ import 'package:unit2/model/passo/bldg_loc.dart';
import 'package:unit2/model/passo/city.dart'; import 'package:unit2/model/passo/city.dart';
import 'package:unit2/model/passo/land_ref.dart'; import 'package:unit2/model/passo/land_ref.dart';
import 'package:unit2/screens/passo/Building/add_building.dart'; import 'package:unit2/screens/passo/Building/add_building.dart';
import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/theme-data.dart/form-style.dart'; import 'package:unit2/theme-data.dart/form-style.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:unit2/widgets/passo/custom_button.dart'; import 'package:unit2/widgets/passo/custom_button.dart';
@ -46,20 +49,10 @@ class _BldgLocationLandrefPage extends State<BldgLocationLandrefPage> {
final progress = ProgressHUD.of(context); final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait..."); progress!.showWithText("Please wait...");
} }
if (state is MunicipalityLoaded) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
if (state is MunicipalityErrorState) { if (state is MunicipalityErrorState) {
final progress = ProgressHUD.of(context); final progress = ProgressHUD.of(context);
progress?.dismiss(); progress?.dismiss();
// Fluttertoast.showToast(
// msg: onError,
// fontSize: 24,
// toastLength: Toast.LENGTH_LONG,
// gravity: ToastGravity.CENTER,
// backgroundColor: Colors.black,
// textColor: Colors.white);
} }
}, },
builder: (context, state) { builder: (context, state) {
@ -72,6 +65,7 @@ class _BldgLocationLandrefPage extends State<BldgLocationLandrefPage> {
final progress = ProgressHUD.of(context); final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait..."); progress!.showWithText("Please wait...");
} }
if (state is BarangayLoaded) { if (state is BarangayLoaded) {
final progress = ProgressHUD.of(context); final progress = ProgressHUD.of(context);
progress?.dismiss(); progress?.dismiss();
@ -79,13 +73,6 @@ class _BldgLocationLandrefPage extends State<BldgLocationLandrefPage> {
if (state is BarangayErrorState) { if (state is BarangayErrorState) {
final progress = ProgressHUD.of(context); final progress = ProgressHUD.of(context);
progress?.dismiss(); progress?.dismiss();
// Fluttertoast.showToast(
// msg: onError,
// fontSize: 24,
// toastLength: Toast.LENGTH_LONG,
// gravity: ToastGravity.CENTER,
// backgroundColor: Colors.black,
// textColor: Colors.white);
} }
}, },
builder: (context, state) { builder: (context, state) {
@ -95,6 +82,7 @@ class _BldgLocationLandrefPage extends State<BldgLocationLandrefPage> {
.map((brgy) => brgy.barangayDescription) .map((brgy) => brgy.barangayDescription)
.toList() .toList()
.cast<String>(); .cast<String>();
return StatefulBuilder(builder: (context, locationState) {
return SingleChildScrollView( return SingleChildScrollView(
child: Padding( child: Padding(
padding: const EdgeInsets.all(20.0), padding: const EdgeInsets.all(20.0),
@ -114,10 +102,27 @@ class _BldgLocationLandrefPage extends State<BldgLocationLandrefPage> {
MainAxisAlignment.spaceEvenly, MainAxisAlignment.spaceEvenly,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
// optional flex property if flex is 1 because the default flex is 1 child: Container(
flex: 1, height: 45.0,
child: customTextField( width: double.infinity,
"Province / City", "", 'province')), decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: Colors.grey,
width: 1.0,
),
borderRadius:
BorderRadius.circular(5.0),
),
child: const Align(
alignment: Alignment.center,
child: Text(
"AGUSAN DEL NORTE",
style: TextStyle(fontSize: 15),
),
),
),
),
const SizedBox(width: 10.0), const SizedBox(width: 10.0),
Expanded( Expanded(
flex: 1, flex: 1,
@ -181,8 +186,8 @@ class _BldgLocationLandrefPage extends State<BldgLocationLandrefPage> {
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 1, flex: 1,
child: customTextField( child: customTextField("OCT/TCT/CLOA No.",
"OCT/TCT/CLOA No.", "", 'oct_tct_cloa'), "", 'oct_tct_cloa'),
), ),
const SizedBox(width: 10.0), const SizedBox(width: 10.0),
Expanded( Expanded(
@ -223,11 +228,12 @@ class _BldgLocationLandrefPage extends State<BldgLocationLandrefPage> {
child: child:
customTextField("Area", "", 'area')) customTextField("Area", "", 'area'))
]), ]),
SizedBox( const SizedBox(
height: 50, height: 50,
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [ children: [
CustomButton( CustomButton(
icon: const Icon(Icons.chevron_left_rounded, icon: const Icon(Icons.chevron_left_rounded,
@ -239,26 +245,97 @@ class _BldgLocationLandrefPage extends State<BldgLocationLandrefPage> {
; ;
}, },
), ),
CustomButton( // Builder(builder: (context) {
icon: const Icon(Icons.chevron_right_rounded, // return CustomButton(
color: Colors.white), // icon: const Icon(
// Icons.chevron_right_rounded,
// color: Colors.white),
// onPressed: () async {
// {
// try {
// final progress =
// ProgressHUD.of(context);
// Future.delayed(Duration(seconds: 3),
// () {
// progress?.dismiss();
// });
// final tempID = await SharedPreferences
// .getInstance();
// var bldgLocData = BldgLoc(
// id: tempID.getInt('tempid')! - 1,
// street: formKey.currentState
// ?.value['street'],
// barangay: formKey
// .currentState?.value['brgy'],
// municipality: formKey
// .currentState
// ?.value['municipality']
// .cityDescription,
// province: "Agusan Del Norte");
// var landRefData = LandRef(
// id: tempID.getInt('tempid')! - 1,
// owner: formKey
// .currentState?.value['l_owner'],
// cloaNo: formKey.currentState
// ?.value['oct_tct_cloa'],
// lotNo: formKey
// .currentState?.value['lot_no'],
// tdn: formKey.currentState
// ?.value['l_td_arp'],
// area: formKey
// .currentState?.value['area'],
// surveyNo: formKey.currentState
// ?.value['survey_no'],
// blkNo: formKey
// .currentState?.value['blk_no'],
// );
// context.read<PropertyInfoBloc>()
// ..add(UpdateBldgLoc(
// bldg_loc: bldgLocData))
// ..add(UpdateLandRef(
// land_ref: landRefData));
// } catch (e) {
// Fluttertoast.showToast(
// msg:
// "Slow internet connection, please try again!");
// }
// }
// ;
// },
// );
// })
Builder(builder: (context) {
return CustomButton(
icon: const Icon(
Icons.chevron_right_rounded,
color: Colors.white,
),
onPressed: () async { onPressed: () async {
{ try {
final tempID = // Get the ProgressHUD instance
await SharedPreferences.getInstance(); final progress =
ProgressHUD.of(context);
// Show the progress indicator
progress?.show();
// Dismiss the progress indicator
progress?.dismiss();
// Rest of your code...
final tempID = await SharedPreferences
.getInstance();
var bldgLocData = BldgLoc( var bldgLocData = BldgLoc(
id: tempID.getInt('tempid')! - 1, id: tempID.getInt('tempid')! - 1,
street: formKey street: formKey.currentState
.currentState?.value['street'], ?.value['street'],
barangay: barangay: formKey
formKey.currentState?.value['brgy'], .currentState?.value['brgy'],
municipality: formKey municipality: formKey
.currentState .currentState
?.value['municipality'] ?.value['municipality']
.cityDescription, .cityDescription,
province: formKey province: "Agusan Del Norte");
.currentState?.value['province'],
);
var landRefData = LandRef( var landRefData = LandRef(
id: tempID.getInt('tempid')! - 1, id: tempID.getInt('tempid')! - 1,
owner: formKey owner: formKey
@ -267,12 +344,12 @@ class _BldgLocationLandrefPage extends State<BldgLocationLandrefPage> {
?.value['oct_tct_cloa'], ?.value['oct_tct_cloa'],
lotNo: formKey lotNo: formKey
.currentState?.value['lot_no'], .currentState?.value['lot_no'],
tdn: formKey tdn: formKey.currentState
.currentState?.value['l_td_arp'], ?.value['l_td_arp'],
area: area: formKey
formKey.currentState?.value['area'], .currentState?.value['area'],
surveyNo: formKey surveyNo: formKey.currentState
.currentState?.value['survey_no'], ?.value['survey_no'],
blkNo: formKey blkNo: formKey
.currentState?.value['blk_no'], .currentState?.value['blk_no'],
); );
@ -281,18 +358,22 @@ class _BldgLocationLandrefPage extends State<BldgLocationLandrefPage> {
bldg_loc: bldgLocData)) bldg_loc: bldgLocData))
..add(UpdateLandRef( ..add(UpdateLandRef(
land_ref: landRefData)); land_ref: landRefData));
} catch (e) {
widget.NextBtn(); Fluttertoast.showToast(
msg:
"Slow internet connection, please try again!",
);
} }
;
}, },
) );
})
], ],
) )
], ],
), ),
), ),
); );
});
} }
if (state is BarangayErrorState) { if (state is BarangayErrorState) {
return SomethingWentWrong( return SomethingWentWrong(
@ -314,6 +395,22 @@ class _BldgLocationLandrefPage extends State<BldgLocationLandrefPage> {
}, },
); );
} }
if (state is ShowBldgLocErrorAlertState) {
WidgetsBinding.instance.addPostFrameCallback((_) {
errorAlert(
context, "Something went wrong", "Please try again...", () {
Navigator.of(context).pop();
});
});
}
if (state is ShowLandRefErrorAlertState) {
WidgetsBinding.instance.addPostFrameCallback((_) {
errorAlert(
context, "Something went wrong", "Please try again...", () {
Navigator.of(context).pop();
});
});
}
return Container(); return Container();
}, },
), ),
@ -325,12 +422,13 @@ class _BldgLocationLandrefPage extends State<BldgLocationLandrefPage> {
// Wait for the state change indicating completion // Wait for the state change indicating completion
final propertyInfoState = context.read<PropertyInfoBloc>().state; final propertyInfoState = context.read<PropertyInfoBloc>().state;
if (propertyInfoState is PropertyInfoErrorState) { if (propertyInfoState is ShowBldgLocErrorAlertState ||
propertyInfoState is ShowLandRefErrorAlertState) {
// Check if the add operation was successful // Check if the add operation was successful
return true; // You'll need to define this in your state class return false; // You'll need to define this in your state class
} }
// Return false if the state didn't change as expected // Return false if the state didn't change as expected
return false; return true;
} }
} }

View File

@ -1,6 +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_form_builder/flutter_form_builder.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart'; import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart';
import 'package:unit2/model/passo/general_description.dart'; import 'package:unit2/model/passo/general_description.dart';
@ -177,17 +178,19 @@ class _GeneralDescriptionPage extends State<GeneralDescriptionPage> {
color: Colors.white), color: Colors.white),
onPressed: () async { onPressed: () async {
{ {
try {
final tempID = await SharedPreferences.getInstance(); final tempID = await SharedPreferences.getInstance();
widget.onPutGeneralDescription();
var genDescData = GeneralDesc( var genDescData = GeneralDesc(
id: tempID.getInt('tempid')! - 1, id: tempID.getInt('tempid')! - 1,
bldgKind: bldgKind: formKey
formKey.currentState?.value['bldg_type'].building, .currentState?.value['bldg_type'].building,
strucType: strucType: formKey
formKey.currentState?.value['bldg_type'].bldgType, .currentState?.value['bldg_type'].bldgType,
bldgPermit: bldgPermit:
formKey.currentState?.value['bldg_permit'], formKey.currentState?.value['bldg_permit'],
dateIssued: formKey.currentState?.value['coc_issued'], dateIssued:
formKey.currentState?.value['coc_issued'],
cct: formKey.currentState?.value['cct'], cct: formKey.currentState?.value['cct'],
certCompletionIssued: certCompletionIssued:
formKey.currentState?.value['coc_issued'], formKey.currentState?.value['coc_issued'],
@ -208,10 +211,15 @@ class _GeneralDescriptionPage extends State<GeneralDescriptionPage> {
totalFloorArea: totalFloorArea:
formKey.currentState?.value['total_area'], formKey.currentState?.value['total_area'],
floorSketch: null, floorSketch: null,
actualUse: formKey.currentState?.value['actual_use']); actualUse:
formKey.currentState?.value['actual_use']);
context.read<PropertyInfoBloc>() context.read<PropertyInfoBloc>()
..add(UpdateGeneralDesc(gen_desc: genDescData)); ..add(UpdateGeneralDesc(gen_desc: genDescData));
} catch (e) {
Fluttertoast.showToast(
msg: "Slow internet connection, please try again!");
}
} }
; ;
}, },

View File

@ -1,11 +1,14 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:form_builder_validators/form_builder_validators.dart'; import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:unit2/bloc/passo/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/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_info/property_info_bloc.dart';
import 'package:unit2/model/passo/additional_items.dart'; import 'package:unit2/model/passo/additional_items.dart';
import 'package:unit2/model/passo/property_appraisal.dart'; import 'package:unit2/model/passo/property_appraisal.dart';
import 'package:unit2/screens/passo/Building/add_building.dart'; import 'package:unit2/screens/passo/Building/add_building.dart';
@ -501,8 +504,26 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BlocConsumer<AdditionalItemBloc, AdditionalItemState>( return Scaffold(
listener: (context, state) {}, body: ProgressHUD(
padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocConsumer<AdditionalItemBloc, AdditionalItemState>(
listener: (context, state) {
if (state is AdditionalItemsLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is AdditionalItemsLoaded) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
if (state is AdditionalItemsErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
},
builder: (context, state) { builder: (context, state) {
if (state is AdditionalItemsLoaded) { if (state is AdditionalItemsLoaded) {
return SingleChildScrollView( return SingleChildScrollView(
@ -531,7 +552,8 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
), ),
Container( Container(
child: Text( child: Text(
formKey.currentState!.value['bldg_type'].unitValue + formKey.currentState!.value['bldg_type']
.unitValue +
' sq.m', ' sq.m',
textAlign: TextAlign.right, textAlign: TextAlign.right,
), ),
@ -637,8 +659,8 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
Container( Container(
child: Text( child: Text(
calculateTotalConstructionCost( calculateTotalConstructionCost(
(double.parse(formKey (double.parse(formKey.currentState!
.currentState!.value['total_area']) * .value['total_area']) *
double.parse(formKey.currentState! double.parse(formKey.currentState!
.value['bldg_type'].unitValue)), .value['bldg_type'].unitValue)),
state.items) state.items)
@ -691,8 +713,8 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
Container( Container(
child: Text( child: Text(
calculateDepCost( calculateDepCost(
(double.parse(formKey (double.parse(formKey.currentState!
.currentState!.value['total_area']) * .value['total_area']) *
double.parse(formKey.currentState! double.parse(formKey.currentState!
.value['bldg_type'].unitValue)), .value['bldg_type'].unitValue)),
state.items, state.items,
@ -738,8 +760,8 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
Container( Container(
child: Text( child: Text(
calculateMarketValue( calculateMarketValue(
(double.parse(formKey (double.parse(formKey.currentState!
.currentState!.value['total_area']) * .value['total_area']) *
double.parse(formKey.currentState! double.parse(formKey.currentState!
.value['bldg_type'].unitValue)), .value['bldg_type'].unitValue)),
state.items, state.items,
@ -760,7 +782,8 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
margin: const EdgeInsets.only( margin: const EdgeInsets.only(
left: 20.0, right: 20.0), left: 20.0, right: 20.0),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment:
MainAxisAlignment.start,
children: [ children: [
Container( Container(
margin: const EdgeInsets.only( margin: const EdgeInsets.only(
@ -768,7 +791,8 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
top: 20, top: 20,
right: 0, right: 0,
bottom: 20), bottom: 20),
child: const Text('PROPERTY ASSESSMENT', child: const Text(
'PROPERTY ASSESSMENT',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 18), fontSize: 18),
@ -780,62 +804,78 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
children: [ children: [
Container( Container(
width: 100, width: 100,
margin: const EdgeInsets.only( margin:
const EdgeInsets.only(
top: 15, left: 15), top: 15, left: 15),
padding: padding:
const EdgeInsets.all(5.0), const EdgeInsets.all(
5.0),
child: const Text( child: const Text(
'Actual Use', 'Actual Use',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight:
FontWeight.bold,
fontSize: 13, fontSize: 13,
), ),
textAlign: TextAlign.center, textAlign:
TextAlign.center,
), ),
), ),
Container( Container(
width: 100, width: 100,
margin: const EdgeInsets.only( margin:
const EdgeInsets.only(
top: 15, left: 15), top: 15, left: 15),
padding: padding:
const EdgeInsets.all(5.0), const EdgeInsets.all(
5.0),
child: const Text( child: const Text(
'Market Value', 'Market Value',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight:
FontWeight.bold,
fontSize: 13, fontSize: 13,
), ),
textAlign: TextAlign.center, textAlign:
TextAlign.center,
), ),
), ),
Container( Container(
width: 100, width: 100,
margin: const EdgeInsets.only( margin:
const EdgeInsets.only(
top: 15, left: 15), top: 15, left: 15),
padding: padding:
const EdgeInsets.all(5.0), const EdgeInsets.all(
5.0),
child: const Text( child: const Text(
'Ass. Level', 'Ass. Level',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight:
FontWeight.bold,
fontSize: 13, fontSize: 13,
), ),
textAlign: TextAlign.center, textAlign:
TextAlign.center,
), ),
), ),
Container( Container(
width: 100, width: 100,
margin: const EdgeInsets.only( margin:
const EdgeInsets.only(
top: 15, left: 15), top: 15, left: 15),
padding: padding:
const EdgeInsets.all(5.0), const EdgeInsets.all(
5.0),
child: const Text( child: const Text(
'Ass. Value', 'Ass. Value',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight:
FontWeight.bold,
fontSize: 13, fontSize: 13,
), ),
textAlign: TextAlign.center, textAlign:
TextAlign.center,
), ),
), ),
], ],
@ -846,27 +886,35 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
children: [ children: [
Container( Container(
width: 100, width: 100,
margin: const EdgeInsets.only( margin:
top: 15, left: 15), const EdgeInsets.only(
top: 15,
left: 15),
padding: padding:
const EdgeInsets.all(5.0), const EdgeInsets.all(
5.0),
child: Text( child: Text(
formKey.currentState formKey.currentState
?.value['actual_use']!, ?.value[
'actual_use']!,
style: TextStyle( style: TextStyle(
fontWeight: fontWeight:
FontWeight.bold, FontWeight.bold,
fontSize: 13, fontSize: 13,
), ),
textAlign: TextAlign.center, textAlign:
TextAlign.center,
), ),
), ),
Container( Container(
width: 100, width: 100,
margin: const EdgeInsets.only( margin:
top: 15, left: 15), const EdgeInsets.only(
top: 15,
left: 15),
padding: padding:
const EdgeInsets.all(5.0), const EdgeInsets.all(
5.0),
child: Text( child: Text(
calculateMarketValue( calculateMarketValue(
(double.parse(formKey (double.parse(formKey
@ -886,21 +934,23 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
FontWeight.bold, FontWeight.bold,
fontSize: 13, fontSize: 13,
), ),
textAlign: TextAlign.center, textAlign:
TextAlign.center,
), ),
), ),
Container( Container(
width: 100, width: 100,
margin: const EdgeInsets.only( margin:
top: 15, left: 15), const EdgeInsets.only(
top: 15,
left: 15),
padding: padding:
const EdgeInsets.all(5.0), const EdgeInsets.all(
5.0),
child: Text( child: Text(
assessmentLevel( assessmentLevel(
calculateMarketValue( calculateMarketValue(
(double.parse(formKey (double.parse(formKey.currentState!.value[
.currentState!
.value[
'total_area']) * 'total_area']) *
double.parse(formKey double.parse(formKey
.currentState! .currentState!
@ -918,26 +968,30 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
FontWeight.bold, FontWeight.bold,
fontSize: 13, fontSize: 13,
), ),
textAlign: TextAlign.center, textAlign:
TextAlign.center,
), ),
), ),
Container( Container(
width: 100, width: 100,
margin: const EdgeInsets.only( margin:
top: 15, left: 15), const EdgeInsets.only(
top: 15,
left: 15),
padding: padding:
const EdgeInsets.all(5.0), const EdgeInsets.all(
5.0),
child: Text( child: Text(
assessmentValue( assessmentValue(
calculateMarketValue( calculateMarketValue(
(double.parse(formKey.currentState!.value[ (double.parse(formKey.currentState!.value['total_area']) *
'total_area']) *
double.parse(formKey double.parse(formKey
.currentState! .currentState!
.value[ .value[
'bldg_type'] 'bldg_type']
.unitValue)), .unitValue)),
state.items, state
.items,
depRate) depRate)
.toString(), .toString(),
formKey.currentState formKey.currentState
@ -949,7 +1003,8 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
FontWeight.bold, FontWeight.bold,
fontSize: 13, fontSize: 13,
), ),
textAlign: TextAlign.center, textAlign:
TextAlign.center,
), ),
), ),
], ],
@ -987,20 +1042,22 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
print(tempID.getInt('tempid')); print(tempID.getInt('tempid'));
var appraisals = PropertyAppraisal( var appraisals = PropertyAppraisal(
id: 1, id: 1,
bldgapprDetailsId: tempID.getInt('tempid')!, bldgapprDetailsId:
unitconstructCost: formKey tempID.getInt('tempid')! - 1,
.currentState!.value['bldg_type'].unitValue, unitconstructCost: formKey.currentState!
.value['bldg_type'].unitValue,
buildingCore: 'test', buildingCore: 'test',
unitconstructSubtotal: unitconstructSubtotal:
(double.parse(formKey.currentState!.value['total_area']) * (double.parse(formKey.currentState!.value['total_area']) *
double.parse(formKey.currentState! double.parse(formKey
.value['bldg_type'].unitValue)) .currentState!
.value['bldg_type']
.unitValue))
.toString(), .toString(),
depreciationRate: depRate.toString(), depreciationRate: depRate.toString(),
depreciationCost: calculateDepCost( depreciationCost: calculateDepCost(
(double.parse(formKey.currentState!.value['total_area']) * (double.parse(formKey.currentState!.value['total_area']) *
double.parse( double.parse(formKey.currentState!.value['bldg_type'].unitValue)),
formKey.currentState!.value['bldg_type'].unitValue)),
state.items, state.items,
depRate) depRate)
.toString(), .toString(),
@ -1008,10 +1065,11 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
addItemsSubtotal: calculateAdditionalItems(state.items).toString(), addItemsSubtotal: calculateAdditionalItems(state.items).toString(),
totalpercentDepreciation: (depRate * 100).toStringAsFixed(2), totalpercentDepreciation: (depRate * 100).toStringAsFixed(2),
marketValue: calculateMarketValue((double.parse(formKey.currentState!.value['total_area']) * double.parse(formKey.currentState!.value['bldg_type'].unitValue)), state.items, depRate).toString(), marketValue: calculateMarketValue((double.parse(formKey.currentState!.value['total_area']) * double.parse(formKey.currentState!.value['bldg_type'].unitValue)), state.items, depRate).toString(),
totalArea: formKey.currentState!.value['total_area']); totalArea: formKey.currentState!.value['total_area'],
actualUse: "Residential");
context.read<PropertyAppraisalBloc>() context.read<PropertyAppraisalBloc>()
..add( ..add(AddPropertyAppraisal(
AddPropertyAppraisal(appraisal: appraisals)); appraisal: appraisals));
widget.NextBtn(); widget.NextBtn();
} }
@ -1027,6 +1085,21 @@ class _PropertyAppraisalPage extends State<PropertyAppraisalPage> {
} }
return Container(); return Container();
}, },
),
),
); );
} }
Future<bool> _waitForAddPropertyInfoToComplete() async {
// Wait for the state change indicating completion
final propertyInfoState = context.read<PropertyInfoBloc>().state;
if (propertyInfoState is PropertyInfoErrorState) {
// Check if the add operation was unsuccessful
return true; // You'll need to define this in your state class
}
// Return false if the state didn't change as expected
return false;
}
} }

View File

@ -40,424 +40,6 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
String _memoranda = ''; String _memoranda = '';
final focus = FocusNode(); final focus = FocusNode();
String assessmentLevel(marketValues, property_class) {
final marketValue = double.parse(marketValues);
switch (property_class) {
case 'Residential':
if (marketValue < 175000) {
// setState(() {
// assessment_level = 0;
// });
return '0 ';
} else if (marketValue < 300000 && marketValue > 175000) {
// setState(() {
// assessment_level = 0.10;
// });
return '10 ';
} else if (marketValue < 500000 && marketValue > 300000) {
// setState(() {
// assessment_level = 0.20;
// });
return '20 ';
} else if (marketValue < 750000 && marketValue > 500000) {
// setState(() {
// assessment_level = 0.25;
// });
return '25 ';
} else if (marketValue < 1000000 && marketValue > 750000) {
// setState(() {
// assessment_level = 0.30;
// });
return '30 ';
} else if (marketValue < 2000000 && marketValue > 1000000) {
// setState(() {
// assessment_level = 0.35;
// });
return '35 ';
} else if (marketValue < 5000000 && marketValue > 2000000) {
// setState(() {
// assessment_level = 0.40;
// });
return '40 ';
} else if (marketValue < 10000000 && marketValue > 5000000) {
// setState(() {
// assessment_level = 0.50;
// });
return '50 ';
} else if (marketValue > 10000000) {
// setState(() {
// assessment_level = 0.60;
// });
return '60 ';
}
break;
case 'Agricultural':
if (marketValue < 300000) {
// setState(() {
// assessment_level = 0.45;
// });
return '45 ';
} else if (marketValue < 500000 && marketValue > 300000) {
// setState(() {
// assessment_level = 0.50;
// });
return '50 ';
} else if (marketValue < 750000 && marketValue > 5000000) {
// setState(() {
// assessment_level = 0.55;
// });
return '55 ';
} else if (marketValue < 1000000 && marketValue > 750000) {
// setState(() {
// assessment_level = 0.60;
// });
return '60 ';
} else if (marketValue < 2000000 && marketValue > 1000000) {
// setState(() {
// assessment_level = 0.65;
// });
return '65 ';
} else if (marketValue > 2000000) {
// setState(() {
// assessment_level = 0.70;
// });
return '70 ';
}
break;
case 'Commercial':
if (marketValue < 300000) {
// setState(() {
// assessment_level = 0.30;
// });
return '30 ';
} else if (marketValue < 500000 && marketValue > 300000) {
// setState(() {
// assessment_level = 0.35;
// });
return '35 ';
} else if (marketValue < 750000 && marketValue > 500000) {
// setState(() {
// assessment_level = 0.40;
// });
return '40 ';
} else if (marketValue < 1000000 && marketValue > 750000) {
// setState(() {
// assessment_level = 0.50;
// });
return '50 ';
} else if (marketValue < 2000000 && marketValue > 1000000) {
// setState(() {
// assessment_level = 0.60;
// });
return '60 ';
} else if (marketValue < 5000000 && marketValue > 2000000) {
// setState(() {
// assessment_level = 0.70;
// });
return '70 ';
} else if (marketValue < 10000000 && marketValue > 5000000) {
// setState(() {
// assessment_level = 0.75;
// });
return '75 ';
} else if (marketValue > 10000000) {
// setState(() {
// assessment_level = 0.80;
// });
}
break;
case 'Industrial':
if (marketValue < 300000) {
// setState(() {
// assessment_level = 0.30;
// });
return '30 ';
} else if (marketValue < 500000 && marketValue > 300000) {
// setState(() {
// assessment_level = 0.35;
// });
return '35 ';
} else if (marketValue < 750000 && marketValue > 500000) {
// setState(() {
// assessment_level = 0.40;
// });
return '40 ';
} else if (marketValue < 1000000 && marketValue > 750000) {
// setState(() {
// assessment_level = 0.50;
// });
return '50 ';
} else if (marketValue < 2000000 && marketValue > 1000000) {
// setState(() {
// assessment_level = 0.60;
// });
return '60 ';
} else if (marketValue < 5000000 && marketValue > 2000000) {
// setState(() {
// assessment_level = 0.70;
// });
return '70 ';
} else if (marketValue < 10000000 && marketValue > 5000000) {
// setState(() {
// assessment_level = 0.75;
// });
return '75 ';
} else if (marketValue > 10000000) {
// setState(() {
// assessment_level = 0.80;
// });
return '80 ';
}
break;
case 'Mineral':
break;
case 'Timberland':
if (marketValue < 300000) {
// setState(() {
// assessment_level = 0.45;
// });
return '45 ';
} else if (marketValue < 500000 && marketValue > 300000) {
// setState(() {
// assessment_level = 0.50;
// });
return '50 ';
} else if (marketValue < 750000 && marketValue > 500000) {
// setState(() {
// assessment_level = 0.55;
// });
return '55 ';
} else if (marketValue < 1000000 && marketValue > 750000) {
// setState(() {
// assessment_level = 0.60;
// });
return '60 ';
} else if (marketValue < 2000000 && marketValue > 1000000) {
// setState(() {
// assessment_level = 0.65;
// });
return '65 ';
} else if (marketValue < 2000000) {
// setState(() {
// assessment_level = 0.70;
// });
return '70 ';
}
break;
default:
}
return '';
}
double assessmentValue(marketValues, property_class) {
final marketValue = double.parse(marketValues);
switch (property_class) {
case 'Residential':
if (marketValue < 175000) {
// setState(() {
// assessment_level = 0;
// });
return marketValue * 0;
} else if (marketValue < 300000 && marketValue > 175000) {
// setState(() {
// assessment_level = 0.10;
// });
return marketValue * 0.10;
} else if (marketValue < 500000 && marketValue > 300000) {
// setState(() {
// assessment_level = 0.20;
// });
return marketValue * 0.20;
} else if (marketValue < 750000 && marketValue > 500000) {
// setState(() {
// assessment_level = 0.25;
// });
return marketValue * 0.25;
} else if (marketValue < 1000000 && marketValue > 750000) {
// setState(() {
// assessment_level = 0.30;
// });
return marketValue * 0.30;
} else if (marketValue < 2000000 && marketValue > 1000000) {
// setState(() {
// assessment_level = 0.35;
// });
return marketValue * 0.35;
} else if (marketValue < 5000000 && marketValue > 2000000) {
// setState(() {
// assessment_level = 0.40;
// });
return marketValue * 0.40;
} else if (marketValue < 10000000 && marketValue > 5000000) {
// setState(() {
// assessment_level = 0.50;
// });
return marketValue * 0.50;
} else if (marketValue > 10000000) {
// setState(() {
// assessment_level = 0.60;
// });
return marketValue * 0.60;
}
break;
case 'Agricultural':
if (marketValue < 300000) {
// setState(() {
// assessment_level = 0.45;
// });
return marketValue * 0.45;
} else if (marketValue < 500000 && marketValue > 300000) {
// setState(() {
// assessment_level = 0.50;
// });
return marketValue * 0.50;
} else if (marketValue < 750000 && marketValue > 5000000) {
// setState(() {
// assessment_level = 0.55;
// });
return marketValue * 0.55;
} else if (marketValue < 1000000 && marketValue > 750000) {
// setState(() {
// assessment_level = 0.60;
// });
return marketValue * 0.60;
} else if (marketValue < 2000000 && marketValue > 1000000) {
// setState(() {
// assessment_level = 0.65;
// });
return marketValue * 0.65;
} else if (marketValue > 2000000) {
// setState(() {
// assessment_level = 0.70;
// });
return marketValue * 0.70;
}
break;
case 'Commercial':
if (marketValue < 300000) {
// setState(() {
// assessment_level = 0.30;
// });
return marketValue * 0.30;
} else if (marketValue < 500000 && marketValue > 300000) {
// setState(() {
// assessment_level = 0.35;
// });
return marketValue * 0.35;
} else if (marketValue < 750000 && marketValue > 500000) {
// setState(() {
// assessment_level = 0.40;
// });
return marketValue * 0.40;
} else if (marketValue < 1000000 && marketValue > 750000) {
// setState(() {
// assessment_level = 0.50;
// });
return marketValue * 0.50;
} else if (marketValue < 2000000 && marketValue > 1000000) {
// setState(() {
// assessment_level = 0.60;
// });
return marketValue * 0.60;
} else if (marketValue < 5000000 && marketValue > 2000000) {
// setState(() {
// assessment_level = 0.70;
// });
return marketValue * 0.70;
} else if (marketValue < 10000000 && marketValue > 5000000) {
// setState(() {
// assessment_level = 0.75;
// });
return marketValue * 0.75;
} else if (marketValue > 10000000) {
// setState(() {
// assessment_level = 0.80;
// });
}
break;
case 'Industrial':
if (marketValue < 300000) {
// setState(() {
// assessment_level = 0.30;
// });
return marketValue * 0.30;
} else if (marketValue < 500000 && marketValue > 300000) {
// setState(() {
// assessment_level = 0.35;
// });
return marketValue * 0.35;
} else if (marketValue < 750000 && marketValue > 500000) {
// setState(() {
// assessment_level = 0.40;
// });
return marketValue * 0.40;
} else if (marketValue < 1000000 && marketValue > 750000) {
// setState(() {
// assessment_level = 0.50;
// });
return marketValue * 0.50;
} else if (marketValue < 2000000 && marketValue > 1000000) {
// setState(() {
// assessment_level = 0.60;
// });
return marketValue * 0.60;
} else if (marketValue < 5000000 && marketValue > 2000000) {
// setState(() {
// assessment_level = 0.70;
// });
return marketValue * 0.70;
} else if (marketValue < 10000000 && marketValue > 5000000) {
// setState(() {
// assessment_level = 0.75;
// });
return marketValue * 0.75;
} else if (marketValue > 10000000) {
// setState(() {
// assessment_level = 0.80;
// });
return marketValue * 0.80;
}
break;
case 'Mineral':
break;
case 'Timberland':
if (marketValue < 300000) {
// setState(() {
// assessment_level = 0.45;
// });
return marketValue * 0.45;
} else if (marketValue < 500000 && marketValue > 300000) {
// setState(() {
// assessment_level = 0.50;
// });
return marketValue * 0.50;
} else if (marketValue < 750000 && marketValue > 500000) {
// setState(() {
// assessment_level = 0.55;
// });
return marketValue * 0.55;
} else if (marketValue < 1000000 && marketValue > 750000) {
// setState(() {
// assessment_level = 0.60;
// });
return marketValue * 0.60;
} else if (marketValue < 2000000 && marketValue > 1000000) {
// setState(() {
// assessment_level = 0.65;
// });
return marketValue * 0.65;
} else if (marketValue < 2000000) {
// setState(() {
// assessment_level = 0.70;
// });
return marketValue * 0.70;
}
break;
default:
}
return 0;
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -466,111 +48,26 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
padding: const EdgeInsets.all(24), padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87, backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white), indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocConsumer<PropertyAssessmentBloc, PropertyAssessmentState>( child: BlocConsumer<SignatoriesBloc, SignatoriesState>(
listener: (context, state) { listener: (context, state) {
if (state is PropertyAssessmentLoading) { // TODO: implement listener
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is PropertyAssessmentLoaded) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
if (state is PropertyAssessmentErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
// Fluttertoast.showToast(
// msg: onError,
// fontSize: 24,
// toastLength: Toast.LENGTH_LONG,
// gravity: ToastGravity.CENTER,
// backgroundColor: Colors.black,
// textColor: Colors.white);
}
},
builder: (context, state) {
if (state is PropertyAssessmentLoaded) {
return BlocConsumer<SignatoriesBloc, SignatoriesState>(
listener: (context, state) {
if (state is SignatoriesLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is SignatoriesLoaded) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
if (state is SignatoriesErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
// Fluttertoast.showToast(
// msg: onError,
// fontSize: 24,
// toastLength: Toast.LENGTH_LONG,
// gravity: ToastGravity.CENTER,
// backgroundColor: Colors.black,
// textColor: Colors.white);
}
}, },
builder: (context, state) { builder: (context, state) {
if (state is SignatoriesLoaded) { if (state is SignatoriesLoaded) {
final signatories = state.signatories; final signatories = state.signatories;
return BlocConsumer<MemorandaBloc, MemorandaState>( return BlocConsumer<MemorandaBloc, MemorandaState>(
listener: (context, state) { listener: (context, state) {
if (state is MemorandaLoading) { // TODO: implement listener
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is MemorandaLoaded) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
if (state is MemorandaErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
// Fluttertoast.showToast(
// msg: onError,
// fontSize: 24,
// toastLength: Toast.LENGTH_LONG,
// gravity: ToastGravity.CENTER,
// backgroundColor: Colors.black,
// textColor: Colors.white);
}
}, },
builder: (context, state) { builder: (context, state) {
if (state is MemorandaLoaded) { if (state is MemorandaLoaded) {
final memoranda = state.memorada; final memoranda = state.memorada;
return BlocConsumer<PropertyAppraisalBloc,
PropertyAppraisalState>(
listener: (context, state) {
if (state is PropertyAppraisalLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is PropertyAppraisalLoaded) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
if (state is PropertyAppraisalErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
// Fluttertoast.showToast(
// msg: onError,
// fontSize: 24,
// toastLength: Toast.LENGTH_LONG,
// gravity: ToastGravity.CENTER,
// backgroundColor: Colors.black,
// textColor: Colors.white);
}
}, builder: (context, state) {
if (state is PropertyAppraisalLoaded) {
return ListView( return ListView(
children: [ children: [
Align( Align(
alignment: Alignment.center, alignment: Alignment.center,
child: Container( child: Container(
margin: const EdgeInsets.fromLTRB( margin: const EdgeInsets.fromLTRB(0, 20, 0, 20),
0, 20, 0, 20),
child: const Text( child: const Text(
'PROPERTY ASSESSMENT cont..', 'PROPERTY ASSESSMENT cont..',
style: TextStyle( style: TextStyle(
@ -584,8 +81,8 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
Expanded( Expanded(
flex: 3, flex: 3,
child: SingleChildScrollView( child: SingleChildScrollView(
padding: EdgeInsets.only( padding:
left: 20.0, right: 20.0), EdgeInsets.only(left: 20.0, right: 20.0),
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
child: Column(children: [ child: Column(children: [
Row( Row(
@ -646,8 +143,8 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
child: FormBuilderTextField( child: FormBuilderTextField(
name: 'qtr', name: 'qtr',
validator: validator:
FormBuilderValidators FormBuilderValidators.compose(
.compose([]), []),
), ),
), ),
const SizedBox( const SizedBox(
@ -660,8 +157,8 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
child: FormBuilderTextField( child: FormBuilderTextField(
name: 'yr', name: 'yr',
validator: validator:
FormBuilderValidators FormBuilderValidators.compose(
.compose([]), []),
), ),
), ),
], ],
@ -695,8 +192,7 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
items: signatories items: signatories
.map((signatories) => .map((signatories) =>
DropdownMenuItem( DropdownMenuItem(
value: value: signatories,
signatories,
child: Text( child: Text(
'${signatories.firstname} ${signatories.middlename} ${signatories.lastname}'), '${signatories.firstname} ${signatories.middlename} ${signatories.lastname}'),
)) ))
@ -712,18 +208,15 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
children: [ children: [
SizedBox( SizedBox(
width: 100, width: 100,
child: child: FormBuilderDateTimePicker(
FormBuilderDateTimePicker(
name: 'app_date', name: 'app_date',
initialEntryMode: initialEntryMode:
DatePickerEntryMode DatePickerEntryMode
.calendarOnly, .calendarOnly,
initialValue: initialValue: DateTime.now(),
DateTime.now(),
inputType: InputType.date, inputType: InputType.date,
initialTime: initialTime: const TimeOfDay(
const TimeOfDay(
hour: 8, minute: 0), hour: 8, minute: 0),
// locale: const Locale.fromSubtags(languageCode: 'fr'), // locale: const Locale.fromSubtags(languageCode: 'fr'),
), ),
@ -758,8 +251,7 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
items: signatories items: signatories
.map((signatories) => .map((signatories) =>
DropdownMenuItem( DropdownMenuItem(
value: value: signatories,
signatories,
child: Text( child: Text(
'${signatories.firstname} ${signatories.middlename} ${signatories.lastname}'), '${signatories.firstname} ${signatories.middlename} ${signatories.lastname}'),
)) ))
@ -775,18 +267,15 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
children: [ children: [
SizedBox( SizedBox(
width: 100, width: 100,
child: child: FormBuilderDateTimePicker(
FormBuilderDateTimePicker(
name: 'rec_date', name: 'rec_date',
initialEntryMode: initialEntryMode:
DatePickerEntryMode DatePickerEntryMode
.calendarOnly, .calendarOnly,
initialValue: initialValue: DateTime.now(),
DateTime.now(),
inputType: InputType.date, inputType: InputType.date,
initialTime: initialTime: const TimeOfDay(
const TimeOfDay(
hour: 8, minute: 0), hour: 8, minute: 0),
// locale: const Locale.fromSubtags(languageCode: 'fr'), // locale: const Locale.fromSubtags(languageCode: 'fr'),
), ),
@ -808,8 +297,7 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
), ),
)), )),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.center,
MainAxisAlignment.center,
children: [ children: [
Column( Column(
children: [ children: [
@ -822,8 +310,7 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
items: signatories items: signatories
.map((signatories) => .map((signatories) =>
DropdownMenuItem( DropdownMenuItem(
value: value: signatories,
signatories,
child: Text( child: Text(
'${signatories.firstname} ${signatories.middlename} ${signatories.lastname}'), '${signatories.firstname} ${signatories.middlename} ${signatories.lastname}'),
)) ))
@ -863,14 +350,13 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
title: Text( title: Text(
'${memoranda.memoranda}', '${memoranda.memoranda}',
overflow: overflow:
TextOverflow TextOverflow.ellipsis,
.ellipsis,
), ),
), ),
)) ))
.toList(), .toList(),
validator: FormBuilderValidators validator:
.required( FormBuilderValidators.required(
errorText: errorText:
"This field is required"), "This field is required"),
// searchInputDecoration: // searchInputDecoration:
@ -881,12 +367,11 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
// Icons.arrow_drop_down), // Icons.arrow_drop_down),
// ), // ),
// focusNode: focus, // focusNode: focus,
suggestionState: suggestionState: Suggestion.expand,
Suggestion.expand,
onSuggestionTap: (memoranda) { onSuggestionTap: (memoranda) {
setState(() { setState(() {
_memoranda = memoranda _memoranda =
.item!.memoranda!; memoranda.item!.memoranda!;
}); });
focus.unfocus(); focus.unfocus();
}, },
@ -905,8 +390,8 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
child: FormBuilderTextField( child: FormBuilderTextField(
name: 'sworn_statement', name: 'sworn_statement',
decoration: InputDecoration(), decoration: InputDecoration(),
validator: FormBuilderValidators validator:
.compose([]), FormBuilderValidators.compose([]),
), ),
), ),
], ],
@ -925,8 +410,7 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
child: FormBuilderDateTimePicker( child: FormBuilderDateTimePicker(
name: 'date_received', name: 'date_received',
initialEntryMode: initialEntryMode:
DatePickerEntryMode DatePickerEntryMode.calendarOnly,
.calendarOnly,
initialValue: DateTime.now(), initialValue: DateTime.now(),
inputType: InputType.date, inputType: InputType.date,
@ -952,8 +436,7 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
child: FormBuilderDateTimePicker( child: FormBuilderDateTimePicker(
name: 'date_of_entry', name: 'date_of_entry',
initialEntryMode: initialEntryMode:
DatePickerEntryMode DatePickerEntryMode.calendarOnly,
.calendarOnly,
initialValue: DateTime.now(), initialValue: DateTime.now(),
inputType: InputType.date, inputType: InputType.date,
@ -978,8 +461,8 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
child: FormBuilderTextField( child: FormBuilderTextField(
name: 'by', name: 'by',
decoration: InputDecoration(), decoration: InputDecoration(),
validator: FormBuilderValidators validator:
.compose([]), FormBuilderValidators.compose([]),
), ),
), ),
], ],
@ -990,8 +473,7 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
ElevatedButton( ElevatedButton(
onPressed: () async { onPressed: () async {
final tempID = final tempID =
await SharedPreferences await SharedPreferences.getInstance();
.getInstance();
print(tempID.getInt('tempid')! - 1); print(tempID.getInt('tempid')! - 1);
final List<PropertyAssessment> final List<PropertyAssessment>
propertyAssessments = []; propertyAssessments = [];
@ -1002,82 +484,103 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
bldgapprDetailsId: bldgapprDetailsId:
tempID.getInt('tempid')! - 1, tempID.getInt('tempid')! - 1,
actualUse: formKey.currentState! actualUse: formKey.currentState!
.value['actual_use'], .value['actual_use'] ??
'', // Replace null with an empty string
marketValue: '0.00', marketValue: '0.00',
assessmentLevel: '0.00', assessmentLevel: '0.00',
assessedValue: '0.00', assessedValue: '0.00',
taxable: isTaxable, taxable: isTaxable,
exempt: isExempt, exempt: isExempt,
qtr: int.parse(formKey qtr: int.parse(formKey
.currentState!.value['qtr']), .currentState!.value['qtr'] ??
yr: int.parse(formKey '0'), // Replace null with '0'
.currentState!.value['yr']), yr: int.parse(
appraisedbyName: formKey formKey.currentState!.value['yr'] ??
'0'), // Replace null with '0'
appraisedbyName: (formKey
.currentState! .currentState!
.value['appraised_by'] .value['appraised_by']
.firstname + ?.firstname ??
'') +
' ' + ' ' +
formKey (formKey
.currentState! .currentState!
.value['appraised_by'] .value['appraised_by']
.middlename + ?.middlename ??
'') +
' ' + ' ' +
formKey (formKey
.currentState! .currentState!
.value['appraised_by'] .value['appraised_by']
.lastname, ?.lastname ??
appraisedbyDate: formKey ''),
.currentState! appraisedbyDate: formKey.currentState!
.value['app_date'], .value['app_date']
recommendapprName: formKey as DateTime? ??
DateTime
.now(), // Replace null with current date
recommendapprName: (formKey
.currentState! .currentState!
.value['rec_approval'] .value['rec_approval']
.firstname + ?.firstname ??
'') +
' ' + ' ' +
formKey (formKey
.currentState! .currentState!
.value['rec_approval'] .value['rec_approval']
.middlename + ?.middlename ??
'') +
' ' + ' ' +
formKey (formKey
.currentState! .currentState!
.value['rec_approval'] .value['rec_approval']
.lastname, ?.lastname ??
recommendapprDate: formKey ''),
.currentState! recommendapprDate: formKey.currentState!
.value['rec_date'], .value['rec_date']
approvedbyName: formKey as DateTime? ??
DateTime
.now(), // Replace null with current date
approvedbyName: (formKey
.currentState! .currentState!
.value['apprvd_by'] .value['apprvd_by']
.firstname + ?.firstname ??
'') +
' ' + ' ' +
formKey (formKey
.currentState! .currentState!
.value['apprvd_by'] .value['apprvd_by']
.middlename + ?.middlename ??
'') +
' ' + ' ' +
formKey (formKey
.currentState! .currentState!
.value['apprvd_by'] .value['apprvd_by']
.lastname, ?.lastname ??
''),
memoranda: _memoranda, memoranda: _memoranda,
swornstatementNo: formKey swornstatementNo: formKey.currentState!
.currentState! .value['sworn_statement'] ??
.value['sworn_statement'], '', // Replace null with an empty string
dateReceived: formKey dateReceived: formKey.currentState!
.currentState! .value['date_received']
.value['date_received'], as DateTime? ??
DateTime
.now(), // Replace null with current date
entryDateAssessment: formKey entryDateAssessment: formKey
.currentState! .currentState!
.value['date_of_entry'], .value['date_of_entry']
as DateTime? ??
DateTime
.now(), // Replace null with current date
entryDateBy: formKey entryDateBy: formKey
.currentState!.value['by'], .currentState!.value['by'] ??
'', // Replace null with an empty string
); );
propertyAssessments.add(ass); propertyAssessments.add(ass);
context context.read<PropertyAssessmentBloc>()
.read<PropertyAssessmentBloc>()
..add(UpdatePropertyAssessment( ..add(UpdatePropertyAssessment(
assessment: assessment:
propertyAssessments[0])); propertyAssessments[0]));
@ -1110,59 +613,12 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
], ],
); );
} }
if (state is PropertyAppraisalErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context.read<PropertyAppraisalBloc>().add(
LoadPropertyAppraisal(
appraisal: PropertyAppraisal()));
},
);
}
return Container(); return Container();
});
}
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();
},
);
}
if (state is PropertyAssessmentErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context
.read<PropertyAssessmentBloc>()
.add(LoadPropertyAssessment());
},
);
}
return Container();
},
),
),
);
} }
} }

View File

@ -1,6 +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_form_builder/flutter_form_builder.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart'; import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart';
import 'package:unit2/model/passo/property_info.dart'; import 'package:unit2/model/passo/property_info.dart';
import 'package:unit2/screens/passo/Building/add_building.dart'; import 'package:unit2/screens/passo/Building/add_building.dart';
@ -98,9 +99,11 @@ class _PropertyInfoPage extends State<PropertyInfoPage> {
CustomButton( CustomButton(
icon: const Icon(Icons.chevron_right, color: Colors.white), icon: const Icon(Icons.chevron_right, color: Colors.white),
onPressed: () async { onPressed: () async {
try {
var property_info = PropertyInfo( var property_info = PropertyInfo(
id: 1, id: 1,
transCode: formKey.currentState!.value['transaction_code'] transCode: formKey
.currentState!.value['transaction_code']
.toString(), .toString(),
tdn: formKey.currentState!.value['arp_td'], tdn: formKey.currentState!.value['arp_td'],
pin: formKey.currentState!.value['pin'], pin: formKey.currentState!.value['pin'],
@ -111,7 +114,8 @@ class _PropertyInfoPage extends State<PropertyInfoPage> {
adminUser: formKey.currentState!.value['benificiary'], adminUser: formKey.currentState!.value['benificiary'],
adminAddress: adminAddress:
formKey.currentState!.value['benificiary_address'], formKey.currentState!.value['benificiary_address'],
adminTin: formKey.currentState!.value['benificiary_tin'], adminTin:
formKey.currentState!.value['benificiary_tin'],
adminTelno: adminTelno:
formKey.currentState!.value['benificiary_telno'], formKey.currentState!.value['benificiary_telno'],
assessedById: '1', assessedById: '1',
@ -124,16 +128,23 @@ class _PropertyInfoPage extends State<PropertyInfoPage> {
context.read<PropertyInfoBloc>().add( context.read<PropertyInfoBloc>().add(
AddPropertyInfo(property_info: property_info), AddPropertyInfo(property_info: property_info),
); );
widget.handleButtonPress();
} catch (e) {
Fluttertoast.showToast(
msg: "Slow internet connection, please try again!");
}
// Wait for the event to complete and get the result // Wait for the event to complete and get the result
bool success = await _waitForAddPropertyInfoToComplete(); // bool failed = await _waitForAddPropertyInfoToComplete();
if (success) { // if (failed) {
// Proceed to the next step or perform an action // // Proceed to the next step or perform an action
widget.handleButtonPress(); // Fluttertoast.showToast(
} else { // msg: "Slow internet connection, please try again!");
// Stay or show an error message // } else {
} // // Stay or show an error message
// widget.handleButtonPress();
// }
}, },
) )
]), ]),
@ -145,8 +156,8 @@ class _PropertyInfoPage extends State<PropertyInfoPage> {
// Wait for the state change indicating completion // Wait for the state change indicating completion
final propertyInfoState = context.read<PropertyInfoBloc>().state; final propertyInfoState = context.read<PropertyInfoBloc>().state;
if (propertyInfoState is PropertyInfoLoaded) { if (propertyInfoState is PropertyInfoErrorState) {
// Check if the add operation was successful // Check if the add operation was unsuccessful
return true; // You'll need to define this in your state class return true; // You'll need to define this in your state class
} }

View File

@ -1,5 +1,6 @@
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:fluttertoast/fluttertoast.dart';
import 'package:multiselect/multiselect.dart'; import 'package:multiselect/multiselect.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart'; import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart';
@ -51,6 +52,7 @@ class _StructuralMaterialsPage extends State<StructuralMaterialsPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return StatefulBuilder(builder: (context, structuralState) {
return SingleChildScrollView( return SingleChildScrollView(
padding: const EdgeInsets.all(30.0), padding: const EdgeInsets.all(30.0),
child: Column( child: Column(
@ -74,7 +76,7 @@ class _StructuralMaterialsPage extends State<StructuralMaterialsPage> {
checkColor: Colors.white, checkColor: Colors.white,
value: foundationOthers, value: foundationOthers,
onChanged: (bool? value) { onChanged: (bool? value) {
setState(() { structuralState(() {
foundationOthers = value!; foundationOthers = value!;
}); });
}, },
@ -91,7 +93,7 @@ class _StructuralMaterialsPage extends State<StructuralMaterialsPage> {
replacement: DropDownMultiSelect( replacement: DropDownMultiSelect(
selected_values_style: TextStyle(color: Colors.black), selected_values_style: TextStyle(color: Colors.black),
onChanged: (List<String> x) { onChanged: (List<String> x) {
setState(() { structuralState(() {
foundation = x; foundation = x;
}); });
}, },
@ -113,7 +115,7 @@ class _StructuralMaterialsPage extends State<StructuralMaterialsPage> {
checkColor: Colors.white, checkColor: Colors.white,
value: columOthers, value: columOthers,
onChanged: (bool? value) { onChanged: (bool? value) {
setState(() { structuralState(() {
columOthers = value!; columOthers = value!;
}); });
}, },
@ -125,11 +127,12 @@ class _StructuralMaterialsPage extends State<StructuralMaterialsPage> {
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
child: Visibility( child: Visibility(
visible: columOthers, visible: columOthers,
child: customTextField("Enter other columns", "", "other_column"), child:
customTextField("Enter other columns", "", "other_column"),
replacement: DropDownMultiSelect( replacement: DropDownMultiSelect(
selected_values_style: TextStyle(color: Colors.black), selected_values_style: TextStyle(color: Colors.black),
onChanged: (List<String> x) { onChanged: (List<String> x) {
setState(() { structuralState(() {
column = x; column = x;
}); });
}, },
@ -151,7 +154,7 @@ class _StructuralMaterialsPage extends State<StructuralMaterialsPage> {
checkColor: Colors.white, checkColor: Colors.white,
value: beamsOthers, value: beamsOthers,
onChanged: (bool? value) { onChanged: (bool? value) {
setState(() { structuralState(() {
beamsOthers = value!; beamsOthers = value!;
}); });
}, },
@ -167,7 +170,7 @@ class _StructuralMaterialsPage extends State<StructuralMaterialsPage> {
replacement: DropDownMultiSelect( replacement: DropDownMultiSelect(
selected_values_style: TextStyle(color: Colors.black), selected_values_style: TextStyle(color: Colors.black),
onChanged: (List<String> x) { onChanged: (List<String> x) {
setState(() { structuralState(() {
beam = x; beam = x;
}); });
}, },
@ -189,7 +192,7 @@ class _StructuralMaterialsPage extends State<StructuralMaterialsPage> {
checkColor: Colors.white, checkColor: Colors.white,
value: tfOthers, value: tfOthers,
onChanged: (bool? value) { onChanged: (bool? value) {
setState(() { structuralState(() {
tfOthers = value!; tfOthers = value!;
}); });
}, },
@ -206,7 +209,7 @@ class _StructuralMaterialsPage extends State<StructuralMaterialsPage> {
replacement: DropDownMultiSelect( replacement: DropDownMultiSelect(
selected_values_style: TextStyle(color: Colors.black), selected_values_style: TextStyle(color: Colors.black),
onChanged: (List<String> x) { onChanged: (List<String> x) {
setState(() { structuralState(() {
truss_framing = x; truss_framing = x;
}); });
}, },
@ -228,7 +231,7 @@ class _StructuralMaterialsPage extends State<StructuralMaterialsPage> {
checkColor: Colors.white, checkColor: Colors.white,
value: roofOthers, value: roofOthers,
onChanged: (bool? value) { onChanged: (bool? value) {
setState(() { structuralState(() {
roofOthers = value!; roofOthers = value!;
}); });
}, },
@ -244,7 +247,7 @@ class _StructuralMaterialsPage extends State<StructuralMaterialsPage> {
replacement: DropDownMultiSelect( replacement: DropDownMultiSelect(
selected_values_style: TextStyle(color: Colors.black), selected_values_style: TextStyle(color: Colors.black),
onChanged: (List<String> x) { onChanged: (List<String> x) {
setState(() { structuralState(() {
roof = x; roof = x;
}); });
}, },
@ -275,7 +278,7 @@ class _StructuralMaterialsPage extends State<StructuralMaterialsPage> {
checkColor: Colors.white, checkColor: Colors.white,
value: flooringOthers, value: flooringOthers,
onChanged: (bool? value) { onChanged: (bool? value) {
setState(() { structuralState(() {
flooringOthers = value!; flooringOthers = value!;
}); });
}, },
@ -292,7 +295,7 @@ class _StructuralMaterialsPage extends State<StructuralMaterialsPage> {
replacement: DropDownMultiSelect( replacement: DropDownMultiSelect(
selected_values_style: TextStyle(color: Colors.black), selected_values_style: TextStyle(color: Colors.black),
onChanged: (List<String> x) { onChanged: (List<String> x) {
setState(() { structuralState(() {
flooring = x; flooring = x;
}); });
}, },
@ -320,7 +323,7 @@ class _StructuralMaterialsPage extends State<StructuralMaterialsPage> {
checkColor: Colors.white, checkColor: Colors.white,
value: wpOthers, value: wpOthers,
onChanged: (bool? value) { onChanged: (bool? value) {
setState(() { structuralState(() {
wpOthers = value!; wpOthers = value!;
}); });
}, },
@ -360,11 +363,11 @@ class _StructuralMaterialsPage extends State<StructuralMaterialsPage> {
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
CustomButton( CustomButton(
icon: icon: const Icon(Icons.chevron_left_rounded,
const Icon(Icons.chevron_left_rounded, color: Colors.white), color: Colors.white),
onPressed: () { onPressed: () {
{ {
widget.NextBtn(); widget.PrevBtn();
} }
; ;
}, },
@ -374,11 +377,13 @@ class _StructuralMaterialsPage extends State<StructuralMaterialsPage> {
color: Colors.white), color: Colors.white),
onPressed: () async { onPressed: () async {
{ {
try {
final tempID = await SharedPreferences.getInstance(); final tempID = await SharedPreferences.getInstance();
var strucMaterials = StructureMaterialsII( var strucMaterials = StructureMaterialsII(
id: tempID.getInt('tempid')! - 1, id: tempID.getInt('tempid')! - 1,
foundation: foundationOthers foundation: foundationOthers
? formKey.currentState!.value['other_foundation'] ? formKey
.currentState!.value['other_foundation']
.split(',') .split(',')
: foundation, : foundation,
columns: columOthers columns: columOthers
@ -390,7 +395,8 @@ class _StructuralMaterialsPage extends State<StructuralMaterialsPage> {
.split(',') .split(',')
: beam, : beam,
trussFraming: tfOthers trussFraming: tfOthers
? formKey.currentState!.value['other_tf'].split(',') ? formKey.currentState!.value['other_tf']
.split(',')
: truss_framing, : truss_framing,
roof: roofOthers roof: roofOthers
? formKey.currentState!.value['other_roof'] ? formKey.currentState!.value['other_roof']
@ -401,13 +407,16 @@ class _StructuralMaterialsPage extends State<StructuralMaterialsPage> {
.split(',') .split(',')
: flooring, : flooring,
walls: wpOthers walls: wpOthers
? formKey.currentState!.value['other_wp'].split(',') ? formKey.currentState!.value['other_wp']
.split(',')
: walls, : walls,
others: ["Others"]); others: ["Others"]);
context.read<PropertyInfoBloc>() context.read<PropertyInfoBloc>()
..add(UpdateStrucMaterials(data: strucMaterials)); ..add(UpdateStrucMaterials(data: strucMaterials));
} catch (e) {
widget.PrevBtn(); Fluttertoast.showToast(
msg: "Slow internet connection, please try again!");
}
} }
; ;
}, },
@ -417,5 +426,6 @@ class _StructuralMaterialsPage extends State<StructuralMaterialsPage> {
], ],
), ),
); );
});
} }
} }

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:flutter_progress_hud/flutter_progress_hud.dart'; import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart';
@ -16,6 +17,8 @@ import 'package:unit2/screens/passo/Building/edit_building/property_appraisal.da
import 'package:unit2/screens/passo/Building/edit_building/property_assessement_edit.dart'; import 'package:unit2/screens/passo/Building/edit_building/property_assessement_edit.dart';
import 'package:unit2/screens/passo/Building/edit_building/property_owner_info.dart'; import 'package:unit2/screens/passo/Building/edit_building/property_owner_info.dart';
import 'package:unit2/screens/passo/Building/edit_building/structural_materials.dart'; import 'package:unit2/screens/passo/Building/edit_building/structural_materials.dart';
import 'package:unit2/screens/passo/Building/edit_building/structural_materials_edit.dart';
import 'package:unit2/screens/passo/Land/add_land.dart';
import 'package:unit2/theme-data.dart/colors.dart'; import 'package:unit2/theme-data.dart/colors.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';
@ -54,9 +57,7 @@ class _EditBuilding extends State<EditBuilding> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return Scaffold(
debugShowCheckedModeBanner: false,
home: Scaffold(
appBar: AppBar( appBar: AppBar(
centerTitle: true, centerTitle: true,
backgroundColor: primary, backgroundColor: primary,
@ -115,9 +116,7 @@ class _EditBuilding extends State<EditBuilding> {
}, },
builder: (context, state) { builder: (context, state) {
if (state is ClassComponentLoaded) { if (state is ClassComponentLoaded) {
return Padding( return Column(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [ children: [
NumberStepper( NumberStepper(
numbers: [1, 2, 3, 4, 5, 6, 7], numbers: [1, 2, 3, 4, 5, 6, 7],
@ -135,10 +134,19 @@ class _EditBuilding extends State<EditBuilding> {
}); });
}, },
), ),
content(unit, state.classes), Expanded(
], child: StatefulBuilder(builder:
(BuildContext context, StateSetter setState) {
return Container(
child: content(
unit,
state.classes,
), ),
); );
}),
),
],
);
} }
if (state is ClassComponentErrorState) { if (state is ClassComponentErrorState) {
return SomethingWentWrong( return SomethingWentWrong(
@ -166,7 +174,6 @@ class _EditBuilding extends State<EditBuilding> {
}, },
), ),
), ),
),
); );
} }
@ -184,7 +191,7 @@ class _EditBuilding extends State<EditBuilding> {
return GeneralDescriptionEdit(unit, widget.faas.id!, NextBtn, PrevBtn); return GeneralDescriptionEdit(unit, widget.faas.id!, NextBtn, PrevBtn);
case 3: case 3:
return StructuralMaterialsPageEdit(widget.faas.id!, NextBtn, PrevBtn); return StructuralMaterialsEditPage(widget.faas.id!, NextBtn, PrevBtn);
case 4: case 4:
return AdditionalItemEditPage( return AdditionalItemEditPage(

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/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/additional_items_edit/additional_items_edit_bloc.dart';
@ -41,9 +43,25 @@ class _AdditionalItemEditPage extends State<AdditionalItemEditPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BlocConsumer<AdditionalItemsEditBloc, AdditionalItemsEditState>( return Scaffold(
body: ProgressHUD(
padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocConsumer<AdditionalItemsEditBloc, AdditionalItemsEditState>(
listener: (context, state) { listener: (context, state) {
// TODO: implement listener if (state is AdditionalItemsEditLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is AdditionalItemsEditLoaded) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
if (state is AdditionalItemsEditErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
}, },
builder: (context, state) { builder: (context, state) {
final state = context.watch<AdditionalItemsEditBloc>().state; final state = context.watch<AdditionalItemsEditBloc>().state;
@ -63,7 +81,8 @@ class _AdditionalItemEditPage extends State<AdditionalItemEditPage> {
left: 0, top: 20, right: 0, bottom: 10), left: 0, top: 20, right: 0, bottom: 10),
child: const Text('ADDITIONAL ITEMS', child: const Text('ADDITIONAL ITEMS',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 18), fontWeight: FontWeight.bold,
fontSize: 18),
textAlign: TextAlign.left), textAlign: TextAlign.left),
), ),
Align( Align(
@ -233,7 +252,8 @@ class _AdditionalItemEditPage extends State<AdditionalItemEditPage> {
Navigator.of(context).pop(); Navigator.of(context).pop();
context.read<AdditionalItemsEditBloc>().add( context.read<AdditionalItemsEditBloc>().add(
LoadAdditionalItemsEdit( LoadAdditionalItemsEdit(
items: const <AdditionalItems>[], id: widget.tempId)); items: const <AdditionalItems>[],
id: widget.tempId));
}); });
}); });
} }
@ -269,7 +289,8 @@ class _AdditionalItemEditPage extends State<AdditionalItemEditPage> {
margin: const EdgeInsets.only( margin: const EdgeInsets.only(
left: 0, top: 20, right: 0, bottom: 10), left: 0, top: 20, right: 0, bottom: 10),
child: const Text('ADDITIONAL MATERIALS', child: const Text('ADDITIONAL MATERIALS',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18), style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 18),
textAlign: TextAlign.left), textAlign: TextAlign.left),
), ),
Align( Align(
@ -300,6 +321,8 @@ class _AdditionalItemEditPage extends State<AdditionalItemEditPage> {
), ),
); );
}, },
),
),
); );
} }
} }

View File

@ -35,7 +35,8 @@ class _BldgLocLandRefEdit extends State<BldgLocLandRefEdit> {
Set<String> seenCityCodes = Set<String>(); Set<String> seenCityCodes = Set<String>();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ProgressHUD( return Scaffold(
body: ProgressHUD(
padding: const EdgeInsets.all(24), padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87, backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white), indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
@ -45,10 +46,7 @@ class _BldgLocLandRefEdit extends State<BldgLocLandRefEdit> {
final progress = ProgressHUD.of(context); final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait..."); progress!.showWithText("Please wait...");
} }
if (state is LocationLoaded) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
if (state is LocationErrorState) { if (state is LocationErrorState) {
final progress = ProgressHUD.of(context); final progress = ProgressHUD.of(context);
progress?.dismiss(); progress?.dismiss();
@ -63,10 +61,6 @@ class _BldgLocLandRefEdit extends State<BldgLocLandRefEdit> {
final progress = ProgressHUD.of(context); final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait..."); progress!.showWithText("Please wait...");
} }
if (state is LandrefLoaded) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
if (state is LandrefErrorState) { if (state is LandrefErrorState) {
final progress = ProgressHUD.of(context); final progress = ProgressHUD.of(context);
progress?.dismiss(); progress?.dismiss();
@ -81,10 +75,6 @@ class _BldgLocLandRefEdit extends State<BldgLocLandRefEdit> {
final progress = ProgressHUD.of(context); final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait..."); progress!.showWithText("Please wait...");
} }
if (state is MunicipalityLoaded) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
if (state is MunicipalityErrorState) { if (state is MunicipalityErrorState) {
final progress = ProgressHUD.of(context); final progress = ProgressHUD.of(context);
progress?.dismiss(); progress?.dismiss();
@ -166,7 +156,8 @@ class _BldgLocLandRefEdit extends State<BldgLocLandRefEdit> {
child: FormBuilderDropdown<City>( child: FormBuilderDropdown<City>(
name: 'municipality', name: 'municipality',
autofocus: false, autofocus: false,
decoration: normalTextFieldStyle( decoration:
normalTextFieldStyle(
bldgloc.municipality ?? bldgloc.municipality ??
"Municipality", "Municipality",
"", "",
@ -174,7 +165,8 @@ class _BldgLocLandRefEdit extends State<BldgLocLandRefEdit> {
items: uniqueItems items: uniqueItems
.map( .map(
(city) => (city) =>
DropdownMenuItem<City>( DropdownMenuItem<
City>(
value: city, value: city,
child: Text( child: Text(
city.cityDescription ?? city.cityDescription ??
@ -282,7 +274,9 @@ class _BldgLocLandRefEdit extends State<BldgLocLandRefEdit> {
Expanded( Expanded(
flex: 1, flex: 1,
child: customTextField( child: customTextField(
"TD / ARP No.", "", 'l_td_arp'), "TD / ARP No.",
"",
'l_td_arp'),
), ),
const SizedBox(width: 10.0), const SizedBox(width: 10.0),
Expanded( Expanded(
@ -323,7 +317,8 @@ class _BldgLocLandRefEdit extends State<BldgLocLandRefEdit> {
?.value['brgy'], ?.value['brgy'],
municipality: keys municipality: keys
.currentState .currentState
?.value['municipality'] ?.value[
'municipality']
?.cityDescription ?? ?.cityDescription ??
bldgloc.municipality, bldgloc.municipality,
province: keys.currentState province: keys.currentState
@ -418,6 +413,7 @@ class _BldgLocLandRefEdit extends State<BldgLocLandRefEdit> {
return Container(); return Container();
}, },
), ),
),
); );
} }
} }

View File

@ -3,6 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:flutter_progress_hud/flutter_progress_hud.dart'; import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:unit2/bloc/passo/bulding/general_description/general_description_bloc.dart'; import 'package:unit2/bloc/passo/bulding/general_description/general_description_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/model/passo/general_description.dart'; import 'package:unit2/model/passo/general_description.dart';
@ -39,14 +40,36 @@ class _GeneralDescriptionEdit extends State<GeneralDescriptionEdit> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Expanded( return Scaffold(
body: Column(
children: [
Expanded(
child: ProgressHUD( child: ProgressHUD(
padding: const EdgeInsets.all(24), padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87, backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white), indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocConsumer<GeneralDescriptionBloc, GeneralDescriptionState>( child:
listener: (context, state) { BlocConsumer<GeneralDescriptionBloc, GeneralDescriptionState>(
// TODO: implement listener listener: (context, state) async {
if (state is GenDescLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is GenDescLoaded) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
final tempID = await SharedPreferences.getInstance();
await tempID.setInt(
'totalValue', int.parse(state.gendesc.totalFloorArea!));
await tempID.setString(
'actualUse', state.gendesc.actualUse!);
}
if (state is GenDescErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
}, },
builder: (context, state) { builder: (context, state) {
if (state is GenDescLoaded) { if (state is GenDescLoaded) {
@ -56,8 +79,10 @@ class _GeneralDescriptionEdit extends State<GeneralDescriptionEdit> {
'bldg_permit': state.gendesc.bldgPermit, 'bldg_permit': state.gendesc.bldgPermit,
'date_issued': state.gendesc.dateIssued.toString(), 'date_issued': state.gendesc.dateIssued.toString(),
'cct': state.gendesc.cct.toString(), 'cct': state.gendesc.cct.toString(),
'coc_issued': state.gendesc.certCompletionIssued.toString(), 'coc_issued':
'coo_issued': state.gendesc.certOccupancyIssued.toString(), state.gendesc.certCompletionIssued.toString(),
'coo_issued':
state.gendesc.certOccupancyIssued.toString(),
'date_cnstructed': state.gendesc.dateIssued.toString(), 'date_cnstructed': state.gendesc.dateIssued.toString(),
'date_occupied': state.gendesc.dateOccupied.toString(), 'date_occupied': state.gendesc.dateOccupied.toString(),
'bldg_age': state.gendesc.bldgAge.toString(), 'bldg_age': state.gendesc.bldgAge.toString(),
@ -88,7 +113,8 @@ class _GeneralDescriptionEdit extends State<GeneralDescriptionEdit> {
left: 0, top: 20, right: 0, bottom: 10), left: 0, top: 20, right: 0, bottom: 10),
child: const Text('GENERAL DESCRIPTION', child: const Text('GENERAL DESCRIPTION',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 18), fontWeight: FontWeight.bold,
fontSize: 18),
textAlign: TextAlign.left), textAlign: TextAlign.left),
), ),
Container( Container(
@ -98,13 +124,15 @@ class _GeneralDescriptionEdit extends State<GeneralDescriptionEdit> {
name: 'bldg_type', name: 'bldg_type',
autofocus: false, autofocus: false,
decoration: normalTextFieldStyle( decoration: normalTextFieldStyle(
state.gendesc.bldgKind ?? "Kind of Building", state.gendesc.bldgKind ??
"Kind of Building",
"Kind of Building"), "Kind of Building"),
items: widget.unit items: widget.unit
.map((e) => DropdownMenuItem( .map((e) => DropdownMenuItem(
value: e, value: e,
child: child: Text(e.bldgType +
Text(e.bldgType + '-' + e.building), '-' +
e.building),
)) ))
.toList(), .toList(),
), ),
@ -112,12 +140,15 @@ class _GeneralDescriptionEdit extends State<GeneralDescriptionEdit> {
customDropDownField( customDropDownField(
"Actual Use", "", 'actual_use', actual_use), "Actual Use", "", 'actual_use', actual_use),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 1, flex: 1,
child: customTextField( child: customTextField(
"Bldg. Permit No.", "", 'bldg_permit'), "Bldg. Permit No.",
"",
'bldg_permit'),
), ),
const SizedBox(width: 10.0), const SizedBox(width: 10.0),
Expanded( Expanded(
@ -133,7 +164,8 @@ class _GeneralDescriptionEdit extends State<GeneralDescriptionEdit> {
"", "",
'cct'), 'cct'),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 1, flex: 1,
@ -152,7 +184,8 @@ class _GeneralDescriptionEdit extends State<GeneralDescriptionEdit> {
'coo_issued')) 'coo_issued'))
]), ]),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 1, flex: 1,
@ -166,10 +199,13 @@ class _GeneralDescriptionEdit extends State<GeneralDescriptionEdit> {
// optional flex property if flex is 1 because the default flex is 1 // optional flex property if flex is 1 because the default flex is 1
flex: 1, flex: 1,
child: customDatTimePicker( child: customDatTimePicker(
"Date Occupied", "", 'date_occupied')) "Date Occupied",
"",
'date_occupied'))
]), ]),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 1, flex: 1,
@ -181,46 +217,60 @@ class _GeneralDescriptionEdit extends State<GeneralDescriptionEdit> {
// optional flex property if flex is 1 because the default flex is 1 // optional flex property if flex is 1 because the default flex is 1
flex: 1, flex: 1,
child: customTextField( child: customTextField(
"No. of storeys", "", 'no_of_storeys')) "No. of storeys",
"",
'no_of_storeys'))
]), ]),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 1, flex: 1,
child: customTextField( child: customTextField(
"Area of 1st Floor", "", 'area_of_1stFl'), "Area of 1st Floor",
"",
'area_of_1stFl'),
), ),
const SizedBox(width: 10.0), const SizedBox(width: 10.0),
Expanded( Expanded(
// optional flex property if flex is 1 because the default flex is 1 // optional flex property if flex is 1 because the default flex is 1
flex: 1, flex: 1,
child: customTextField("Area of 2nd Floor", child: customTextField(
"", 'area_of_2ndFl')) "Area of 2nd Floor",
"",
'area_of_2ndFl'))
]), ]),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 1, flex: 1,
child: customTextField("Area of 3rd Floor", child: customTextField(
"", 'area_of_3rdFl')), "Area of 3rd Floor",
"",
'area_of_3rdFl')),
const SizedBox(width: 10.0), const SizedBox(width: 10.0),
Expanded( Expanded(
// optional flex property if flex is 1 because the default flex is 1 // optional flex property if flex is 1 because the default flex is 1
flex: 1, flex: 1,
child: customTextField("Area of 4th Floor", child: customTextField(
"", 'area_of_4thFl')) "Area of 4th Floor",
"",
'area_of_4thFl'))
]), ]),
customTextField("Total Area", "", 'total_area'), customTextField("Total Area", "", 'total_area'),
SizedBox( SizedBox(
height: 50, height: 50,
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [ children: [
CustomButton( CustomButton(
icon: const Icon(Icons.chevron_left_rounded, icon: const Icon(
Icons.chevron_left_rounded,
color: Colors.white), color: Colors.white),
onPressed: () { onPressed: () {
{ {
@ -230,7 +280,8 @@ class _GeneralDescriptionEdit extends State<GeneralDescriptionEdit> {
}, },
), ),
CustomButton( CustomButton(
icon: const Icon(Icons.chevron_right_rounded, icon: const Icon(
Icons.chevron_right_rounded,
color: Colors.white), color: Colors.white),
onPressed: () { onPressed: () {
{ {
@ -247,19 +298,21 @@ class _GeneralDescriptionEdit extends State<GeneralDescriptionEdit> {
?.value['bldg_type'] ?.value['bldg_type']
?.bldgType ?? ?.bldgType ??
state.gendesc.strucType, state.gendesc.strucType,
bldgPermit: keys bldgPermit: keys.currentState
.currentState?.value['bldg_permit'], ?.value['bldg_permit'],
dateIssued: keys dateIssued: keys.currentState
.currentState?.value['coc_issued'], ?.value['coc_issued'],
cct: keys.currentState?.value['cct'], cct: keys
.currentState?.value['cct'],
certCompletionIssued: keys certCompletionIssued: keys
.currentState?.value['coc_issued'], .currentState
?.value['coc_issued'],
certOccupancyIssued: keys certOccupancyIssued: keys
.currentState?.value['coo_issued'], .currentState
dateCompleted: keys.currentState ?.value['coo_issued'],
?.value['date_cnstructed'], dateCompleted:
dateOccupied: keys.currentState keys.currentState?.value['date_cnstructed'],
?.value['date_occupied'], dateOccupied: keys.currentState?.value['date_occupied'],
bldgAge: int.tryParse(keys.currentState?.value['bldg_age']), bldgAge: int.tryParse(keys.currentState?.value['bldg_age']),
noStoreys: int.tryParse(keys.currentState?.value['no_of_storeys']), noStoreys: int.tryParse(keys.currentState?.value['no_of_storeys']),
area1Stfloor: keys.currentState?.value['area_of_1stFl'], area1Stfloor: keys.currentState?.value['area_of_1stFl'],
@ -292,8 +345,8 @@ class _GeneralDescriptionEdit extends State<GeneralDescriptionEdit> {
return SomethingWentWrong( return SomethingWentWrong(
message: onError, message: onError,
onpressed: () { onpressed: () {
context.read<GeneralDescriptionBloc>().add( context.read<GeneralDescriptionBloc>().add(LoadGenDesc(
LoadGenDesc(id: widget.tempId, gendesc: GeneralDesc())); id: widget.tempId, gendesc: GeneralDesc()));
}, },
); );
} }
@ -301,6 +354,9 @@ class _GeneralDescriptionEdit extends State<GeneralDescriptionEdit> {
}, },
), ),
), ),
),
],
),
); );
} }
} }

View File

@ -1,6 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:form_builder_validators/form_builder_validators.dart'; import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
@ -31,6 +33,24 @@ class PropertyAppraisalEditPage extends StatefulWidget {
class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> { class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
double depRate = 0; double depRate = 0;
// int totalAreas = 0;
// String actualUse = "";
// @override
// void initState() {
// super.initState();
// _loadDataFromSharedPreferences(); // Call the method to load data
// }
// Method to load data from SharedPreferences
// _loadDataFromSharedPreferences() async {
// SharedPreferences prefs = await SharedPreferences.getInstance();
// setState(() {
// actualUse = prefs.getString('actualUse') ?? '';
// totalAreas = prefs.getInt('totalArea') ??
// 0; // Provide a default value if the key doesn't exist
// });
// }
calculateAdditionalItems(List<AdditionalItems> items) { calculateAdditionalItems(List<AdditionalItems> items) {
double sum = 0; double sum = 0;
@ -498,42 +518,88 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BlocConsumer<PropertyAppraisalEditBloc, PropertyAppraisalEditState>( return ProgressHUD(
padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child:
BlocConsumer<PropertyAppraisalEditBloc, PropertyAppraisalEditState>(
listener: (context, state) { listener: (context, state) {
// TODO: implement listener if (state is PropertyAppraisalEditLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is PropertyAppraisalEditErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
}, },
builder: (context, state) { builder: (context, state) {
if (state is PropertyAppraisalEditLoaded) { if (state is PropertyAppraisalEditLoaded) {
final appraisal = state.appraisalEdit; final appraisal = state.appraisalEdit;
return BlocConsumer<AdditionalItemsEditBloc, return BlocConsumer<AdditionalItemsEditBloc,
AdditionalItemsEditState>(listener: (context, state) { AdditionalItemsEditState>(listener: (context, state) {
// TODO: implement listener if (state is PropertyAppraisalEditLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is AdditionalItemsEditLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is AdditionalItemsEditErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
}, builder: (context, state) { }, builder: (context, state) {
if (state is AdditionalItemsEditLoaded) { if (state is AdditionalItemsEditLoaded) {
final item = state.items; final item = state.items;
return BlocConsumer<GeneralDescriptionBloc, return BlocConsumer<GeneralDescriptionBloc,
GeneralDescriptionState>(listener: (context, state) { GeneralDescriptionState>(
// TODO: implement listener listener: (context, state) {
}, builder: (context, state) { if (state is GenDescLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is GenDescLoaded) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
if (state is GenDescErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
},
builder: (context, state) {
if (state is GenDescLoaded) { if (state is GenDescLoaded) {
double totalArea = double.tryParse( double totalArea = double.tryParse(
state.gendesc.totalFloorArea ?? (state.gendesc.totalFloorArea ??
appraisal.totalArea.toString()) ?? appraisal.totalArea)
?.toString() ??
'0.0') ??
0.0; 0.0;
double bldgUnitValue = double.tryParse( double bldgUnitValue = double.tryParse(keys.currentState
keys.currentState?.value['bldg_type']?.unitValue ?? ?.value['bldg_type']?.unitValue ??
appraisal.unitconstructCost) ?? appraisal.unitconstructCost) ??
0.0; 0.0;
return Expanded( return Column(
children: [
Expanded(
child: SingleChildScrollView( child: SingleChildScrollView(
child: Container( child: Container(
margin: const EdgeInsets.only(left: 20.0, right: 20.0), margin: const EdgeInsets.only(
left: 20.0, right: 20.0),
child: Column( child: Column(
children: [ children: [
Container( Container(
margin: const EdgeInsets.only( margin: const EdgeInsets.only(
left: 0, top: 20, right: 0, bottom: 20), left: 0,
top: 20,
right: 0,
bottom: 20),
child: const Text('PROPERTY APPRAISAL', child: const Text('PROPERTY APPRAISAL',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -541,10 +607,11 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
textAlign: TextAlign.left), textAlign: TextAlign.left),
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [ children: [
Container( Container(
child: Text( child: const Text(
"Unit Construction Cost", "Unit Construction Cost",
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -562,10 +629,11 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
), ),
const SizedBox(height: 15), const SizedBox(height: 15),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [ children: [
Container( Container(
child: Text( child: const Text(
"Building Core", "Building Core",
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -574,7 +642,7 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
), ),
), ),
Container( Container(
child: Text( child: const Text(
'', '',
textAlign: TextAlign.right, textAlign: TextAlign.right,
), ),
@ -583,10 +651,11 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
), ),
const SizedBox(height: 40), const SizedBox(height: 40),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [ children: [
Container( Container(
child: Text( child: const Text(
"Sub-total", "Sub-total",
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -604,10 +673,11 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
), ),
const SizedBox(height: 40), const SizedBox(height: 40),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [ children: [
Container( Container(
child: Text( child: const Text(
"Cost of Additional Items", "Cost of Additional Items",
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -616,7 +686,7 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
), ),
), ),
Container( Container(
child: Text( child: const Text(
'', '',
textAlign: TextAlign.right, textAlign: TextAlign.right,
), ),
@ -625,10 +695,11 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
), ),
const SizedBox(height: 15), const SizedBox(height: 15),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [ children: [
Container( Container(
child: Text( child: const Text(
"Sub-total", "Sub-total",
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -638,7 +709,8 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
), ),
Container( Container(
child: Text( child: Text(
appraisal.addItemsSubtotal!, appraisal.addItemsSubtotal ??
'0.00',
textAlign: TextAlign.right, textAlign: TextAlign.right,
), ),
) )
@ -646,10 +718,11 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
), ),
const SizedBox(height: 15), const SizedBox(height: 15),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [ children: [
Container( Container(
child: Text( child: const Text(
"Total Construction Cost", "Total Construction Cost",
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -662,9 +735,9 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
calculateConstructionCost( calculateConstructionCost(
double.parse(appraisal double.parse(appraisal
.unitconstructSubtotal!), .unitconstructSubtotal!),
double.parse( double.parse(appraisal
appraisal.addItemsSubtotal!)) .addItemsSubtotal!))
.toString()!, .toString(),
textAlign: TextAlign.right, textAlign: TextAlign.right,
), ),
) )
@ -672,10 +745,11 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
), ),
const SizedBox(height: 40), const SizedBox(height: 40),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [ children: [
Container( Container(
child: Text( child: const Text(
"Depreciation Rate", "Depreciation Rate",
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -688,10 +762,11 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
height: 25, height: 25,
child: FormBuilderTextField( child: FormBuilderTextField(
name: 'depRate', name: 'depRate',
decoration: decoration: normalTextFieldStyle(
normalTextFieldStyle("0.00", ""), "0.00", ""),
validator: validator:
FormBuilderValidators.compose([]), FormBuilderValidators.compose(
[]),
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
depRate = double.parse(value!); depRate = double.parse(value!);
@ -703,10 +778,11 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
), ),
const SizedBox(height: 15), const SizedBox(height: 15),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [ children: [
Container( Container(
child: Text( child: const Text(
"Depreciation Cost", "Depreciation Cost",
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -719,9 +795,12 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
calculateDepCost( calculateDepCost(
(totalArea * bldgUnitValue), (totalArea * bldgUnitValue),
item, item,
double.parse(keys.currentState double.parse(keys
?.value['depRate'] ?? .currentState
appraisal.depreciationRate)) ?.value[
'depRate'] ??
appraisal
.depreciationRate))
.toString(), .toString(),
textAlign: TextAlign.right, textAlign: TextAlign.right,
), ),
@ -730,10 +809,11 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
), ),
const SizedBox(height: 15), const SizedBox(height: 15),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [ children: [
Container( Container(
child: Text( child: const Text(
"Total % Depreciation", "Total % Depreciation",
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -751,10 +831,11 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
), ),
const SizedBox(height: 15), const SizedBox(height: 15),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [ children: [
Container( Container(
child: Text( child: const Text(
"Market Value", "Market Value",
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -767,9 +848,12 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
calculateMarketValue( calculateMarketValue(
(totalArea * bldgUnitValue), (totalArea * bldgUnitValue),
item, item,
double.parse(keys.currentState double.parse(keys
?.value['depRate'] ?? .currentState
appraisal.depreciationRate)) ?.value[
'depRate'] ??
appraisal
.depreciationRate))
.toString(), .toString(),
textAlign: TextAlign.right, textAlign: TextAlign.right,
), ),
@ -783,19 +867,21 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
child: SingleChildScrollView( child: SingleChildScrollView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
child: Container( child: Container(
margin: const EdgeInsets.symmetric( margin:
const EdgeInsets.symmetric(
horizontal: 20.0), horizontal: 20.0),
child: Column( child: Column(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.start, MainAxisAlignment.start,
children: [ children: [
Container( Container(
margin: const EdgeInsets.fromLTRB( margin: const EdgeInsets
0, 20, 0, 20), .fromLTRB(0, 20, 0, 20),
child: const Text( child: const Text(
'PROPERTY ASSESSMENT', 'PROPERTY ASSESSMENT',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight:
FontWeight.bold,
fontSize: 18, fontSize: 18,
), ),
textAlign: TextAlign.left, textAlign: TextAlign.left,
@ -808,84 +894,101 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
Container( Container(
width: 100, width: 100,
margin: margin:
const EdgeInsets.only( const EdgeInsets
top: 15, left: 15), .only(
top: 15,
left: 15),
padding: padding:
const EdgeInsets.all( const EdgeInsets
5.0), .all(5.0),
child: const Text( child: const Text(
'Actual Use', 'Actual Use',
style: TextStyle( style: TextStyle(
fontWeight: fontWeight:
FontWeight.bold, FontWeight
.bold,
fontSize: 13, fontSize: 13,
), ),
textAlign: textAlign:
TextAlign.center, TextAlign
.center,
), ),
), ),
Container( Container(
width: 150, width: 150,
margin: margin:
const EdgeInsets.only( const EdgeInsets
top: 15, left: 15), .only(
top: 15,
left: 15),
padding: padding:
const EdgeInsets.all( const EdgeInsets
5.0), .all(5.0),
child: const Text( child: const Text(
'Market Value', 'Market Value',
style: TextStyle( style: TextStyle(
fontWeight: fontWeight:
FontWeight.bold, FontWeight
.bold,
fontSize: 13, fontSize: 13,
), ),
textAlign: textAlign:
TextAlign.center, TextAlign
.center,
), ),
), ),
Container( Container(
width: 100, width: 100,
margin: margin:
const EdgeInsets.only( const EdgeInsets
top: 15, left: 15), .only(
top: 15,
left: 15),
padding: padding:
const EdgeInsets.all( const EdgeInsets
5.0), .all(5.0),
child: const Text( child: const Text(
'Ass. Level', 'Ass. Level',
style: TextStyle( style: TextStyle(
fontWeight: fontWeight:
FontWeight.bold, FontWeight
.bold,
fontSize: 13, fontSize: 13,
), ),
textAlign: textAlign:
TextAlign.center, TextAlign
.center,
), ),
), ),
Container( Container(
width: 150, width: 150,
margin: margin:
const EdgeInsets.only( const EdgeInsets
top: 15, left: 15), .only(
top: 15,
left: 15),
padding: padding:
const EdgeInsets.all( const EdgeInsets
5.0), .all(5.0),
child: const Text( child: const Text(
'Ass. Value', 'Ass. Value',
style: TextStyle( style: TextStyle(
fontWeight: fontWeight:
FontWeight.bold, FontWeight
.bold,
fontSize: 13, fontSize: 13,
), ),
textAlign: textAlign:
TextAlign.center, TextAlign
.center,
), ),
), ),
], ],
), ),
SizedBox( SizedBox(
height: 50, height: 50,
child: SingleChildScrollView( child:
SingleChildScrollView(
scrollDirection: scrollDirection:
Axis.horizontal, Axis.horizontal,
child: Row(children: [ child: Row(children: [
@ -895,23 +998,24 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
children: [ children: [
Container( Container(
width: 100, width: 100,
margin: margin: const EdgeInsets
const EdgeInsets
.only( .only(
top: 15, top: 15,
left: 15), left:
15),
padding: padding:
const EdgeInsets const EdgeInsets.all(
.all(5.0), 5.0),
child: Text( child: Text(
state.gendesc state.gendesc
.actualUse ?? .actualUse ??
"", "",
style: TextStyle( style:
const TextStyle(
fontWeight: fontWeight:
FontWeight FontWeight.bold,
.bold, fontSize:
fontSize: 13, 13,
), ),
textAlign: textAlign:
TextAlign TextAlign
@ -920,34 +1024,35 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
), ),
Container( Container(
width: 150, width: 150,
margin: margin: const EdgeInsets
const EdgeInsets
.only( .only(
top: 15, top: 15,
left: 15), left:
15),
padding: padding:
const EdgeInsets const EdgeInsets.all(
.all(5.0), 5.0),
child: Text( child: Text(
NumberFormat NumberFormat
.currency( .currency(
locale: 'en-PH', locale:
symbol: "", 'en-PH',
symbol:
"",
).format( ).format(
calculateMarketValue( calculateMarketValue(
(totalArea * (totalArea *
bldgUnitValue), bldgUnitValue),
item, item,
double.parse(keys double.parse(keys.currentState?.value['depRate'] ??
.currentState
?.value['depRate'] ??
appraisal.depreciationRate)), appraisal.depreciationRate)),
), ),
style: TextStyle( style:
const TextStyle(
fontWeight: fontWeight:
FontWeight FontWeight.bold,
.bold, fontSize:
fontSize: 13, 13,
), ),
textAlign: textAlign:
TextAlign TextAlign
@ -956,28 +1061,22 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
), ),
Container( Container(
width: 100, width: 100,
margin: margin: const EdgeInsets
const EdgeInsets
.only( .only(
top: 15, top: 15,
left: 15), left:
15),
padding: padding:
const EdgeInsets const EdgeInsets.all(
.all(5.0), 5.0),
child: Text( child: Text(
assessmentLevel( '${assessmentLevel(calculateMarketValue((totalArea * bldgUnitValue), item, double.parse(keys.currentState?.value['depRate'] ?? appraisal.depreciationRate)).toString(), state.gendesc.actualUse)}%',
calculateMarketValue( style:
(totalArea * bldgUnitValue), const TextStyle(
item,
double.parse(keys.currentState?.value['depRate'] ?? appraisal.depreciationRate))
.toString(),
state.gendesc.actualUse) +
'%',
style: TextStyle(
fontWeight: fontWeight:
FontWeight FontWeight.bold,
.bold, fontSize:
fontSize: 13, 13,
), ),
textAlign: textAlign:
TextAlign TextAlign
@ -986,35 +1085,33 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
), ),
Container( Container(
width: 150, width: 150,
margin: margin: const EdgeInsets
const EdgeInsets
.only( .only(
top: 15, top: 15,
left: 15), left:
15),
padding: padding:
const EdgeInsets const EdgeInsets.all(
.all(5.0), 5.0),
child: Text( child: Text(
NumberFormat NumberFormat
.currency( .currency(
locale: 'en-PH', locale:
symbol: "", 'en-PH',
symbol:
"",
).format(assessmentValue( ).format(assessmentValue(
calculateMarketValue( calculateMarketValue((totalArea * bldgUnitValue), item, double.parse(keys.currentState?.value['depRate'] ?? appraisal.depreciationRate))
(totalArea *
bldgUnitValue),
item,
double.parse(keys.currentState?.value['depRate'] ??
appraisal
.depreciationRate))
.toString(), .toString(),
state.gendesc state
.gendesc
.actualUse)), .actualUse)),
style: TextStyle( style:
const TextStyle(
fontWeight: fontWeight:
FontWeight FontWeight.bold,
.bold, fontSize:
fontSize: 13, 13,
), ),
textAlign: textAlign:
TextAlign TextAlign
@ -1040,10 +1137,12 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
], ],
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [ children: [
CustomButton( CustomButton(
icon: const Icon(Icons.chevron_left_rounded, icon: const Icon(
Icons.chevron_left_rounded,
color: Colors.white), color: Colors.white),
onPressed: () { onPressed: () {
{ {
@ -1053,13 +1152,16 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
}, },
), ),
CustomButton( CustomButton(
icon: const Icon(Icons.chevron_right_rounded, icon: const Icon(
Icons.chevron_right_rounded,
color: Colors.white), color: Colors.white),
onPressed: () async { onPressed: () async {
final tempID = final tempID =
await SharedPreferences.getInstance(); await SharedPreferences
.getInstance();
final id = tempID.getInt('tempid')! - 1; final id =
tempID.getInt('tempid')! - 1;
{ {
var appraisals = PropertyAppraisalEdit( var appraisals = PropertyAppraisalEdit(
id: 1, id: 1,
@ -1070,11 +1172,10 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
unitconstructSubtotal: unitconstructSubtotal:
(totalArea * bldgUnitValue) (totalArea * bldgUnitValue)
.toString(), .toString(),
depreciationRate: depRate.toString(), depreciationRate:
depreciationCost: calculateDepCost( depRate.toString(),
(totalArea * bldgUnitValue), depreciationCost:
item, calculateDepCost((totalArea * bldgUnitValue), item, depRate)
depRate)
.toString(), .toString(),
costAddItems: costAddItems:
calculateAdditionalItems(item) calculateAdditionalItems(item)
@ -1091,9 +1192,13 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
depRate) depRate)
.toString(), .toString(),
totalArea: totalArea.toString()); totalArea: totalArea.toString());
context.read<PropertyAppraisalEditBloc>() context
..add(UpdatePropertyAppraisalEdit( .read<
appraisalEdit: appraisals, PropertyAppraisalEditBloc>()
.add(
UpdatePropertyAppraisalEdit(
appraisalEdit:
appraisals,
id: widget.tempId)); id: widget.tempId));
widget.NextBtn(); widget.NextBtn();
@ -1107,10 +1212,13 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
), ),
), ),
), ),
),
],
); );
} }
return Container(); return Container();
}); },
);
} }
return Container(); return Container();
}); });
@ -1130,6 +1238,7 @@ class _PropertyAppraisalEditPage extends State<PropertyAppraisalEditPage> {
} }
return Container(); return Container();
}, },
),
); );
} }
} }

View File

@ -1,6 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:form_builder_validators/form_builder_validators.dart'; import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:searchfield/searchfield.dart'; import 'package:searchfield/searchfield.dart';
@ -457,13 +459,40 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BlocBuilder<PropertyAssessmentEditBloc, PropertyAssessmentEditState>( return ProgressHUD(
padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child:
BlocConsumer<PropertyAssessmentEditBloc, PropertyAssessmentEditState>(
listener: (context, state) {
if (state is PropertyAssessmentEditLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is PropertyAssessmentEditLoaded) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
if (state is PropertyAssessmentEditErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
},
builder: (context, state) { builder: (context, state) {
if (state is PropertyAssessmentEditLoaded) { if (state is PropertyAssessmentEditLoaded) {
final assessment = state.assessmentsEdit; final assessment = state.assessmentsEdit;
return BlocConsumer<SignatoriesBloc, SignatoriesState>( return BlocConsumer<SignatoriesBloc, SignatoriesState>(
listener: (context, state) { listener: (context, state) {
// TODO: implement listener if (state is SignatoriesLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is SignatoriesErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
}, },
builder: (context, state) { builder: (context, state) {
if (state is SignatoriesLoaded) { if (state is SignatoriesLoaded) {
@ -471,26 +500,39 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
return BlocConsumer<MemorandaBloc, MemorandaState>( return BlocConsumer<MemorandaBloc, MemorandaState>(
listener: (context, state) { listener: (context, state) {
// TODO: implement listener if (state is MemorandaLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is MemorandaLoaded) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
if (state is MemorandaErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
}, },
builder: (context, state) { builder: (context, state) {
if (state is MemorandaLoaded) { if (state is MemorandaLoaded) {
return FormBuilder( return FormBuilder(
key: keys, key: keys,
initialValue: { initialValue: {
'qtr': assessment.qtr.toString(), 'qtr': assessment.qtr?.toString() ?? '',
'yr': assessment.qtr.toString(), 'yr': assessment.qtr?.toString() ?? '',
// 'appraised_by': assessment.appraisedbyName, 'app_date':
'app_date': assessment.appraisedbyDate.toString(), assessment.appraisedbyDate?.toString() ?? '',
// 'rec_approval': assessment.recommendapprName, 'rec_date':
'rec_date': assessment.recommendapprDate.toString(), assessment.recommendapprDate?.toString() ?? '',
// 'apprvd_by': assessment.approvedbyName, 'memoranda': assessment.memoranda ?? '',
'memoranda': assessment.memoranda, 'sworn_statement':
'sworn_statement': assessment.swornstatementNo, assessment.swornstatementNo ?? '',
'date_received': assessment.dateReceived.toString(), 'date_received':
assessment.dateReceived?.toString() ?? '',
'date_of_entry': 'date_of_entry':
assessment.entryDateAssessment.toString(), assessment.entryDateAssessment?.toString() ??
'by': assessment.entryDateBy '',
'by': assessment.entryDateBy ?? '',
}, },
enabled: true, enabled: true,
onChanged: () { onChanged: () {
@ -503,7 +545,8 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
child: Column( child: Column(
children: [ children: [
Container( Container(
margin: const EdgeInsets.fromLTRB(0, 20, 0, 20), margin:
const EdgeInsets.fromLTRB(0, 20, 0, 20),
child: const Text( child: const Text(
'PROPERTY ASSESSMENT cont..', 'PROPERTY ASSESSMENT cont..',
style: TextStyle( style: TextStyle(
@ -561,14 +604,16 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
const Text( const Text(
'EFFECTIVITY OF ASSESSMENT / REASSESSMENT :', 'EFFECTIVITY OF ASSESSMENT / REASSESSMENT :',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold), fontWeight:
FontWeight.bold),
), ),
const SizedBox( const SizedBox(
height: 20, height: 20,
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.spaceAround, MainAxisAlignment
.spaceAround,
children: [ children: [
const Text('Qtr.'), const Text('Qtr.'),
SizedBox( SizedBox(
@ -625,7 +670,8 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
decoration: decoration:
InputDecoration( InputDecoration(
labelText: assessment labelText: assessment
.appraisedbyName!, .appraisedbyName ??
"",
labelStyle: labelStyle:
const TextStyle( const TextStyle(
color: Colors color: Colors
@ -664,7 +710,8 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
initialTime: initialTime:
const TimeOfDay( const TimeOfDay(
hour: 8, minute: 0), hour: 8,
minute: 0),
// locale: const Locale.fromSubtags(languageCode: 'fr'), // locale: const Locale.fromSubtags(languageCode: 'fr'),
), ),
), ),
@ -681,7 +728,8 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
child: Text( child: Text(
'RECOMMENDING APPROVAL:', 'RECOMMENDING APPROVAL:',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold), fontWeight:
FontWeight.bold),
)), )),
Row( Row(
mainAxisAlignment: mainAxisAlignment:
@ -697,7 +745,8 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
decoration: decoration:
InputDecoration( InputDecoration(
labelText: assessment labelText: assessment
.recommendapprName!, .recommendapprName ??
"",
labelStyle: labelStyle:
const TextStyle( const TextStyle(
color: Colors color: Colors
@ -736,7 +785,8 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
initialTime: initialTime:
const TimeOfDay( const TimeOfDay(
hour: 8, minute: 0), hour: 8,
minute: 0),
// locale: const Locale.fromSubtags(languageCode: 'fr'), // locale: const Locale.fromSubtags(languageCode: 'fr'),
), ),
), ),
@ -771,7 +821,8 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
decoration: decoration:
InputDecoration( InputDecoration(
labelText: assessment labelText: assessment
.approvedbyName!, .approvedbyName ??
"",
labelStyle: labelStyle:
const TextStyle( const TextStyle(
color: Colors color: Colors
@ -813,7 +864,8 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
itemHeight: 70, itemHeight: 70,
suggestions: state.memorada suggestions: state.memorada
.map((Memoranda memoranda) => .map(
(Memoranda memoranda) =>
SearchFieldListItem( SearchFieldListItem(
'${memoranda.memoranda}', '${memoranda.memoranda}',
item: item:
@ -864,7 +916,8 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
child: FormBuilderTextField( child: FormBuilderTextField(
name: 'sworn_statement', name: 'sworn_statement',
decoration: InputDecoration(), decoration: InputDecoration(),
validator: FormBuilderValidators validator:
FormBuilderValidators
.compose([]), .compose([]),
), ),
), ),
@ -881,7 +934,8 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
SizedBox( SizedBox(
width: 150, width: 150,
height: 20, height: 20,
child: FormBuilderDateTimePicker( child:
FormBuilderDateTimePicker(
name: 'date_received', name: 'date_received',
initialEntryMode: initialEntryMode:
DatePickerEntryMode DatePickerEntryMode
@ -908,7 +962,8 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
SizedBox( SizedBox(
width: 100, width: 100,
height: 20, height: 20,
child: FormBuilderDateTimePicker( child:
FormBuilderDateTimePicker(
name: 'date_of_entry', name: 'date_of_entry',
initialEntryMode: initialEntryMode:
DatePickerEntryMode DatePickerEntryMode
@ -937,7 +992,8 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
child: FormBuilderTextField( child: FormBuilderTextField(
name: 'by', name: 'by',
decoration: InputDecoration(), decoration: InputDecoration(),
validator: FormBuilderValidators validator:
FormBuilderValidators
.compose([]), .compose([]),
), ),
), ),
@ -947,8 +1003,9 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
height: 30, height: 30,
), ),
SizedBox( SizedBox(
width: width: MediaQuery.of(context)
MediaQuery.of(context).size.width, .size
.width,
child: ElevatedButton( child: ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: primary, backgroundColor: primary,
@ -968,14 +1025,16 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
), ),
), ),
onPressed: () { onPressed: () {
final List<PropertyAssessmentEdit> final List<
PropertyAssessmentEdit>
propertyAssessments = []; propertyAssessments = [];
PropertyAssessmentEdit ass = PropertyAssessmentEdit ass =
PropertyAssessmentEdit( PropertyAssessmentEdit(
id: 1, id: 1,
bldgapprDetailsId: 440, bldgapprDetailsId: 440,
actualUse: assessment.actualUse, actualUse:
assessment.actualUse,
marketValue: '0.0', marketValue: '0.0',
assessmentLevel: '0.0', assessmentLevel: '0.0',
assessedValue: "1.0", assessedValue: "1.0",
@ -985,7 +1044,8 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
.currentState! .currentState!
.value['qtr']), .value['qtr']),
yr: int.parse(keys yr: int.parse(keys
.currentState!.value['yr']), .currentState!
.value['yr']),
appraisedbyName: keys appraisedbyName: keys
.currentState! .currentState!
.value['appraised_by'] .value['appraised_by']
@ -1038,21 +1098,23 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
swornstatementNo: keys swornstatementNo: keys
.currentState! .currentState!
.value['sworn_statement'], .value['sworn_statement'],
dateReceived: keys.currentState! dateReceived: keys
.currentState!
.value['date_received'], .value['date_received'],
entryDateAssessment: keys entryDateAssessment: keys
.currentState! .currentState!
.value['date_of_entry'], .value['date_of_entry'],
entryDateBy: keys entryDateBy: keys
.currentState!.value['by'], .currentState!
.value['by'],
); );
propertyAssessments.add(ass); propertyAssessments.add(ass);
context.read< context
.read<
PropertyAssessmentEditBloc>() PropertyAssessmentEditBloc>()
..add( .add(UpdatePropertyAssessmentEdit(
UpdatePropertyAssessmentEdit(
assessmentsEdit: assessmentsEdit:
propertyAssessments[ propertyAssessments[
0])); 0]));
@ -1077,7 +1139,7 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
} }
if (state is PropertyAssessmentEditErrorState) { if (state is PropertyAssessmentEditErrorState) {
return SomethingWentWrong( return SomethingWentWrong(
message: onError, message: state.error,
onpressed: () { onpressed: () {
context.read<PropertyAssessmentEditBloc>().add( context.read<PropertyAssessmentEditBloc>().add(
LoadPropertyAssessmentEdit( LoadPropertyAssessmentEdit(
@ -1088,6 +1150,7 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
} }
return Container(); return Container();
}, },
),
); );
} }
} }

View File

@ -62,11 +62,27 @@ class _PropertyOwnerInfoEdit extends State<PropertyOwnerInfoEdit> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BlocConsumer<PropertyInfoBloc, PropertyInfoState>( return BlocConsumer<PropertyInfoBloc, PropertyInfoState>(
listener: (context, state) { listener: (context, state) {
// TODO: implement listener if (state is PropertyInfoLoaded) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
if (state is PropertyInfoLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is PropertyInfoErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
}, builder: (context, state) { }, builder: (context, state) {
if (state is PropertyInfoLoaded) { if (state is PropertyInfoLoaded) {
return SingleChildScrollView( return SingleChildScrollView(
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(15.0),
child: Expanded( child: Expanded(
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
@ -100,14 +116,16 @@ class _PropertyOwnerInfoEdit extends State<PropertyOwnerInfoEdit> {
left: 0, top: 20, right: 0, bottom: 10), left: 0, top: 20, right: 0, bottom: 10),
child: const Text('PROPERTY OWNER INFO', child: const Text('PROPERTY OWNER INFO',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 18), fontWeight: FontWeight.bold,
fontSize: 18),
textAlign: TextAlign.left), textAlign: TextAlign.left),
), ),
const SizedBox(height: 15), const SizedBox(height: 15),
customDropDownField("Transaction Code", "", customDropDownField("Transaction Code", "",
"transaction_code", transaction_codes), "transaction_code", transaction_codes),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
// optional flex property if flex is 1 because the default flex is 1 // optional flex property if flex is 1 because the default flex is 1
@ -118,27 +136,31 @@ class _PropertyOwnerInfoEdit extends State<PropertyOwnerInfoEdit> {
Expanded( Expanded(
// optional flex property if flex is 1 because the default flex is 1 // optional flex property if flex is 1 because the default flex is 1
flex: 1, flex: 1,
child: customTextField("Pin", "", 'pin')), child:
customTextField("Pin", "", 'pin')),
], ],
), ),
customTextField("Owner", "", 'owner'), customTextField("Owner", "", 'owner'),
customTextField("Address", "", 'address'), customTextField("Address", "", 'address'),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 1, flex: 1,
child: child: customTextField(
customTextField("Tel No.", "", 'tel_no'), "Tel No.", "", 'tel_no'),
), ),
const SizedBox(width: 10.0), const SizedBox(width: 10.0),
Expanded( Expanded(
// optional flex property if flex is 1 because the default flex is 1 // optional flex property if flex is 1 because the default flex is 1
flex: 1, flex: 1,
child: customTextField("TIN", "", 'tin')) child:
customTextField("TIN", "", 'tin'))
]), ]),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 1, flex: 1,
@ -155,19 +177,20 @@ class _PropertyOwnerInfoEdit extends State<PropertyOwnerInfoEdit> {
"TIN", "", 'benificiary_tin')) "TIN", "", 'benificiary_tin'))
]), ]),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 1, flex: 1,
child: customTextField( child: customTextField("Address", "",
"Address", "", 'benificiary_address'), 'benificiary_address'),
), ),
const SizedBox(width: 10.0), const SizedBox(width: 10.0),
Expanded( Expanded(
// optional flex property if flex is 1 because the default flex is 1 // optional flex property if flex is 1 because the default flex is 1
flex: 1, flex: 1,
child: customTextField( child: customTextField("Tel No.", "",
"Tel No.", "", 'benificiary_telno')) 'benificiary_telno'))
]), ]),
const SizedBox(height: 25), const SizedBox(height: 25),
SizedBox( SizedBox(
@ -178,22 +201,25 @@ class _PropertyOwnerInfoEdit extends State<PropertyOwnerInfoEdit> {
onPressed: () { onPressed: () {
var property_info = PropertyInfo( var property_info = PropertyInfo(
id: widget.faas.id, id: widget.faas.id,
transCode: keys transCode: keys.currentState!
.currentState!.value['transaction_code'] .value['transaction_code']
.toString(), .toString(),
tdn: keys.currentState!.value['arp_td'], tdn: keys
.currentState!.value['arp_td'],
pin: keys.currentState!.value['pin'], pin: keys.currentState!.value['pin'],
owner: keys.currentState!.value['owner'], owner:
address: keys.currentState!.value['owner'],
keys.currentState!.value['address'], address: keys
telno: keys.currentState!.value['tel_no'], .currentState!.value['address'],
telno: keys
.currentState!.value['tel_no'],
tin: keys.currentState!.value['tin'], tin: keys.currentState!.value['tin'],
adminUser: adminUser: keys.currentState!
keys.currentState!.value['benificiary'], .value['benificiary'],
adminAddress: keys.currentState! adminAddress: keys.currentState!
.value['benificiary_address'], .value['benificiary_address'],
adminTin: keys adminTin: keys.currentState!
.currentState!.value['benificiary_tin'], .value['benificiary_tin'],
adminTelno: keys.currentState! adminTelno: keys.currentState!
.value['benificiary_telno'], .value['benificiary_telno'],
assessedById: '1', assessedById: '1',
@ -213,6 +239,9 @@ class _PropertyOwnerInfoEdit extends State<PropertyOwnerInfoEdit> {
], ],
), ),
), ),
),
],
),
); );
} }
if (state is PropertyInfoErrorState) { if (state is PropertyInfoErrorState) {

View File

@ -56,19 +56,24 @@ class _StructuralMaterialsPageEdit extends State<StructuralMaterialsPageEdit> {
// TODO: implement listener // TODO: implement listener
}, builder: (context, state) { }, builder: (context, state) {
if (state is StructuralMaterialsLoaded) { if (state is StructuralMaterialsLoaded) {
return Expanded( return SingleChildScrollView(
child: SingleChildScrollView( scrollDirection: Axis.vertical,
padding: const EdgeInsets.all(30.0), child: Column(
children: [
Expanded(
child: Column( child: Column(
children: [ children: [
Container( Container(
margin: const EdgeInsets.only( margin: const EdgeInsets.only(
left: 0, top: 20, right: 0, bottom: 10), left: 0, top: 20, right: 0, bottom: 10),
child: const Text('STRUCTURAL MATERIALS', child: const Text('STRUCTURAL MATERIALS',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18), style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 18),
textAlign: TextAlign.left), textAlign: TextAlign.left),
), ),
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text( Text(
'FOUNDATION', 'FOUNDATION',
textAlign: TextAlign.start, textAlign: TextAlign.start,
@ -101,13 +106,18 @@ class _StructuralMaterialsPageEdit extends State<StructuralMaterialsPageEdit> {
foundation = x; foundation = x;
}); });
}, },
options: const ['Reinforced Concrete', 'Plain Concrete'], options: const [
'Reinforced Concrete',
'Plain Concrete'
],
selectedValues: foundation, selectedValues: foundation,
whenEmpty: 'Select Foundations', whenEmpty: 'Select Foundations',
), ),
), ),
), ),
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text( Text(
'COLUMNS', 'COLUMNS',
textAlign: TextAlign.start, textAlign: TextAlign.start,
@ -140,13 +150,19 @@ class _StructuralMaterialsPageEdit extends State<StructuralMaterialsPageEdit> {
column = x; column = x;
}); });
}, },
options: const ['Steel', 'Reinforced Concrete', 'Wood'], options: const [
'Steel',
'Reinforced Concrete',
'Wood'
],
selectedValues: column, selectedValues: column,
whenEmpty: 'Select Column/s', whenEmpty: 'Select Column/s',
), ),
), ),
), ),
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text( Text(
'BEAMS', 'BEAMS',
textAlign: TextAlign.start, textAlign: TextAlign.start,
@ -170,8 +186,8 @@ class _StructuralMaterialsPageEdit extends State<StructuralMaterialsPageEdit> {
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
child: Visibility( child: Visibility(
visible: beamsOthers, visible: beamsOthers,
child: child: customTextField(
customTextField("Enter other beam/s", "", "other_beam"), "Enter other beam/s", "", "other_beam"),
replacement: DropDownMultiSelect( replacement: DropDownMultiSelect(
selected_values_style: TextStyle(color: Colors.black), selected_values_style: TextStyle(color: Colors.black),
onChanged: (List<String> x) { onChanged: (List<String> x) {
@ -179,13 +195,19 @@ class _StructuralMaterialsPageEdit extends State<StructuralMaterialsPageEdit> {
beam = x; beam = x;
}); });
}, },
options: const ['Steel', 'Reinforced Concrete', 'Wood'], options: const [
'Steel',
'Reinforced Concrete',
'Wood'
],
selectedValues: beam, selectedValues: beam,
whenEmpty: 'Select Beam/s', whenEmpty: 'Select Beam/s',
), ),
), ),
), ),
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text( Text(
'TRUSS FRAMING', 'TRUSS FRAMING',
textAlign: TextAlign.start, textAlign: TextAlign.start,
@ -224,7 +246,9 @@ class _StructuralMaterialsPageEdit extends State<StructuralMaterialsPageEdit> {
), ),
), ),
), ),
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text( Text(
'ROOF', 'ROOF',
textAlign: TextAlign.start, textAlign: TextAlign.start,
@ -248,8 +272,8 @@ class _StructuralMaterialsPageEdit extends State<StructuralMaterialsPageEdit> {
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
child: Visibility( child: Visibility(
visible: roofOthers, visible: roofOthers,
child: child: customTextField(
customTextField("Enter other roof/s", "", "other_roof"), "Enter other roof/s", "", "other_roof"),
replacement: DropDownMultiSelect( replacement: DropDownMultiSelect(
selected_values_style: TextStyle(color: Colors.black), selected_values_style: TextStyle(color: Colors.black),
onChanged: (List<String> x) { onChanged: (List<String> x) {
@ -272,7 +296,9 @@ class _StructuralMaterialsPageEdit extends State<StructuralMaterialsPageEdit> {
), ),
), ),
), ),
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text( Text(
'FLOORING', 'FLOORING',
textAlign: TextAlign.start, textAlign: TextAlign.start,
@ -317,7 +343,9 @@ class _StructuralMaterialsPageEdit extends State<StructuralMaterialsPageEdit> {
), ),
), ),
), ),
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text( Text(
'WALLS & PARTITIONS', 'WALLS & PARTITIONS',
textAlign: TextAlign.start, textAlign: TextAlign.start,
@ -394,7 +422,8 @@ class _StructuralMaterialsPageEdit extends State<StructuralMaterialsPageEdit> {
walls: walls, walls: walls,
others: ["Others"]); others: ["Others"]);
context.read<PropertyInfoBloc>() context.read<PropertyInfoBloc>()
..add(UpdateStrucMaterials(data: strucMaterials)); ..add(
UpdateStrucMaterials(data: strucMaterials));
widget.NextBtn(); widget.NextBtn();
} }
@ -405,7 +434,10 @@ class _StructuralMaterialsPageEdit extends State<StructuralMaterialsPageEdit> {
) )
], ],
), ),
)); ),
],
),
);
} }
if (state is StructuralMaterialsErrorState) { if (state is StructuralMaterialsErrorState) {
return Text(state.error); return Text(state.error);

View File

@ -0,0 +1,481 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:multiselect/multiselect.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart';
import 'package:unit2/bloc/passo/bulding/structural_material/structural_material_bloc.dart';
import 'package:unit2/model/passo/structural_materials_ii.dart';
import 'package:unit2/screens/passo/Building/add_building.dart';
import 'package:unit2/widgets/passo/custom_button.dart';
import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart';
class MaterialOption {
final String id;
final String label;
MaterialOption(this.id, this.label);
}
class StructuralMaterialsEditPage extends StatefulWidget {
final int tempId;
final VoidCallback NextBtn;
final VoidCallback PrevBtn;
StructuralMaterialsEditPage(this.tempId, this.NextBtn, this.PrevBtn);
@override
_StructuralMaterialsEditPage createState() => _StructuralMaterialsEditPage();
}
class _StructuralMaterialsEditPage extends State<StructuralMaterialsEditPage> {
List<String> foundation = [];
List<String> column = [];
List<String> beam = [];
List<String> truss_framing = [];
List<String> roof = [];
List<String> flooring = [];
List<String> walls = [];
bool foundationOthers = false;
bool columOthers = false;
bool beamsOthers = false;
bool tfOthers = false;
bool roofOthers = false;
bool flooringOthers = false;
bool wpOthers = false;
List<MaterialOption> columnOptions = [
MaterialOption('steel', 'Steel'),
MaterialOption('concrete', 'Reinforced Concrete'),
MaterialOption('wood', 'Wood'),
];
List<String> selectedColumnValues = [];
@override
Widget build(BuildContext context) {
return Scaffold(
body: ProgressHUD(
padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocConsumer<StructuralMaterialBloc, StructuralMaterialState>(
listener: (context, state) {
if (state is StructuralMaterialsLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is StructuralMaterialsLoaded) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
setState(() {
foundation = state.structure.foundation!.split(',');
column = state.structure.columns!.split(',');
beam = state.structure.beams!.split(',');
truss_framing = state.structure.trussFraming!.split(',');
roof = state.structure.roof!.split(',');
flooring = state.structure.flooring!.split(',');
walls = state.structure.walls!.split(',');
// Update other local state variables here if needed
});
}
if (state is StructuralMaterialsErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
}, builder: (context, state) {
return SingleChildScrollView(
padding: const EdgeInsets.all(30.0),
child: Column(
children: [
Container(
margin: const EdgeInsets.only(
left: 0, top: 20, right: 0, bottom: 10),
child: const Text('STRUCTURAL MATERIALS',
style:
TextStyle(fontWeight: FontWeight.bold, fontSize: 18),
textAlign: TextAlign.left),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'FOUNDATION',
textAlign: TextAlign.start,
),
Row(
children: [
const Text('Others'),
Checkbox(
checkColor: Colors.white,
value: foundationOthers,
onChanged: (bool? value) {
setState(() {
foundationOthers = value!;
});
},
)
],
),
]),
Padding(
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
child: Visibility(
visible: foundationOthers,
child: customTextField(
"Enter other foundation", "", "other_foundation"),
replacement: DropDownMultiSelect(
selected_values_style: TextStyle(color: Colors.black),
onChanged: (List<String> x) {
setState(() {
foundation = x;
});
},
options: const ['Reinforced Concrete', 'Plain Concrete'],
selectedValues: foundation,
whenEmpty: 'Select Foundations',
),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'COLUMNS',
textAlign: TextAlign.start,
),
Row(
children: [
const Text('Others'),
Checkbox(
checkColor: Colors.white,
value: columOthers,
onChanged: (bool? value) {
setState(() {
columOthers = value!;
});
},
)
],
),
]),
Padding(
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
child: Visibility(
visible: columOthers,
child: customTextField(
"Enter other columns", "", "other_column"),
replacement: DropDownMultiSelect(
selected_values_style: TextStyle(color: Colors.black),
onChanged: (List<String> x) {
setState(() {
column = x;
});
},
options: const ['Steel', 'Reinforced Concrete', 'Wood'],
selectedValues: column,
whenEmpty: 'Select Column/s',
),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'BEAMS',
textAlign: TextAlign.start,
),
Row(
children: [
const Text('Others'),
Checkbox(
checkColor: Colors.white,
value: beamsOthers,
onChanged: (bool? value) {
setState(() {
beamsOthers = value!;
});
},
)
],
),
]),
Padding(
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
child: Visibility(
visible: beamsOthers,
child:
customTextField("Enter other beam/s", "", "other_beam"),
replacement: DropDownMultiSelect(
selected_values_style: TextStyle(color: Colors.black),
onChanged: (List<String> x) {
setState(() {
beam = x;
});
},
options: const ['Steel', 'Reinforced Concrete', 'Wood'],
selectedValues: beam,
whenEmpty: 'Select Beam/s',
),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'TRUSS FRAMING',
textAlign: TextAlign.start,
),
Row(
children: [
const Text('Others'),
Checkbox(
checkColor: Colors.white,
value: tfOthers,
onChanged: (bool? value) {
setState(() {
tfOthers = value!;
});
},
)
],
),
]),
Padding(
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
child: Visibility(
visible: tfOthers,
child: customTextField(
"Enter other truss framing/s", "", "other_tf"),
replacement: DropDownMultiSelect(
selected_values_style: TextStyle(color: Colors.black),
onChanged: (List<String> x) {
setState(() {
truss_framing = x;
});
},
options: const ['Steel', 'Wood'],
selectedValues: truss_framing,
whenEmpty: 'Select Truss Framing/s',
),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'ROOF',
textAlign: TextAlign.start,
),
Row(
children: [
const Text('Others'),
Checkbox(
checkColor: Colors.white,
value: roofOthers,
onChanged: (bool? value) {
setState(() {
roofOthers = value!;
});
},
)
],
),
]),
Padding(
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
child: Visibility(
visible: roofOthers,
child:
customTextField("Enter other roof/s", "", "other_roof"),
replacement: DropDownMultiSelect(
selected_values_style: TextStyle(color: Colors.black),
onChanged: (List<String> x) {
setState(() {
roof = x;
});
},
options: const [
'Reinforced Concrete',
'Tiles',
'G.I Sheet',
'Aluminum',
'Asbestos',
'Long Span',
'Concrete Desk',
'Nipa/Anahaw/Cogon'
],
selectedValues: roof,
whenEmpty: 'Select Roof/s',
),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'FLOORING',
textAlign: TextAlign.start,
),
Row(
children: [
const Text('Others'),
Checkbox(
checkColor: Colors.white,
value: flooringOthers,
onChanged: (bool? value) {
setState(() {
flooringOthers = value!;
});
},
)
],
),
]),
Padding(
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
child: Visibility(
visible: flooringOthers,
child: customTextField(
"Enter other flooring/s", "", "other_flooring"),
replacement: DropDownMultiSelect(
selected_values_style: TextStyle(color: Colors.black),
onChanged: (List<String> x) {
setState(() {
flooring = x;
});
},
options: const [
'Reinforced Concrete',
'Plain Cement',
'Marble',
'Wood',
'Tiles'
],
selectedValues: flooring,
whenEmpty: 'Select Flooring/s',
),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'WALLS & PARTITIONS',
textAlign: TextAlign.start,
),
Row(
children: [
const Text('Others'),
Checkbox(
checkColor: Colors.white,
value: wpOthers,
onChanged: (bool? value) {
setState(() {
wpOthers = value!;
});
},
)
],
),
]),
Padding(
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
child: Visibility(
visible: wpOthers,
child: customTextField(
"Enter other walls & partition/s", "", "other_wp"),
replacement: DropDownMultiSelect(
selected_values_style: TextStyle(color: Colors.black),
onChanged: (List<String> x) {
setState(() {
walls = x;
});
},
options: const [
'Reinforced Concrete',
'Plain Concrete',
'Wood',
'CHIB',
'G.I Sheet',
'Build-a-wall',
'Sawali',
'Bamboo'
],
selectedValues: walls,
whenEmpty: 'Select Walls & Partition/s',
),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
CustomButton(
icon: const Icon(Icons.chevron_left_rounded,
color: Colors.white),
onPressed: () {
{
widget.NextBtn();
}
;
},
),
CustomButton(
icon: const Icon(Icons.chevron_right_rounded,
color: Colors.white),
onPressed: () async {
{
final tempID = await SharedPreferences.getInstance();
var strucMaterials = StructureMaterialsII(
id: tempID.getInt('tempid')! - 1,
foundation: foundationOthers
? formKey
.currentState!.value['other_foundation']
.split(',')
: foundation,
columns: columOthers
? formKey.currentState!.value['other_column']
.split(',')
: column,
beams: beamsOthers
? formKey.currentState!.value['other_beam']
.split(',')
: beam,
trussFraming: tfOthers
? formKey.currentState!.value['other_tf']
.split(',')
: truss_framing,
roof: roofOthers
? formKey.currentState!.value['other_roof']
.split(',')
: roof,
flooring: flooringOthers
? formKey
.currentState!.value['other_flooring']
.split(',')
: flooring,
walls: wpOthers
? formKey.currentState!.value['other_wp']
.split(',')
: walls,
others: ["Others"]);
context.read<PropertyInfoBloc>()
..add(UpdateStrucMaterials(data: strucMaterials));
widget.PrevBtn();
}
;
},
)
],
)
],
),
);
}),
),
);
}
}

View File

@ -107,7 +107,6 @@ class _AddLandAppraisalModal extends State<AddLandAppraisalModal> {
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Container( child: Container(
height: 800,
child: SingleChildScrollView( child: SingleChildScrollView(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Column( child: Column(
@ -387,7 +386,7 @@ class _AddLandAppraisalModal extends State<AddLandAppraisalModal> {
), ),
), ),
], ],
) ),
], ],
), ),
), ),

View File

@ -5,6 +5,8 @@ import 'package:unit2/bloc/passo/land/land_appraisal/land_appraisal_bloc.dart';
import 'package:unit2/model/passo/land_appr.dart'; import 'package:unit2/model/passo/land_appr.dart';
import 'package:unit2/screens/passo/Land/add_land/AddLandAppraisal.dart'; import 'package:unit2/screens/passo/Land/add_land/AddLandAppraisal.dart';
import 'package:unit2/utils/alerts.dart'; import 'package:unit2/utils/alerts.dart';
import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/error_state.dart';
import 'package:unit2/widgets/passo/custom_button.dart'; import 'package:unit2/widgets/passo/custom_button.dart';
class LandAppraisal extends StatefulWidget { class LandAppraisal extends StatefulWidget {
@ -237,11 +239,21 @@ class _LandAppraisal extends State<LandAppraisal> {
content: Column( content: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [Expanded(child: AddLandAppraisalModal())], children: [
Expanded(child: AddLandAppraisalModal()),
],
), ),
), ),
); );
} }
if (state is LandAppraisalErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context.read<LandAppraisalBloc>().add(LoadLandAppraisal());
},
);
}
return Container(); return Container();
}); });
} }

View File

@ -1,5 +1,6 @@
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:shared_preferences/shared_preferences.dart';
import 'package:unit2/bloc/passo/land/land_property_owner_info/land_property_owner_info_bloc.dart'; import 'package:unit2/bloc/passo/land/land_property_owner_info/land_property_owner_info_bloc.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';
@ -107,16 +108,18 @@ class _LandLocationAndBoundaries extends State<LandLocationAndBoundaries> {
CustomButton( CustomButton(
icon: icon:
const Icon(Icons.chevron_right, color: Colors.white), const Icon(Icons.chevron_right, color: Colors.white),
onPressed: () { onPressed: () async {
final tempID = await SharedPreferences.getInstance();
print(tempID.getInt('landid'));
var boundaries = LandPropertyBoundaries( var boundaries = LandPropertyBoundaries(
id: 3, id: tempID.getInt('landid')! - 1,
north: landKey.currentState?.value['north'], north: landKey.currentState?.value['north'],
east: landKey.currentState?.value['east'], east: landKey.currentState?.value['east'],
west: landKey.currentState?.value['west'], west: landKey.currentState?.value['west'],
south: landKey.currentState?.value['south'], south: landKey.currentState?.value['south'],
); );
var location = LandPropertyLoc( var location = LandPropertyLoc(
id: 3, id: tempID.getInt('landid')! - 1,
street: landKey.currentState?.value['street'], street: landKey.currentState?.value['street'],
barangay: landKey.currentState?.value['brgy'], barangay: landKey.currentState?.value['brgy'],
municipality: municipality:

View File

@ -76,7 +76,6 @@ class _LandPropertyOwnerInfo extends State<LandPropertyOwnerInfo> {
flex: 1, flex: 1,
child: customTextField("Blk", "", "blk")), child: customTextField("Blk", "", "blk")),
]), ]),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[ children: <Widget>[
@ -117,45 +116,6 @@ class _LandPropertyOwnerInfo extends State<LandPropertyOwnerInfo> {
flex: 1, flex: 1,
child: customTextField("Tel No.", "", "admin_telno")) child: customTextField("Tel No.", "", "admin_telno"))
]), ]),
// SizedBox(
// width: double.infinity,
// height: 50,
// child: ElevatedButton(
// style: secondaryBtnStyle(const Color(0xffd92828),
// Color.fromARGB(0, 253, 252, 252), Colors.white54),
// child: const Text(
// "SUBMIT & PROCEED",
// style: TextStyle(
// color: Color.fromARGB(239, 255, 255, 255),
// fontWeight: FontWeight.w700),
// ),
// onPressed: () {
// // formKey.currentState?.save();
// // // var faas = PropertyInfo(
// // // id: 1,
// // // transCode: formKey
// // // .currentState!.value['transaction_code']
// // // .toString(),
// // // tdn: formKey.currentState!.value['arp_td'],
// // // pin: formKey.currentState!.value['pin'],
// // // owner: formKey.currentState!.value['owner'],
// // // address: formKey.currentState!.value['address'],
// // // telno: formKey.currentState!.value['tel_no'],
// // // tin: formKey.currentState!.value['tin'],
// // // adminUser: formKey.currentState!.value['benificiary'],
// // // adminAddress: formKey
// // // .currentState!.value['benificiary_address'],
// // // adminTin:
// // // formKey.currentState!.value['benificiary_tin'],
// // // adminTelno:
// // // formKey.currentState!.value['benificiary_telno']);
// // // context.read<AssessorsBloc>().add(AddFaas(faas: faas));
// // // _loadTempId();
// // _pageController.nextPage(
// // duration: _kDuration, curve: _kCurve);
// }),
// ),
SizedBox( SizedBox(
height: 30, height: 30,
), ),

View File

@ -0,0 +1,117 @@
import 'package:flutter/material.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:im_stepper/stepper.dart';
import 'package:unit2/model/passo/land_property_owner.dart';
import 'package:unit2/screens/passo/Land/edit_land/land_appraisal.dart';
import 'package:unit2/screens/passo/Land/edit_land/location_and_boundaries_edit.dart';
import 'package:unit2/screens/passo/Land/edit_land/other_improvements_edit.dart';
import 'package:unit2/screens/passo/Land/edit_land/property_assessment_cont_edit.dart';
import 'package:unit2/screens/passo/Land/edit_land/property_assessment_edit.dart';
import 'package:unit2/screens/passo/Land/edit_land/property_owner_info_edit.dart';
import 'package:unit2/screens/passo/Land/edit_land/value_adjustments_edit.dart';
import 'package:unit2/theme-data.dart/colors.dart';
GlobalKey<FormBuilderState> landKey = GlobalKey<FormBuilderState>();
class EditLand extends StatefulWidget {
final int index;
final LandPropertyOwner faas;
final String title;
const EditLand(
{super.key,
required this.title,
required this.index,
required this.faas});
@override
_EditLand createState() => _EditLand();
}
class _EditLand extends State<EditLand> {
// THE FOLLOWING TWO VARIABLES ARE REQUIRED TO CONTROL THE STEPPER.
int activeStep = 0; // Initial step set to 5.
int upperBound = 6; // upperBound MUST BE total number of icons minus 1.
void PrevBtn() {
setState(() {
activeStep--;
});
}
void NextBtn() {
setState(() {
activeStep++;
});
}
void onSAveAll() {
return Navigator.of(context).pop();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
backgroundColor: primary,
title: Text('Land FAAS'),
),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
NumberStepper(
numbers: [1, 2, 3, 4, 5, 6, 7],
activeStepColor: primary,
numberStyle: TextStyle(color: Colors.white),
lineColor: primary,
// activeStep property set to activeStep variable defined above.
activeStep: activeStep,
activeStepBorderColor: Colors.white,
activeStepBorderWidth: 1,
// This ensures step-tapping updates the activeStep.
onStepReached: (index) {
setState(() {
activeStep = index;
});
},
),
Expanded(
child: Container(
child: content(PrevBtn, NextBtn, onSAveAll),
),
),
],
),
),
);
}
/// Returns the next button.
// Returns the content widget based on the activeStep.
Widget content(PrevBtn, NextBtn, onSAveAll) {
switch (activeStep) {
case 0:
return LandPropertyOwnerInfoEdit(NextBtn, widget.faas!);
case 1:
return LandLocationAndBoundariesEdit(PrevBtn, NextBtn, widget.faas!);
case 2:
return LandAppraisalEdit(PrevBtn, NextBtn, widget.faas.id!);
case 3:
return OtherImprovementEditPage(PrevBtn, NextBtn, widget.faas.id!);
case 4:
return ValueAdjustmentEditPage(PrevBtn, NextBtn, widget.faas.id!);
case 5:
return LandPropertyAssessmentEditPage(
PrevBtn, NextBtn, widget.faas.id!);
case 6:
return LandSignatoriesEdit(onSAveAll, widget.faas.id!);
default:
return LandPropertyOwnerInfoEdit(NextBtn, widget.faas!);
}
}
}

View File

@ -0,0 +1,464 @@
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:form_builder_validators/form_builder_validators.dart';
import 'package:intl/intl.dart';
import 'package:searchfield/searchfield.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:unit2/bloc/passo/bulding/additional_item/additional_item_bloc.dart';
import 'package:unit2/bloc/passo/land/land_appraisal/land_appraisal_bloc.dart';
import 'package:unit2/bloc/passo/land/land_classification/land_classification_bloc.dart';
import 'package:unit2/bloc/passo/land/land_subclassification/land_subclassification_bloc.dart';
import 'package:unit2/bloc/passo/municipality/municipality_bloc.dart';
import 'package:unit2/model/passo/additional_items.dart';
import 'package:unit2/model/passo/city.dart';
import 'package:unit2/model/passo/class_components.dart';
import 'package:unit2/model/passo/land_appr.dart';
import 'package:unit2/model/passo/land_classification.dart';
import 'package:unit2/model/passo/land_subclassification.dart';
import 'package:unit2/model/passo/unit_construct.dart';
import 'package:unit2/screens/passo/Land/add_land.dart';
import 'package:unit2/theme-data.dart/form-style.dart';
import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/error_state.dart';
import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart';
class AddLandAppraisalEditModal extends StatefulWidget {
// final List<UnitConstruct> unit;
// final List<ClassComponents> options;
final int tempId;
AddLandAppraisalEditModal(this.tempId);
@override
_AddLandAppraisalEditModal createState() => _AddLandAppraisalEditModal();
}
class _AddLandAppraisalEditModal extends State<AddLandAppraisalEditModal> {
final focus = FocusNode();
bool isPainted = false;
bool isSecondHand = false;
TextEditingController textEditingController = TextEditingController();
double _unitBase = 0;
int _areaValue = 0;
final double _depValue = 0;
double _unitValue = 0;
String _subClassDesc = "";
int _classId = 0;
String _structureType = "";
bool _withoutBUCC = false;
int _notPaintedUnitVal = 0;
int _secondHandUnitVal = 0;
String cityCode = '';
String cityDesc = '';
int classCode = 1;
String _classDesc = '';
GlobalKey<FormBuilderState> appraisalLandKey = GlobalKey<FormBuilderState>();
BoxDecoration box1() {
return const BoxDecoration(boxShadow: [
BoxShadow(color: Colors.black12, spreadRadius: 5, blurRadius: 5)
], color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(3)));
}
double _amountofDepreciation(unitVal, unitBase, area, depreciation) {
return ((unitVal * unitBase) * area) * depreciation;
}
double _totalMarketValue(unitBase, area) {
return unitBase * area;
}
@override
Widget build(BuildContext context) {
return 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();
}
}, buildWhen: (previous, current) {
return false;
}, builder: (context, state) {
if (state is ShowAddLandAppraisalScreen) {
return BlocConsumer<LandClassificationBloc, LandClassificationState>(
listener: (context, state) {
// TODO: implement listener
},
builder: (context, state) {
if (state is LandClassificationLoaded) {
final classification = state.land_classification;
return BlocConsumer<LandSubClassificationBloc,
LandSubClassificationState>(
listener: (context, state) {
// TODO: implement listener
},
builder: (context, state) {
if (state is LandSubClassificationLoaded) {
final subclassification = state.land_subclassification;
return BlocConsumer<MunicipalityBloc, MunicipalityState>(
listener: (context, state) {
// TODO: implement listener
},
builder: (context, state) {
if (state is MunicipalityLoaded) {
return FormBuilder(
key: appraisalLandKey,
onChanged: () {
appraisalLandKey.currentState?.save();
},
autovalidateMode: AutovalidateMode.disabled,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: SingleChildScrollView(
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<City>(
name:
'appraisal_municipality',
autofocus: false,
decoration:
normalTextFieldStyle(
cityDesc ??
"Municipality",
""),
items: state.municipality
.map((municipality) =>
DropdownMenuItem<
City>(
value: municipality,
child: Text(municipality
.cityDescription!), // Use cityDescription instead of cityName
))
.toList(),
onChanged: (selectedCity) {
if (selectedCity != null) {
final selectedCityCode =
selectedCity.cityCode;
setState(() {
cityCode =
selectedCityCode!;
cityDesc = selectedCity
.cityDescription!;
});
final barangayBloc =
context.read<
LandSubClassificationBloc>();
barangayBloc.add(
LoadLandSubClassification(
classCode:
classCode!,
cityCode:
selectedCityCode!)); // Use selectedCityCode directly
}
},
)),
),
Container(
margin: const EdgeInsets.only(
left: 0,
top: 10,
right: 0,
bottom: 0),
child: Expanded(
flex: 1,
child: FormBuilderDropdown<
LandClassification>(
name: 'classification',
autofocus: false,
decoration:
normalTextFieldStyle(
_classDesc
.toString() ??
"Classification",
""),
items: classification
.map((classification) =>
DropdownMenuItem<
LandClassification>(
value:
classification,
child: Text(
classification
.description!), // Use cityDescription instead of cityName
))
.toList(),
onChanged: (selectedClass) {
if (selectedClass != null) {
final selectedClassCode =
selectedClass.id;
setState(() {
classCode =
selectedClassCode!;
_classDesc =
selectedClass
.description!;
});
final barangayBloc =
context.read<
LandSubClassificationBloc>();
barangayBloc.add(
LoadLandSubClassification(
classCode:
selectedClassCode!,
cityCode:
cityCode)); // Use selectedCityCode directly
}
},
)),
),
Container(
margin: const EdgeInsets.only(
left: 0,
top: 10,
right: 0,
bottom: 0),
child: SizedBox(
height: 45,
child: SearchField(
itemHeight: 70,
suggestions: subclassification
.map((LandSubClassification
subclass) =>
SearchFieldListItem(
'${subclass.subclassCode} - ${subclass.subclassDescription}',
item: subclass,
child: ListTile(
title: Text(
'${subclass.subclassCode} - ${subclass.subclassDescription!.toUpperCase()}',
overflow:
TextOverflow
.ellipsis,
),
)))
.toList(),
validator: FormBuilderValidators
.required(
errorText:
"This field is required"),
searchInputDecoration:
normalTextFieldStyle(
"Structure Type",
"")
.copyWith(
suffixIcon:
const Icon(Icons
.arrow_drop_down)),
////agency suggestion tap
focusNode: focus,
suggestionState:
Suggestion.expand,
onSuggestionTap: (subclass) {
setState(() {
_unitBase = double.parse(
subclass.item!
.baseUnitMarketval!);
_subClassDesc =
'${subclass.item!.subclassCode} - ${subclass.item!.subclassDescription}';
});
focus.unfocus();
},
),
),
),
const SizedBox(height: 10),
FormBuilderTextField(
name: 'land_appraisal_area',
decoration: normalTextFieldStyle(
"Area", ""),
validator:
FormBuilderValidators.compose(
[]),
onChanged: (value) {
setState(() {
_areaValue = int.parse(value!);
});
},
),
const SizedBox(height: 10),
const Text('Market Value'),
const SizedBox(height: 5),
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(
_totalMarketValue(
_unitBase,
_areaValue)))),
),
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 land_appraisal = LandAppr(
landapprDetailsId:
widget.tempId,
classification:
_classDesc,
subClass: _subClassDesc,
area: _areaValue
.toString(),
unitValue: _unitBase
.toString(),
baseMarketval:
_totalMarketValue(
_unitBase,
_areaValue)
.toString());
context
.read<
LandAppraisalBloc>()
.add(AddLandAppraisal(
land_appr:
land_appraisal));
},
style:
ElevatedButton.styleFrom(
primary: Colors.black,
),
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<
LandAppraisalBloc>()
.add(
LoadLandAppraisalEdit(
land_appr: <
LandAppr>[],
id: widget.tempId,
));
},
style:
ElevatedButton.styleFrom(
primary: Colors.black,
),
child: const Text("Cancel"),
),
),
],
),
],
),
),
)));
}
if (state is MunicipalityErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context
.read<MunicipalityBloc>()
.add(LoadMunicipality());
},
);
}
return Container();
},
);
}
if (state is LandSubClassificationErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context.read<LandSubClassificationBloc>().add(
const LoadLandSubClassification(
cityCode: '1', classCode: 1));
},
);
}
return Container();
},
);
}
if (state is LandClassificationErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context
.read<LandClassificationBloc>()
.add(LoadLandClassification());
},
);
}
return Container();
},
);
}
if (state is LandAppraisalErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context.read<LandAppraisalBloc>().add(LoadLandAppraisal());
},
);
}
return Container();
});
}
}

View File

@ -0,0 +1,357 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:intl/intl.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:unit2/bloc/passo/land/land_trees_improvements/land_trees_improvements_bloc.dart';
import 'package:unit2/bloc/passo/land/other_improvements/other_improvements_bloc.dart';
import 'package:unit2/model/passo/other_improvements.dart';
import 'package:unit2/model/passo/trees_improvements.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 AddOtherImprovementEditModal extends StatefulWidget {
// final List<UnitConstruct> unit;
// final List<ClassComponents> options;
final int tempId;
AddOtherImprovementEditModal(this.tempId);
@override
_AddOtherImprovementEditModal createState() =>
_AddOtherImprovementEditModal();
}
class _AddOtherImprovementEditModal
extends State<AddOtherImprovementEditModal> {
final focus = FocusNode();
bool isPainted = false;
bool isSecondHand = false;
TextEditingController textEditingController = TextEditingController();
double _unitBase = 0;
int _areaValue = 0;
final double _depValue = 0;
double _unitValue = 0;
String _subClassDesc = "";
int _classId = 0;
String _structureType = "";
int _notPaintedUnitVal = 0;
int _secondHandUnitVal = 0;
String cityCode = '';
String cityDesc = '';
int classCode = 1;
String _classDesc = '';
String _treeType = "";
bool _nonfruitBearing = false;
bool _fruitBearing = false;
int qty = 0;
int pr_qty = 0;
int nonpr_qty = 0;
GlobalKey<FormBuilderState> otherImpKey = GlobalKey<FormBuilderState>();
final typeOfTree = [
"Non-Fruit Bearing",
"Fruit Bearing",
];
_calculateBaseMarketValue() {
double base = 0.00;
if (_fruitBearing) {
base = (pr_qty + nonpr_qty) * _unitValue;
} else {
base = qty * _unitValue;
}
return base;
}
BoxDecoration box1() {
return const BoxDecoration(boxShadow: [
BoxShadow(color: Colors.black12, spreadRadius: 5, blurRadius: 5)
], color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(3)));
}
double _amountofDepreciation(unitVal, unitBase, area, depreciation) {
return ((unitVal * unitBase) * area) * depreciation;
}
double _totalMarketValue(unitBase, area) {
return unitBase * area;
}
@override
Widget build(BuildContext context) {
return BlocBuilder<OtherImprovementsBloc, OtherImprovementsState>(
buildWhen: (previous, current) {
return false;
}, builder: (context, state) {
if (state is ShowAddOtherImprovementScreen) {
return BlocConsumer<LandTreesImprovementsBloc,
LandTreesImprovementsState>(listener: (context, state) {
// TODO: implement listener
}, builder: (context, state) {
if (state is LandTreesImprovementsLoaded) {
final trees = state.trees_imp;
return FormBuilder(
key: otherImpKey,
onChanged: () {
otherImpKey.currentState?.save();
},
autovalidateMode: AutovalidateMode.disabled,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: SingleChildScrollView(
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<TreesImprovements>(
name: 'kinds_of_trees',
autofocus: false,
decoration: normalTextFieldStyle(
"Kinds of Trees", ""),
items: state.trees_imp
.map((trees) =>
DropdownMenuItem<TreesImprovements>(
value: trees,
child: Text(
(trees.improvement ?? "") +
" " +
(trees.subclassCode ?? ""),
),
))
.toList(),
onChanged: (selectedTree) {
if (selectedTree != null) {
setState(() {
_unitValue = double.parse(
selectedTree.pricePerTree!);
_treeType = selectedTree.improvement!;
});
}
},
)),
),
Container(
child: Row(
children: [
Row(
children: [
Checkbox(
value: _fruitBearing,
onChanged: (bool? value) {
setState(() {
_fruitBearing = value!;
});
},
),
Text('Fruit Bearing ?'),
],
),
],
),
),
Visibility(
visible: !_fruitBearing,
child: Row(
children: [
Expanded(
child: FormBuilderTextField(
name: 'subClass',
decoration: normalTextFieldStyle(
"SubClass/Age", ""),
validator:
FormBuilderValidators.compose([]),
onChanged: (value) {
setState(() {
_subClassDesc = value!;
});
},
),
),
SizedBox(
width: 10,
),
Expanded(
child: FormBuilderTextField(
name: 'qty',
decoration: normalTextFieldStyle("No.", ""),
validator:
FormBuilderValidators.compose([]),
onChanged: (value) {
setState(() {
qty = int.parse(value!);
});
},
),
),
],
),
replacement: Column(
children: [
FormBuilderTextField(
name: 'no_of_productive',
decoration: normalTextFieldStyle(
"No. of Productive", ""),
validator: FormBuilderValidators.compose([]),
onChanged: (value) {
setState(() {
pr_qty = int.parse(value!);
});
},
),
const SizedBox(height: 10),
FormBuilderTextField(
name: 'no_of_nonproductive',
decoration: normalTextFieldStyle(
"No. of Non-Productive", ""),
validator: FormBuilderValidators.compose([]),
onChanged: (value) {
setState(() {
nonpr_qty = int.parse(value!);
});
},
),
],
),
),
const SizedBox(height: 10),
const Text('Market Value'),
const SizedBox(height: 5),
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(_unitValue))),
),
const SizedBox(height: 10),
const Text('Base Market Value'),
const SizedBox(height: 5),
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(_calculateBaseMarketValue().toString() ==
"0.00"
? "00.0"
: _calculateBaseMarketValue())),
),
),
const SizedBox(height: 10),
Row(
children: [
Container(
width: 120,
height: 60,
padding: const EdgeInsets.all(8.0),
child: ElevatedButton(
onPressed: () async {
var improvement = OtherImprovements(
landapprDetailsId: widget.tempId,
kindsOfTrees: _treeType,
subclassAge: _subClassDesc,
quantity: qty,
unitValue: _unitValue.toString(),
baseMarketval:
_calculateBaseMarketValue()
.toString(),
noOfProductive: pr_qty,
noOfNonproductive: nonpr_qty,
fruitBearing: _fruitBearing);
context.read<OtherImprovementsBloc>().add(
AddOtherImprovement(
other_imp: improvement));
},
style: ElevatedButton.styleFrom(
primary: Colors.black,
),
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<OtherImprovementsBloc>().add(
LoadOtherImprovementEdit(
other_imps: <OtherImprovements>[],
ids: widget.tempId));
},
style: ElevatedButton.styleFrom(
primary: Colors.black,
),
child: const Text("Cancel"),
),
),
],
)
],
),
),
),
));
}
if (state is LandTreesImprovementsErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context
.read<LandTreesImprovementsBloc>()
.add(LoadLandTreesImprovements());
},
);
}
return Container();
});
}
if (state is OtherImprovementErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context.read<OtherImprovementsBloc>().add(LoadOtherImprovement());
},
);
}
return Container();
});
}
}

View File

@ -0,0 +1,356 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:intl/intl.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:unit2/bloc/passo/land/land_property_assessment/land_property_assessment_bloc.dart';
import 'package:unit2/bloc/passo/land/land_value_adjustments/land_value_adjustments_bloc.dart';
import 'package:unit2/model/passo/land_property_assessment.dart';
import 'package:unit2/model/passo/land_value_adjustment.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 AddPropertyAssessmentEditModal extends StatefulWidget {
// final List<UnitConstruct> unit;
// final List<ClassComponents> options;
final int tempId;
AddPropertyAssessmentEditModal(this.tempId);
@override
_AddPropertyAssessmentEditModal createState() =>
_AddPropertyAssessmentEditModal();
}
class _AddPropertyAssessmentEditModal
extends State<AddPropertyAssessmentEditModal> {
final focus = FocusNode();
bool isPainted = false;
bool isSecondHand = false;
TextEditingController textEditingController = TextEditingController();
double _unitBase = 0;
int _areaValue = 0;
final double _depValue = 0;
double _unitValue = 0;
String _subClassDesc = "";
int _classId = 0;
String _structureType = "";
int _notPaintedUnitVal = 0;
int _secondHandUnitVal = 0;
String cityCode = '';
String cityDesc = '';
int classCode = 1;
String _classDesc = '';
String _treeType = "";
bool _nonfruitBearing = false;
bool _fruitBearing = false;
int qty = 0;
int pr_qty = 0;
int nonpr_qty = 0;
String _actualUse = "Residential";
String _assessmentLevel = "";
GlobalKey<FormBuilderState> assessmentKey = GlobalKey<FormBuilderState>();
final typeOfTree = [
"Non-Fruit Bearing",
"Fruit Bearing",
];
final actual_use = [
"Residential",
"Agricultural",
"Commercial",
"Industrial",
"Mineral",
"Timberland",
];
calculateAssessmentValue() {
switch (_actualUse) {
case "Residential":
return _unitValue * 0.20;
break;
case "Agricultural":
return _unitValue * 0.40;
break;
case "Commercial":
return _unitValue * 0.50;
break;
case "Industrial":
return _unitValue * 0.50;
break;
case "Mineral":
return _unitValue * 0.50;
break;
case "Timberland":
return _unitValue * 0.20;
break;
default:
}
}
BoxDecoration box1() {
return const BoxDecoration(boxShadow: [
BoxShadow(color: Colors.black12, spreadRadius: 5, blurRadius: 5)
], color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(3)));
}
double _amountofDepreciation(unitVal, unitBase, area, depreciation) {
return ((unitVal * unitBase) * area) * depreciation;
}
double _totalMarketValue(unitBase, area) {
return unitBase * area;
}
@override
Widget build(BuildContext context) {
return BlocBuilder<LandPropertyAssessmentBloc, LandPropertyAssessmentState>(
buildWhen: (previous, current) {
return false;
}, builder: (context, state) {
if (state is ShowAddLandPropertyAssessmentScreen) {
return BlocConsumer<LandValueAdjustmentsBloc,
LandValueAdjustmentsState>(listener: (context, state) {
// TODO: implement listener
}, builder: (context, state) {
if (state is LandValueAdjustmentsLoaded) {
final assessment = state.val_adj;
return FormBuilder(
key: assessmentKey,
onChanged: () {
assessmentKey.currentState?.save();
},
autovalidateMode: AutovalidateMode.disabled,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: SingleChildScrollView(
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<ValueAdjustments>(
name: 'value_adjustments',
autofocus: false,
decoration: normalTextFieldStyle(
"Value Adjustments", ""),
items: state.val_adj
.map((adj) =>
DropdownMenuItem<ValueAdjustments>(
value: adj,
child: Text(
(adj.adjustmentFactors ?? ""),
),
))
.toList(),
onChanged: (selectedAdj) {
if (selectedAdj != null) {
setState(() {
_unitValue = double.parse(
selectedAdj.marketValue!);
});
}
},
)),
),
SizedBox(
height: 10,
),
FormBuilderDropdown<String?>(
name: "land_actual_use",
autofocus: false,
decoration: normalTextFieldStyle("Actual Use", ""),
items: actual_use
.map((item) => DropdownMenuItem(
value: item,
child: Text(item),
))
.toList(),
onChanged: (value) {
setState(() {
_actualUse = value!;
switch (value) {
case "Residential":
setState(() {
_assessmentLevel = '20';
});
break;
case "Agricultural":
setState(() {
_assessmentLevel = '40';
});
break;
case "Commercial":
setState(() {
_assessmentLevel = '50';
});
break;
case "Industrial":
setState(() {
_assessmentLevel = '50';
});
break;
case "Mineral":
setState(() {
_assessmentLevel = '50';
});
break;
case "Timberland":
setState(() {
_assessmentLevel = '20';
});
break;
default:
}
});
},
),
SizedBox(
height: 10,
),
Text('Assessment Level'),
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(_assessmentLevel + '%'),
),
),
SizedBox(
height: 10,
),
Text('Assessment Value'),
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(calculateAssessmentValue().toString() ==
"0.00"
? "00.0"
: calculateAssessmentValue())),
),
),
const SizedBox(height: 10),
Row(
children: [
Container(
width: 120,
height: 60,
padding: const EdgeInsets.all(8.0),
child: ElevatedButton(
onPressed: () async {
var assessment = LandPropertyAssessment(
landapprDetailsId: widget.tempId,
actualUse: _actualUse,
marketval: _unitValue.toString(),
assessmentLevel: _assessmentLevel,
assessedValue:
calculateAssessmentValue()
.toString(),
totalMarketval: '0',
totalAssessedval: '0');
context
.read<LandPropertyAssessmentBloc>()
.add(AddLandPropertyAssessment(
assessment: assessment));
},
style: ElevatedButton.styleFrom(
primary: Colors.black,
),
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<LandPropertyAssessmentBloc>()
.add(
const LoadLandPropertyAssessment());
},
style: ElevatedButton.styleFrom(
primary: Colors.black,
),
child: const Text("Cancel"),
),
),
],
)
],
),
),
),
));
}
if (state is LandValueAdjustmentsErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context
.read<LandValueAdjustmentsBloc>()
.add(LoadLandValueAdjustments());
},
);
}
return Container();
});
}
if (state is LandPropertyAssessmentErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context
.read<LandPropertyAssessmentBloc>()
.add(LoadLandPropertyAssessment());
},
);
}
return Container();
});
}
}

View File

@ -0,0 +1,294 @@
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';
import 'package:unit2/screens/passo/Land/edit_land/AddLandAppraisalEdit.dart';
import 'package:unit2/utils/alerts.dart';
import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/error_state.dart';
import 'package:unit2/widgets/passo/custom_button.dart';
class LandAppraisalEdit extends StatefulWidget {
Function PrevBtn;
Function NextBtn;
final int faasId;
LandAppraisalEdit(this.PrevBtn, this.NextBtn, this.faasId);
@override
_LandAppraisalEdit createState() => _LandAppraisalEdit();
}
class _LandAppraisalEdit extends State<LandAppraisalEdit> {
// double _totalMarketValue(items) {
// double total = 0;
// items.forEach((row) {
// total += double.parse(row);
// });
// return total;
// }
void deleteItem(int itemId) {
context.read<LandAppraisalBloc>().add(DeleteLandAppraisal(id: itemId));
}
@override
Widget build(BuildContext context) {
return 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),
),
Align(
alignment: Alignment.topRight,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red,
),
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: () {},
),
],
))
],
);
}).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(LoadLandAppraisalEdit(
land_appr: const <LandAppr>[], id: widget.faasId!));
});
});
}
}
if (state is ShowAddLandAppraisalScreen) {
return ConstrainedBox(
constraints: const BoxConstraints(
maxHeight: 700.0,
),
child: AlertDialog(
insetPadding: const EdgeInsets.symmetric(
horizontal: 20.0,
vertical: 10.0,
),
title: const Text(
'ADD LAND APPRAISAL',
textAlign: TextAlign.center,
),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Align(
alignment: Alignment.topCenter,
child: Container(
child: ConstrainedBox(
constraints: BoxConstraints(maxHeight: 500),
child: Container(
child: AddLandAppraisalEditModal(widget.faasId),
),
),
),
),
],
),
),
);
}
if (state is LandAppraisalErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context.read<LandAppraisalBloc>().add(LoadLandAppraisalEdit(
land_appr: <LandAppr>[], id: widget.faasId!));
},
);
}
return Container();
}),
);
}
}

View File

@ -0,0 +1,270 @@
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:unit2/bloc/passo/land/land_boundaries_edit/land_boundaries_edit_bloc.dart';
import 'package:unit2/bloc/passo/land/land_location_edit/land_location_edit_bloc.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/screens/passo/Land/edit_land/property_owner_info_edit.dart';
import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/error_state.dart';
import 'package:unit2/widgets/passo/custom_button.dart';
import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart';
class LandLocationAndBoundariesEdit extends StatefulWidget {
Function PrevBtn;
Function NextBtn;
LandPropertyOwner land;
LandLocationAndBoundariesEdit(this.PrevBtn, this.NextBtn, this.land);
@override
_LandLocationAndBoundariesEdit createState() =>
_LandLocationAndBoundariesEdit();
}
class _LandLocationAndBoundariesEdit
extends State<LandLocationAndBoundariesEdit> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: ProgressHUD(
padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocConsumer<LandLocationEditBloc, LandLocationEditState>(
listener: (context, state) {
if (state is LandLocationEditLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is LandLocationEditErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
},
builder: (context, state) {
if (state is LandLocationEditLoaded) {
final landLoc = state.land_loc_edit;
return BlocConsumer<LandBoundariesEditBloc,
LandBoundariesEditState>(
listener: (context, state) {
if (state is LandBoundariesEditLoaded) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
if (state is LandBoundariesEditErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
},
builder: (context, state) {
if (state is LandBoundariesEditLoaded) {
return FormBuilder(
key: landEditKey,
initialValue: {
'street': landLoc.street,
'brgy': landLoc.barangay,
'municipality': landLoc.municipality,
'province': landLoc.province,
'north': state.land_boundaries_edit.north,
'south': state.land_boundaries_edit.south,
'east': state.land_boundaries_edit.east,
'west': state.land_boundaries_edit.west
},
enabled: true,
onChanged: () {
landEditKey.currentState!.save();
debugPrint(landEditKey.currentState!.value.toString());
},
autovalidateMode: AutovalidateMode.disabled,
skipDisabled: true,
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
margin: const EdgeInsets.only(
left: 0, top: 20, right: 0, bottom: 10),
child: const Text('PROPERTY LOCATION',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18),
textAlign: TextAlign.left),
),
const SizedBox(height: 15),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: <Widget>[
Expanded(
// optional flex property if flex is 1 because the default flex is 1
flex: 1,
child: customTextField(
"No. / Street", "", "street")),
const SizedBox(width: 10.0),
Expanded(
// optional flex property if flex is 1 because the default flex is 1
flex: 1,
child: customTextField(
"Brgy./District", "", "brgy")),
],
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: <Widget>[
Expanded(
flex: 1,
child: customTextField(
"Municipality", "", "municipality"),
),
const SizedBox(width: 10.0),
Expanded(
// optional flex property if flex is 1 because the default flex is 1
flex: 1,
child: customTextField(
"Province/City", "", "province"))
]),
Container(
margin: const EdgeInsets.only(
left: 0, top: 20, right: 0, bottom: 10),
child: const Text('PROPERTY BOUNDARIES',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18),
textAlign: TextAlign.left),
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: <Widget>[
Expanded(
flex: 1,
child: customTextField(
"North", "", "north"),
),
const SizedBox(width: 10.0),
Expanded(
// optional flex property if flex is 1 because the default flex is 1
flex: 1,
child: customTextField(
"East", "", "east"))
]),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: <Widget>[
Expanded(
flex: 1,
child: customTextField(
"South", "", "south"),
),
const SizedBox(width: 10.0),
Expanded(
// optional flex property if flex is 1 because the default flex is 1
flex: 1,
child: customTextField(
"West", "", "west"))
]),
const SizedBox(
height: 50,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [
CustomButton(
icon: const Icon(Icons.chevron_left,
color: Colors.white),
onPressed: () {
widget.PrevBtn();
}),
CustomButton(
icon: const Icon(Icons.chevron_right,
color: Colors.white),
onPressed: () {
print(widget.land.id);
var boundaries =
LandPropertyBoundaries(
id: widget.land.id,
north: landEditKey
.currentState?.value['north'],
east: landEditKey
.currentState?.value['east'],
west: landEditKey
.currentState?.value['west'],
south: landEditKey
.currentState?.value['south'],
);
var location = LandPropertyLoc(
id: widget.land.id,
street: landEditKey
.currentState?.value['street'],
barangay: landEditKey
.currentState?.value['brgy'],
municipality: landEditKey
.currentState
?.value['municipality'],
province: landEditKey.currentState
?.value['province'],
);
context
.read<LandLocationEditBloc>()
.add(UpdateLandLocationEdit(
land_loc_edit: location,
id: widget.land.id!));
context
.read<LandBoundariesEditBloc>()
.add(UpdateLandBoundariesEdit(
land_boundaries_edit:
boundaries,
id: widget.land.id!));
widget.NextBtn();
})
],
)
]),
),
),
);
}
if (state is LandBoundariesEditErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context.read<LandBoundariesEditBloc>().add(
LoadLandBoundariesEdit(
land_boundaries_edit: LandPropertyBoundaries(),
id: widget.land.id!));
},
);
}
return Container();
},
);
}
;
if (state is LandLocationEditErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context.read<LandLocationEditBloc>().add(LoadLandLocationEdit(
land_loc_edit: LandPropertyLoc(), id: widget.land.id!));
},
);
}
return Container();
},
),
),
);
}
}

View File

@ -0,0 +1,313 @@
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/model/passo/other_improvements.dart';
import 'package:unit2/screens/passo/Land/add_land/AddOtherImprovementModal.dart';
import 'package:unit2/screens/passo/Land/edit_land/AddOtherImprovementEditModal.dart';
import 'package:unit2/utils/alerts.dart';
import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/error_state.dart';
import 'package:unit2/widgets/passo/custom_button.dart';
class OtherImprovementEditPage extends StatefulWidget {
Function PrevBtn;
Function NextBtn;
final int faasId;
OtherImprovementEditPage(this.PrevBtn, this.NextBtn, this.faasId);
@override
_OtherImprovementEditPage createState() => _OtherImprovementEditPage();
}
class _OtherImprovementEditPage extends State<OtherImprovementEditPage> {
// double _totalMarketValue(items) {
// double total = 0;
// items.forEach((row) {
// total += double.parse(row);
// });
// return total;
// }
void deleteItem(int itemId) {
context
.read<OtherImprovementsBloc>()
.add(DeleteOtherImprovement(id: itemId));
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: ProgressHUD(
padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocConsumer<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),
),
Align(
alignment: Alignment.topRight,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red,
),
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: () {},
),
],
))
],
);
}).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: [
Align(
alignment: Alignment.topCenter,
child: Container(
child: ConstrainedBox(
constraints: BoxConstraints(maxHeight: 500),
child: Container(
child: AddOtherImprovementEditModal(widget.faasId),
),
),
),
),
],
),
),
);
}
if (state is OtherImprovementErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context.read<OtherImprovementsBloc>().add(
LoadOtherImprovementEdit(
other_imps: const <OtherImprovements>[],
ids: widget.faasId));
},
);
}
return Container();
}),
),
);
}
}

View File

@ -0,0 +1,660 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:searchfield/searchfield.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:unit2/bloc/passo/land/land_ext_bloc/land_ext_edit_bloc.dart';
import 'package:unit2/bloc/passo/memoranda/memoranda_bloc.dart';
import 'package:unit2/bloc/passo/signatories/signatories_bloc.dart';
import 'package:unit2/model/passo/land_ext.dart';
import 'package:unit2/model/passo/memoranda.dart';
import 'package:unit2/model/passo/signatories.dart';
import 'package:unit2/screens/passo/Land/edit_land/property_owner_info_edit.dart';
import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/error_state.dart';
class LandSignatoriesEdit extends StatefulWidget {
Function onSAve;
final int faasId;
LandSignatoriesEdit(this.onSAve, this.faasId);
@override
_LandSignatoriesEdit createState() => _LandSignatoriesEdit();
}
class _LandSignatoriesEdit extends State<LandSignatoriesEdit> {
bool isTaxable = false;
bool isExempt = false;
final focus = FocusNode();
String _memoranda = "";
@override
Widget build(BuildContext context) {
return Scaffold(
body: ProgressHUD(
padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocConsumer<LandExtEditBloc, LandExtEditState>(
listener: (context, state) {
if (state is LandExtEditLoading) {
final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait...");
}
if (state is LandExtEditErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
},
builder: (context, state) {
if (state is LandExtEditLoaded) {
final landext = state.land_ext_edit;
return BlocConsumer<SignatoriesBloc, SignatoriesState>(
listener: (context, state) {
if (state is SignatoriesErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
},
builder: (context, state) {
if (state is SignatoriesLoaded) {
final signatories = state.signatories;
return BlocConsumer<MemorandaBloc, MemorandaState>(
listener: (context, state) {
if (state is MemorandaLoaded) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
if (state is MemorandaErrorState) {
final progress = ProgressHUD.of(context);
progress?.dismiss();
}
},
builder: (context, state) {
if (state is MemorandaLoaded) {
return FormBuilder(
key: landEditKey,
initialValue: {
'land_qtr': landext.qtr.toString(),
'land_yr': landext.yr.toString(),
'app_date_land': landext.appraisedbyDate,
'rec_date_land': landext.recommendapprDate,
'apprvd_by_date_land': landext.approvedbyDate,
'sworn_statement_land': landext.swornstatementNo,
'date_received_land': landext.dateReceived,
'date_of_entry_land': landext.entryDateAssessment,
'by_land': landext.entryDateBy
},
enabled: true,
onChanged: () {
landEditKey.currentState!.save();
debugPrint(
landEditKey.currentState!.value.toString());
},
autovalidateMode: AutovalidateMode.disabled,
skipDisabled: true,
child: SingleChildScrollView(
child: Column(
children: [
Container(
margin: const EdgeInsets.only(
left: 0, top: 20, right: 0, bottom: 10),
child: const Text(
'PROPERTY ASSESSMENT cont..',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18),
textAlign: TextAlign.left),
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceAround,
children: [
Row(
children: [
const Text('Taxable'),
Checkbox(
checkColor: Colors.white,
value: isTaxable,
onChanged: (bool? value) {
setState(() {
isTaxable = value!;
});
},
)
],
),
Row(
children: [
const Text('Exempt'),
Checkbox(
checkColor: Colors.white,
value: isExempt,
onChanged: (bool? value) {
setState(() {
isExempt = value!;
});
},
)
],
),
],
),
Column(
children: [
const SizedBox(
height: 20,
),
const Text(
'EFFECTIVITY OF ASSESSMENT / REASSESSMENT :',
style: TextStyle(
fontWeight: FontWeight.bold),
),
const SizedBox(
height: 20,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceAround,
children: [
const Text('Qtr.'),
SizedBox(
width: 70,
height: 25,
child: FormBuilderTextField(
name: 'land_qtr',
validator:
FormBuilderValidators.compose(
[]),
),
),
const SizedBox(
width: 20,
),
const Text('Yr.'),
SizedBox(
width: 70,
height: 25,
child: FormBuilderTextField(
name: 'land_yr',
validator:
FormBuilderValidators.compose(
[]),
),
),
],
),
],
),
Container(
margin: const EdgeInsets.only(
left: 0, top: 40, right: 0, bottom: 10),
child: const Text('SIGNATORIES',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18),
textAlign: TextAlign.left),
),
const SizedBox(
height: 30,
),
const Align(
alignment: Alignment.centerLeft,
child: Text(
'APPRAISED/ASSESSED BY:',
style:
TextStyle(fontWeight: FontWeight.bold),
textAlign: TextAlign.start,
),
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceAround,
children: [
Column(
children: [
SizedBox(
width: 200,
child:
FormBuilderDropdown<Signatories>(
name: 'appraised_by_land',
decoration: InputDecoration(
labelText: landext
.appraisedbyName!,
labelStyle: const TextStyle(
color: Colors.black),
),
autofocus: false,
items: signatories
.map((signatories) =>
DropdownMenuItem(
value: signatories,
child: Text(
'${signatories.firstname} ${signatories.middlename} ${signatories.lastname}'),
))
.toList()),
),
const Text('Name'),
],
),
const SizedBox(
width: 15,
),
Column(
children: [
SizedBox(
width: 100,
child: FormBuilderDateTimePicker(
name: 'app_date_land',
initialEntryMode:
DatePickerEntryMode
.calendarOnly,
initialValue: DateTime.now(),
inputType: InputType.date,
initialTime: const TimeOfDay(
hour: 8, minute: 0),
// locale: const Locale.fromSubtags(languageCode: 'fr'),
),
),
const Text('Date'),
],
),
],
),
const SizedBox(
height: 30,
),
const Align(
alignment: Alignment.centerLeft,
child: Text(
'RECOMMENDING APPROVAL:',
style: TextStyle(
fontWeight: FontWeight.bold),
)),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceAround,
children: [
Column(
children: [
SizedBox(
width: 200,
child:
FormBuilderDropdown<Signatories>(
name: 'rec_approval_land',
decoration: InputDecoration(
labelText: landext
.recommendapprName!,
labelStyle: const TextStyle(
color: Colors.black),
),
autofocus: false,
items: signatories
.map((signatories) =>
DropdownMenuItem(
value: signatories,
child: Text(
'${signatories.firstname} ${signatories.middlename} ${signatories.lastname}'),
))
.toList()),
),
const Text('Name'),
],
),
const SizedBox(
width: 15,
),
Column(
children: [
SizedBox(
width: 100,
child: FormBuilderDateTimePicker(
name: 'rec_date_land',
initialEntryMode:
DatePickerEntryMode
.calendarOnly,
initialValue: DateTime.now(),
inputType: InputType.date,
initialTime: const TimeOfDay(
hour: 8, minute: 0),
// locale: const Locale.fromSubtags(languageCode: 'fr'),
),
),
const Text('Date'),
],
),
],
),
const SizedBox(
height: 30,
),
const Align(
alignment: Alignment.centerLeft,
child: Text(
'APPROVED BY:',
style: TextStyle(
fontWeight: FontWeight.bold,
),
)),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Column(
children: [
SizedBox(
width: 200,
child:
FormBuilderDropdown<Signatories>(
name: 'apprvd_by_land',
decoration: InputDecoration(
labelText:
landext.approvedbyName!,
labelStyle: const TextStyle(
color: Colors.black),
),
autofocus: false,
items: signatories
.map((signatories) =>
DropdownMenuItem(
value: signatories,
child: Text(
'${signatories.firstname} ${signatories.middlename} ${signatories.lastname}'),
))
.toList()),
),
const Text('Name'),
],
),
const SizedBox(
width: 15,
),
Column(
children: [
SizedBox(
width: 100,
child: FormBuilderDateTimePicker(
name: 'apprvd_by_date_land',
initialEntryMode:
DatePickerEntryMode
.calendarOnly,
initialValue: DateTime.now(),
inputType: InputType.date,
initialTime: const TimeOfDay(
hour: 8, minute: 0),
// locale: const Locale.fromSubtags(languageCode: 'fr'),
),
),
Text('Date'),
],
),
],
),
const SizedBox(
height: 50,
),
const Align(
alignment: Alignment.centerLeft,
child: Text(
'MEMORANDA: ',
style: TextStyle(
fontWeight: FontWeight.bold,
),
)),
const SizedBox(
height: 50,
),
SizedBox(
width: 500,
height: 100,
child: SearchField(
suggestions: state.memorada
.map((Memoranda memoranda) =>
SearchFieldListItem(
'${memoranda.memoranda}',
item:
memoranda, // Change: Use individual Memoranda object
child: ListTile(
title: Text(
'${memoranda.memoranda}',
overflow:
TextOverflow.ellipsis,
),
),
))
.toList(),
validator: FormBuilderValidators.required(
errorText: "This field is required"),
// searchInputDecoration:
// normalTextFieldStyle(
// "Memoranda", "")
// .copyWith(
// suffixIcon: const Icon(
// Icons.arrow_drop_down),
// ),
// focusNode: focus,
suggestionState: Suggestion.expand,
onSuggestionTap: (memoranda) {
setState(() {
_memoranda =
memoranda.item!.memoranda!;
});
focus.unfocus();
},
)),
const SizedBox(
height: 30,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text('Sworn Statement No. :'),
SizedBox(
width: 150,
height: 20,
child: FormBuilderTextField(
name: 'sworn_statement_land',
decoration: InputDecoration(),
validator:
FormBuilderValidators.compose([]),
),
),
],
),
const SizedBox(
height: 30,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text('Date Received:'),
SizedBox(
width: 150,
height: 20,
child: FormBuilderDateTimePicker(
name: 'date_received_land',
initialEntryMode:
DatePickerEntryMode.calendarOnly,
initialValue: DateTime.now(),
inputType: InputType.date,
initialTime:
const TimeOfDay(hour: 8, minute: 0),
// locale: const Locale.fromSubtags(languageCode: 'fr'),
),
),
],
),
const SizedBox(
height: 30,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
const Text(
'Date of Entry in the Rec. of Ass. :'),
SizedBox(
width: 100,
height: 20,
child: FormBuilderDateTimePicker(
name: 'date_of_entry_land',
initialEntryMode:
DatePickerEntryMode.calendarOnly,
initialValue: DateTime.now(),
inputType: InputType.date,
initialTime:
const TimeOfDay(hour: 8, minute: 0),
// locale: const Locale.fromSubtags(languageCode: 'fr'),
),
),
],
),
const SizedBox(
height: 30,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
const Text('By:'),
SizedBox(
width: 150,
height: 20,
child: FormBuilderTextField(
name: 'by_land',
decoration: const InputDecoration(),
validator:
FormBuilderValidators.compose([]),
),
),
],
),
const SizedBox(
height: 30,
),
ElevatedButton(
onPressed: () async {
final tempID =
await SharedPreferences.getInstance();
var ext = LandExt(
landapprDetailsId:
tempID.getInt('landid')! - 1,
taxable: isTaxable,
exempt: isExempt,
qtr: int.parse(landEditKey
.currentState!.value['land_qtr']),
yr: int.parse(landEditKey
.currentState!.value['land_yr']),
appraisedbyName: landEditKey.currentState!.value['appraised_by_land'].firstname +
' ' +
landEditKey
.currentState!
.value['appraised_by_land']
.middlename +
' ' +
landEditKey
.currentState!
.value['appraised_by_land']
.lastname,
appraisedbyDate: landEditKey
.currentState!
.value['app_date_land'],
recommendapprName: landEditKey.currentState!.value['rec_approval_land'].firstname +
' ' +
landEditKey.currentState!.value['rec_approval_land'].middlename +
' ' +
landEditKey.currentState!.value['rec_approval_land'].lastname,
recommendapprDate: landEditKey.currentState!.value['rec_date_land'],
approvedbyName: landEditKey.currentState!.value['apprvd_by_land'].firstname + ' ' + landEditKey.currentState!.value['apprvd_by_land'].middlename + ' ' + landEditKey.currentState!.value['apprvd_by_land'].lastname,
approvedbyDate: landEditKey.currentState!.value['apprvd_by_date_land'],
memoranda: _memoranda,
swornstatementNo: landEditKey.currentState!.value['sworn_statement_land'],
dateReceived: landEditKey.currentState!.value['date_received_land'],
entryDateAssessment: landEditKey.currentState!.value['date_of_entry_land'],
entryDateBy: landEditKey.currentState!.value['by_land']);
context.read<LandExtEditBloc>().add(
UpdateLandExtEdit(
land_ext_edit: ext,
id: widget.faasId));
widget.onSAve();
},
style: ElevatedButton.styleFrom(
backgroundColor: primary,
foregroundColor: Colors.red),
child: const SizedBox(
width: 250,
height: 50,
child: Align(
alignment: Alignment.center,
child: Text(
'Save',
style: TextStyle(
color: Colors.white,
),
textAlign: TextAlign.center,
),
),
),
),
const SizedBox(
height: 30,
),
],
)),
);
}
if (state is MemorandaErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context
.read<MemorandaBloc>()
.add(const LoadMemoranda());
},
);
}
return Container();
},
);
}
if (state is SignatoriesErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context
.read<SignatoriesBloc>()
.add(const LoadSignatories());
},
);
}
return Container();
},
);
}
if (state is LandExtEditErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context.read<LandExtEditBloc>().add(LoadLandExtEdit(
land_ext_edit: LandExt(), id: widget.faasId));
},
);
}
return Container();
},
),
),
);
}
}

View File

@ -0,0 +1,287 @@
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/bulding/property_assessment_edit/property_assessment_edit_bloc.dart';
import 'package:unit2/bloc/passo/land/land_property_assessment/land_property_assessment_bloc.dart';
import 'package:unit2/model/passo/land_property_assessment.dart';
import 'package:unit2/screens/passo/Land/add_land/AddPropertyAssessmentModal.dart';
import 'package:unit2/screens/passo/Land/edit_land/AddPropertyAssessmentEditModal.dart';
import 'package:unit2/utils/alerts.dart';
import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/error_state.dart';
import 'package:unit2/widgets/passo/custom_button.dart';
class LandPropertyAssessmentEditPage extends StatefulWidget {
Function PrevBtn;
Function NextBtn;
final int faasId;
LandPropertyAssessmentEditPage(this.PrevBtn, this.NextBtn, this.faasId);
@override
_LandPropertyAssessmentEditPage createState() =>
_LandPropertyAssessmentEditPage();
}
class _LandPropertyAssessmentEditPage
extends State<LandPropertyAssessmentEditPage> {
// double _totalMarketValue(items) {
// double total = 0;
// items.forEach((row) {
// total += double.parse(row);
// });
// return total;
// }
void deleteItem(int itemId) {
context
.read<LandPropertyAssessmentBloc>()
.add(DeleteLandPropertyAssessment(id: itemId));
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: ProgressHUD(
padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocConsumer<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),
),
Align(
alignment: Alignment.topRight,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red,
),
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: () {},
),
],
))
],
);
}).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(
LoadLandPropertyAssessmentEdit(
assessment: <LandPropertyAssessment>[],
id: widget.faasId));
});
});
}
}
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: [
Container(
child: AddPropertyAssessmentEditModal(widget.faasId))
],
),
),
);
}
if (state is LandPropertyAssessmentErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context.read<LandPropertyAssessmentBloc>().add(
LoadLandPropertyAssessmentEdit(
assessment: const <LandPropertyAssessment>[],
id: widget.faasId));
},
);
}
return Container();
}),
),
);
}
}

View File

@ -0,0 +1,223 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:unit2/bloc/passo/land/land_property_owner_info/land_property_owner_info_bloc.dart';
import 'package:unit2/model/passo/land_property_owner.dart';
import 'package:unit2/screens/passo/Land/add_land.dart';
import 'package:unit2/widgets/passo/custom_button.dart';
import 'package:unit2/widgets/passo/custom_formBuilder_fields.dart';
GlobalKey<FormBuilderState> landEditKey = GlobalKey<FormBuilderState>();
class LandPropertyOwnerInfoEdit extends StatefulWidget {
Function NextBtn;
LandPropertyOwner land;
LandPropertyOwnerInfoEdit(this.NextBtn, this.land);
@override
_LandPropertyOwnerInfoEdit createState() => _LandPropertyOwnerInfoEdit();
}
class _LandPropertyOwnerInfoEdit extends State<LandPropertyOwnerInfoEdit> {
final transaction_codes = ['New', 'Revision'];
@override
Widget build(BuildContext context) {
return BlocConsumer<LandPropertyOwnerInfoBloc, LandPropertyOwnerInfoState>(
listener: (context, state) {
// TODO: implement listener
},
builder: (context, state) {
return FormBuilder(
key: landEditKey,
initialValue: {
'transaction_code': widget.land.transCode ?? '',
'td_no': widget.land.tdn ?? '',
'owner': widget.land.owner ?? '',
'pin': widget.land.pin ?? '',
'tin': widget.land.tin ?? '',
'cloa_no': widget.land.cloaNo ?? '',
'dated': widget.land.dated ?? '',
'survey_no': widget.land.surveyNo ?? '',
'lot_no': widget.land.lotNo ?? '',
'blk': widget.land.blkNo ?? '',
'address': widget.land.address ?? '',
'tel_no': widget.land.telno ?? '',
'admin': widget.land.adminUser ?? '',
'admin_tin': widget.land.adminTin ?? '',
'admin_address': widget.land.adminAddress ?? '',
'admin_telno': widget.land.adminTelno ?? '',
},
enabled: true,
onChanged: () {
landEditKey.currentState!.save();
debugPrint(landEditKey.currentState!.value.toString());
},
autovalidateMode: AutovalidateMode.disabled,
skipDisabled: true,
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
margin: const EdgeInsets.only(
left: 0, top: 20, right: 0, bottom: 10),
child: const Text('PROPERTY OWNER INFO',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 18),
textAlign: TextAlign.left),
),
const SizedBox(height: 15),
customDropDownField("Transaction Code", "",
"transaction_code", transaction_codes),
customTextField("ARP No./ TD No.", "", "td_no"),
customTextField("Owner", "", "owner"),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Expanded(
flex: 1, child: customTextField("PIN", "", "pin")),
const SizedBox(width: 10.0),
Expanded(
// optional flex property if flex is 1 because the default flex is 1
flex: 1,
child: customTextField("TIN", "", "tin"))
]),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Expanded(
flex: 1,
child: customTextField(
"OCT/TCT CLOA No.", "", "cloa_no"),
),
const SizedBox(width: 10.0),
Expanded(
// optional flex property if flex is 1 because the default flex is 1
flex: 1,
child: customDatTimePicker("Dated", "", "dated"))
]),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Expanded(
flex: 1,
child: customTextField("Survey No.", "", "survey_no"),
),
const SizedBox(width: 10.0),
Expanded(
// optional flex property if flex is 1 because the default flex is 1
flex: 1,
child: customTextField("Lot No.", "", "lot_no")),
const SizedBox(width: 10.0),
Expanded(
// optional flex property if flex is 1 because the default flex is 1
flex: 1,
child: customTextField("Blk", "", "blk")),
]),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Expanded(
flex: 1,
child: customTextField("Address", "", "address"),
),
const SizedBox(width: 10.0),
Expanded(
// optional flex property if flex is 1 because the default flex is 1
flex: 1,
child: customTextField("Tel No.", "", "tel_no"))
]),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Expanded(
flex: 1,
child: customTextField(
"Administrator/Beneficial User", "", "admin"),
),
const SizedBox(width: 10.0),
Expanded(
// optional flex property if flex is 1 because the default flex is 1
flex: 1,
child: customTextField("TIN", "", "admin_tin"))
]),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Expanded(
flex: 1,
child:
customTextField("Address", "", "admin_address"),
),
const SizedBox(width: 10.0),
Expanded(
// optional flex property if flex is 1 because the default flex is 1
flex: 1,
child:
customTextField("Tel No.", "", "admin_telno"))
]),
SizedBox(
height: 30,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CustomButton(
icon: const Icon(Icons.chevron_right,
color: Colors.white),
onPressed: () {
var land = LandPropertyOwner(
id: widget.land.id,
transCode: landEditKey
.currentState!.value['transaction_code']
.toString(),
tdn: landEditKey.currentState!.value['td_no'],
cloaNo:
landEditKey.currentState!.value['cloa_no'],
dated: landEditKey.currentState!.value['dated'],
assessedById: "1",
assessedByName: "cyril",
dateCreated:
landEditKey.currentState!.value['dated'],
dateModified:
landEditKey.currentState!.value['dated'],
pin: landEditKey.currentState!.value['pin'],
surveyNo:
landEditKey.currentState!.value['survey_no'],
lotNo: landEditKey.currentState!.value['lot_no'],
blkNo: landEditKey.currentState!.value['blk'],
owner: landEditKey.currentState!.value['owner'],
address:
landEditKey.currentState!.value['address'],
telno: landEditKey.currentState!.value['tel_no'],
tin: landEditKey.currentState!.value['tin'],
adminUser:
landEditKey.currentState!.value['admin'],
adminAddress: landEditKey
.currentState!.value['admin_address'],
adminTin:
landEditKey.currentState!.value['admin_tin'],
// faasType: "LAND",
adminTelno: landEditKey
.currentState!.value['admin_telno']);
context.read<LandPropertyOwnerInfoBloc>().add(
UpdateLandPropertyOwner(
land_edit: land, id: widget.land.id!));
widget.NextBtn();
},
)
],
),
const SizedBox(
height: 20,
),
]),
)),
);
},
);
}
}

View File

@ -0,0 +1,283 @@
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/model/passo/land_value_adjustment.dart';
import 'package:unit2/screens/passo/Land/add_land/AddLandValueAdjustmentModal.dart';
import 'package:unit2/utils/alerts.dart';
import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/error_state.dart';
import 'package:unit2/widgets/passo/custom_button.dart';
class ValueAdjustmentEditPage extends StatefulWidget {
Function PrevBtn;
Function NextBtn;
final int faasId;
ValueAdjustmentEditPage(this.PrevBtn, this.NextBtn, this.faasId);
@override
_ValueAdjustmentEditPage createState() => _ValueAdjustmentEditPage();
}
class _ValueAdjustmentEditPage extends State<ValueAdjustmentEditPage> {
// double _totalMarketValue(items) {
// double total = 0;
// items.forEach((row) {
// total += double.parse(row);
// });
// return total;
// }
void deleteItem(int itemId) {
context
.read<LandValueAdjustmentsBloc>()
.add(DeleteLandValueAdjustments(id: itemId));
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: ProgressHUD(
padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child:
BlocConsumer<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),
),
Align(
alignment: Alignment.topRight,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red,
),
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: () {},
),
],
))
],
);
}).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(
LoadLandValueAdjustmentsEdit(
val_adj: <ValueAdjustments>[], id: widget.faasId));
});
});
}
}
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())],
),
),
);
}
if (state is LandValueAdjustmentsErrorState) {
return SomethingWentWrong(
message: onError,
onpressed: () {
context.read<LandValueAdjustmentsBloc>().add(
LoadLandValueAdjustmentsEdit(
val_adj: const <ValueAdjustments>[],
id: widget.faasId));
},
);
}
return Container();
}),
),
);
}
}

View File

@ -57,6 +57,7 @@ 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'; import '../../model/passo/bldg_loc.dart';
import '../../utils/alerts.dart';
class BuildingHome extends StatelessWidget { class BuildingHome extends StatelessWidget {
const BuildingHome({super.key}); const BuildingHome({super.key});
@ -66,6 +67,11 @@ class BuildingHome extends StatelessWidget {
int? profileId; int? profileId;
String? token; String? token;
Profile profile; Profile profile;
void deleteItem(int itemId) {
context.read<PropertyInfoBloc>().add(DeleteBuildingFaas(id: itemId));
}
return Scaffold( return Scaffold(
body: ProgressHUD( body: ProgressHUD(
backgroundColor: Colors.black87, backgroundColor: Colors.black87,
@ -84,8 +90,11 @@ class BuildingHome extends StatelessWidget {
final progress = ProgressHUD.of(context); final progress = ProgressHUD.of(context);
progress!.showWithText("Please wait..."); progress!.showWithText("Please wait...");
} }
if (state is PropertyInfoLoaded || if (state is PropertyInfoLoaded) {
state is PropertyInfoErrorState) { final progress = ProgressHUD.of(context);
progress?.dismiss();
}
if (state is PropertyInfoErrorState) {
final progress = ProgressHUD.of(context); final progress = ProgressHUD.of(context);
progress?.dismiss(); progress?.dismiss();
} }
@ -102,8 +111,8 @@ class BuildingHome 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);
}, },
), ),
), ),
@ -121,6 +130,20 @@ class BuildingHome extends StatelessWidget {
}, },
); );
} }
if (state is BuildingFaasDeletedState) {
if (state.success) {
WidgetsBinding.instance.addPostFrameCallback((_) {
successAlert(context, "Deletion Successful",
"Building FAAS Data has been deleted successfully",
() {
Navigator.of(context).pop();
context
.read<PropertyInfoBloc>()
.add(const LoadPropertyInfo());
});
});
}
}
return Container(); return Container();
}, },
); );
@ -269,7 +292,7 @@ class BuildingHome extends StatelessWidget {
} }
} }
Card _listCard(PropertyInfo property_info, context, index) { Card _listCard(PropertyInfo property_info, context, index, deleteItem) {
return Card( return Card(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
@ -400,7 +423,13 @@ Card _listCard(PropertyInfo property_info, context, index) {
], ],
), ),
), ),
IconButton(onPressed: () {}, icon: const Icon(Icons.chevron_right)), IconButton(
onPressed: () {
deleteItem(property_info.id);
},
icon: const Icon(Icons.delete_rounded),
color: primary,
),
], ],
), ),
), ),

View File

@ -18,8 +18,11 @@ 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/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_classification/land_classification_bloc.dart'; import 'package:unit2/bloc/passo/land/land_classification/land_classification_bloc.dart';
import 'package:unit2/bloc/passo/land/land_ext/land_ext_bloc.dart'; import 'package:unit2/bloc/passo/land/land_ext/land_ext_bloc.dart';
import 'package:unit2/bloc/passo/land/land_ext_bloc/land_ext_edit_bloc.dart';
import 'package:unit2/bloc/passo/land/land_location_edit/land_location_edit_bloc.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/bloc/passo/land/land_property_owner_info/land_property_owner_info_bloc.dart'; import 'package:unit2/bloc/passo/land/land_property_owner_info/land_property_owner_info_bloc.dart';
import 'package:unit2/bloc/passo/land/land_subclassification/land_subclassification_bloc.dart'; import 'package:unit2/bloc/passo/land/land_subclassification/land_subclassification_bloc.dart';
@ -37,8 +40,15 @@ 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/additional_items.dart';
import 'package:unit2/model/passo/general_description.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_property_owner.dart';
import 'package:unit2/model/passo/land_ref.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.dart';
import 'package:unit2/model/passo/property_appraisal_edit.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_assessment_edit.dart';
@ -49,6 +59,7 @@ 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/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/Test%20Envi/multi_dropdown.dart'; import 'package:unit2/screens/passo/Test%20Envi/multi_dropdown.dart';
import 'package:unit2/screens/passo/Test%20Envi/speed_dial.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';
@ -283,79 +294,84 @@ Card _listCard(LandPropertyOwner property_info, context, index) {
padding: const EdgeInsets.all(15.0), padding: const EdgeInsets.all(15.0),
child: InkWell( child: InkWell(
onTap: () async { onTap: () async {
// Navigator.push(context, Navigator.push(context,
// MaterialPageRoute(builder: (BuildContext context) { MaterialPageRoute(builder: (BuildContext context) {
// return MultiBlocProvider( return MultiBlocProvider(
// providers: [ providers: [
// BlocProvider( BlocProvider(
// create: (context) => create: (context) =>
// PropertyInfoBloc()..add(LoadPropertyInfo()), LandPropertyOwnerInfoBloc()..add(LoadLand())),
// ), BlocProvider(
// BlocProvider( create: (context) => LandLocationEditBloc()
// create: (context) => ..add(LoadLandLocationEdit(
// UnitConstructBloc()..add(LoadUnitConstruct()), land_loc_edit: LandPropertyLoc(),
// ), id: property_info.id))),
// BlocProvider( BlocProvider(
// create: (context) => create: (context) => LandExtEditBloc()
// ClassComponentsBloc()..add(LoadClassComponents()), ..add(LoadLandExtEdit(
// ), land_ext_edit: LandExt(), id: property_info.id))),
// BlocProvider( BlocProvider(
// create: (context) => create: (context) => LandBoundariesEditBloc()
// SignatoriesBloc()..add(LoadSignatories())), ..add(LoadLandBoundariesEdit(
// BlocProvider( land_boundaries_edit: LandPropertyBoundaries(),
// create: (context) => LocationBloc() id: property_info.id))),
// ..add( BlocProvider(
// LoadLocation(bldgloc: BldgLoc(), id: property_info.id)), create: (context) => LandAppraisalBloc()
// ), ..add(LoadLandAppraisalEdit(
// BlocProvider( land_appr: const <LandAppr>[],
// create: (context) => LandrefBloc() id: property_info.id!))),
// ..add( BlocProvider(
// LoadLandref(landRef: LandRef(), id: property_info.id)), create: (context) => LandClassificationBloc()
// ), ..add(LoadLandClassification())),
// BlocProvider( BlocProvider(
// create: (context) => GeneralDescriptionBloc() create: (context) => LandSubClassificationBloc()
// ..add(LoadGenDesc( ..add(LoadLandSubClassification(
// gendesc: GeneralDesc(), id: property_info.id)), cityCode: "1", classCode: 1))),
// ), BlocProvider(
// BlocProvider( create: (context) => OtherImprovementsBloc()
// create: (context) => AdditionalItemsEditBloc() ..add(LoadOtherImprovementEdit(
// ..add(LoadAdditionalItemsEdit( other_imps: const <OtherImprovements>[],
// items: const <AdditionalItems>[], ids: property_info.id!))),
// id: property_info.id)), BlocProvider(
// ), create: (context) =>
// BlocProvider( TypeOfLocationBloc()..add(LoadTypeOfLocation())),
// create: (context) => PropertyAssessmentEditBloc() BlocProvider(
// ..add(LoadPropertyAssessmentEdit( create: (context) =>
// assessmentsEdit: PropertyAssessmentEdit(), TypeOfRoadBloc()..add(LoadTypeOfRoad())),
// id: property_info.id)), BlocProvider(
// ), create: (context) => LandPropertyAssessmentBloc()
// BlocProvider( ..add(LoadLandPropertyAssessmentEdit(
// create: (context) => PropertyAppraisalEditBloc() assessment: <LandPropertyAssessment>[],
// ..add(LoadPropertyAppraisalEdit( id: property_info.id!))),
// appraisalEdit: PropertyAppraisalEdit(), BlocProvider(
// id: property_info.id)), create: (context) => LandTreesImprovementsBloc()
// ), ..add(LoadLandTreesImprovements())),
// BlocProvider( BlocProvider(
// create: (context) => create: (context) => LandExtBloc()..add(LoadLandExt())),
// MunicipalityBloc()..add(LoadMunicipality())), BlocProvider(
// BlocProvider( create: (context) => LandValueAdjustmentsBloc()
// create: (context) => ..add(LoadLandValueAdjustmentsEdit(
// BarangayBloc()..add(LoadBarangay(id: '01'))), val_adj: <ValueAdjustments>[],
// BlocProvider( id: property_info.id!))),
// create: (context) => MemorandaBloc()..add(LoadMemoranda())), BlocProvider(
// BlocProvider( create: (context) =>
// create: (context) => StructuralMaterialBloc() SignatoriesBloc()..add(LoadSignatories())),
// ..add(LoadStructuralMaterial( BlocProvider(
// structure: StructureMaterials(), create: (context) =>
// id: property_info.id))), MunicipalityBloc()..add(LoadMunicipality())),
// ], BlocProvider(
// child: EditBuilding( create: (context) =>
// index: index, BarangayBloc()..add(LoadBarangay(id: '01'))),
// faas: property_info, BlocProvider(
// title: 'Bldg & Structure Edit', create: (context) => MemorandaBloc()..add(LoadMemoranda())),
// ), ],
// ); child: EditLand(
// })); index: index,
faas: property_info,
title: 'Bldg & Structure Edit',
),
);
}));
}, },
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,

View File

@ -51,7 +51,7 @@ class _PassoDashBoard extends State<PassoDashBoard> {
child: const LandHome(), child: const LandHome(),
), ),
EmptyData( EmptyData(
message: "Development ongoing ...", message: "Sorry, this page is under construction.",
) )
], ],
), ),

View File

@ -90,7 +90,7 @@ class PropertyAppraisalServices {
http.Response response = await Request.instance http.Response response = await Request.instance
.getRequest(param: params, path: path, headers: headers); .getRequest(param: params, path: path, headers: headers);
print('Property_Apraisaledit'); print('Property_Apraisaledit');
print(response.statusCode); print(response.body);
if (response.statusCode == 200) { if (response.statusCode == 200) {
final jsonData = jsonDecode(response.body); final jsonData = jsonDecode(response.body);
final dataList = jsonData['data'] as List<dynamic>; final dataList = jsonData['data'] as List<dynamic>;

View File

@ -98,6 +98,7 @@ class PropertyAssessmentServices {
http.Response response = await Request.instance http.Response response = await Request.instance
.getRequest(param: params, path: path, headers: headers); .getRequest(param: params, path: path, headers: headers);
print('Assessment'); print('Assessment');
print(response.statusCode);
print(response.body); print(response.body);
if (response.statusCode == 200) { if (response.statusCode == 200) {
final jsonData = jsonDecode(response.body); final jsonData = jsonDecode(response.body);

View File

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

View File

@ -56,4 +56,57 @@ class LandBoundariesService {
} }
return response; return response;
} }
Future<http.Response?> updateEdit(LandPropertyBoundaries data, id) async {
String path = Url.instance.getLandPropertyBoundaries();
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
Map<String, String> params = {
"landappr_details_id": id.toString(),
};
http.Response? response;
try {
response = await Request.instance.putRequest(
path: path, body: data.toJson(), headers: headers, param: params);
} catch (e) {
log(e.toString());
}
return response;
}
Future<LandPropertyBoundaries> fetchEdit(tempID) async {
String path = Url.instance.getLandPropertyBoundaries();
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
Map<String, String> params = {
"landappr_details_id": tempID.toString(),
};
try {
http.Response response = await Request.instance
.getRequest(param: params, path: path, headers: headers);
print('LandBoundEdit');
print(response.body);
if (response.statusCode == 200) {
final jsonData = jsonDecode(response.body);
final dataList = jsonData['data'] as List<dynamic>;
final result = LandPropertyBoundaries.fromJson(
dataList[0] as Map<String, dynamic>);
return result;
} else {
print(response.reasonPhrase);
throw Exception(response.reasonPhrase);
}
} catch (e) {
throw e.toString();
}
}
} }

View File

@ -84,53 +84,55 @@ class LandExtServices {
return response; return response;
} }
// Future<LandExtEdit> fetchEdit(tempID) async { Future<http.Response?> updateEdit(LandExt data, id) async {
// http.Response response = await http.get(Uri.parse( String path = Url.instance.getLandExt();
// '$baseUrl${Url.instance.getLandExt()}?bldgappr_details_id=$tempID')); Map<String, String> headers = {
// print('Assessment'); 'Content-Type': 'application/json; charset=UTF-8',
// print(response.body); 'X-Client-Key': xClientKey,
// if (response.statusCode == 200) { 'X-Client-Secret': xClientKeySecret
// final jsonData = jsonDecode(response.body); };
// final dataList = jsonData['data'] as List<dynamic>; Map<String, String> params = {
// final result = "landappr_details_id": id.toString(),
// LandExtEdit.fromJson(dataList[0] as Map<String, dynamic>); };
http.Response? response;
// return result; try {
// } else { response = await Request.instance.putRequest(
// throw Exception(response.reasonPhrase); path: path, body: data.toJson(), headers: headers, param: params);
// } } catch (e) {
// } log(e.toString());
}
// Future<http.Response?> addEdit(LandExtEdit assessment) async { return response;
// http.Response? response; }
// try {
// response = await http.post( Future<LandExt> fetchEdit(tempID) async {
// Uri.parse("$baseUrl${Url.instance.getLandExt()}"), String path = Url.instance.getLandExt();
// headers: { Map<String, String> headers = {
// HttpHeaders.contentTypeHeader: "application/json", 'Content-Type': 'application/json; charset=UTF-8',
// }, 'X-Client-Key': xClientKey,
// body: jsonEncode(assessment.toJson())); 'X-Client-Secret': xClientKeySecret
// } catch (e) { };
// log(e.toString()); Map<String, String> params = {
// } "landappr_details_id": tempID.toString(),
// return response; };
// } try {
http.Response response = await Request.instance
// Future<http.Response?> updateEdit( .getRequest(param: params, path: path, headers: headers);
// LandExtEdit assessment, id) async {
// print(id); print('Landextedit');
// http.Response? response; print(response.body);
// try {
// response = await http.put(Uri.parse( if (response.statusCode == 200) {
// // ignore: unnecessary_brace_in_string_interps final jsonData = jsonDecode(response.body);
// "$baseUrl${Url.instance.getLandExt()}?bldgappr_details_id=${id}"), final dataList = jsonData['data'] as List<dynamic>;
// headers: { final result = LandExt.fromJson(dataList[0] as Map<String, dynamic>);
// HttpHeaders.contentTypeHeader: "application/json",
// }, return result;
// body: jsonEncode(assessment.toJson())); } else {
// } catch (e) { print(response.reasonPhrase);
// log(e.toString()); throw Exception(response.reasonPhrase);
// } }
// return response; } catch (e) {
// } throw e.toString();
}
}
} }

View File

@ -55,4 +55,57 @@ class LandLocationService {
} }
return response; return response;
} }
Future<http.Response?> updateEdit(LandPropertyLoc data, id) async {
String path = Url.instance.getLandPropertyLoc();
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
Map<String, String> params = {
"landappr_details_id": id.toString(),
};
http.Response? response;
try {
response = await Request.instance.putRequest(
path: path, body: data.toJson(), headers: headers, param: params);
} catch (e) {
log(e.toString());
}
return response;
}
Future<LandPropertyLoc> fetchEdit(tempID) async {
String path = Url.instance.getLandPropertyLoc();
Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret
};
Map<String, String> params = {
"landappr_details_id": tempID.toString(),
};
try {
http.Response response = await Request.instance
.getRequest(param: params, path: path, headers: headers);
print('LandLocEdit');
print(response.body);
if (response.statusCode == 200) {
final jsonData = jsonDecode(response.body);
final dataList = jsonData['data'] as List<dynamic>;
final result =
LandPropertyLoc.fromJson(dataList[0] as Map<String, dynamic>);
return result;
} else {
print(response.reasonPhrase);
throw Exception(response.reasonPhrase);
}
} catch (e) {
throw e.toString();
}
}
} }

View File

@ -24,11 +24,11 @@ class OtherImprovementServices {
'X-Client-Secret': xClientKeySecret 'X-Client-Secret': xClientKeySecret
}; };
Map<String, String> params = { Map<String, String> params = {
"landappr_details_id": tempID, "landappr_details_id": tempID.toString(),
}; };
try { try {
http.Response response = await Request.instance http.Response response = await Request.instance
.getRequest(param: {}, path: path, headers: headers); .getRequest(param: params, path: path, headers: headers);
if (response.statusCode == 200) { if (response.statusCode == 200) {
final List result = jsonDecode(response.body)['data']; final List result = jsonDecode(response.body)['data'];
@ -67,11 +67,11 @@ class OtherImprovementServices {
'X-Client-Secret': xClientKeySecret 'X-Client-Secret': xClientKeySecret
}; };
Map<String, String> params = { Map<String, String> params = {
"id": id, "id": id.toString(),
}; };
try { try {
http.Response response = await Request.instance http.Response response = await Request.instance
.deleteRequest(path: path, headers: headers, body: {}, param: {}); .deleteRequest(path: path, headers: headers, body: {}, param: params);
print(id); print(id);
if (response.statusCode == 200) { if (response.statusCode == 200) {
print(response.body); print(response.body);

View File

@ -52,4 +52,24 @@ class LandServices {
} }
return response; return response;
} }
Future<http.Response?> update(LandPropertyOwner data, 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(),
};
http.Response? response;
try {
response = await Request.instance.putRequest(
path: path, body: data.toJson(), headers: headers, param: params);
} catch (e) {
log(e.toString());
}
return response;
}
} }

View File

@ -25,11 +25,11 @@ class ValueAdjustmentsServices {
'X-Client-Secret': xClientKeySecret 'X-Client-Secret': xClientKeySecret
}; };
Map<String, String> params = { Map<String, String> params = {
"landappr_details_id": tempID, "landappr_details_id": tempID.toString(),
}; };
try { try {
http.Response response = await Request.instance http.Response response = await Request.instance
.getRequest(param: {}, path: path, headers: headers); .getRequest(param: params, path: path, headers: headers);
if (response.statusCode == 200) { if (response.statusCode == 200) {
final List result = jsonDecode(response.body)['data']; final List result = jsonDecode(response.body)['data'];
print(result); print(result);
@ -67,11 +67,11 @@ class ValueAdjustmentsServices {
'X-Client-Secret': xClientKeySecret 'X-Client-Secret': xClientKeySecret
}; };
Map<String, String> params = { Map<String, String> params = {
"id": id, "id": id.toString(),
}; };
try { try {
http.Response response = await Request.instance http.Response response = await Request.instance
.deleteRequest(path: path, headers: headers, body: {}, param: {}); .deleteRequest(path: path, headers: headers, body: {}, param: params);
print(id); print(id);
if (response.statusCode == 200) { if (response.statusCode == 200) {
print(response.body); print(response.body);

View File

@ -1,9 +1,4 @@
import 'dart:convert';
import 'package:unit2/model/passo/barangay.dart';
import 'package:unit2/model/passo/class_components.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:unit2/model/passo/memoranda.dart';
import 'package:unit2/utils/request.dart'; import 'package:unit2/utils/request.dart';
import 'package:unit2/utils/urls.dart'; import 'package:unit2/utils/urls.dart';
@ -14,25 +9,16 @@ class MemorandaServices {
String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z"; String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z";
String xClientKeySecret = "unitcYqAN7GGalyz"; String xClientKeySecret = "unitcYqAN7GGalyz";
Future<List<Memoranda>> fetch() async { Future<http.Response> fetch() async {
String path = Url.instance.getMemoranda(); String path = Url.instance.getMemoranda();
Map<String, String> headers = { Map<String, String> headers = {
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',
'X-Client-Key': xClientKey, 'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret 'X-Client-Secret': xClientKeySecret
}; };
try {
http.Response response = await Request.instance http.Response response = await Request.instance
.getRequest(param: {}, path: path, headers: headers); .getRequest(param: {}, path: path, headers: headers);
if (response.statusCode == 200) { return response;
final List result = jsonDecode(response.body)['data'];
return result.map(((e) => Memoranda.fromJson(e))).toList();
} else {
throw Exception(response.reasonPhrase);
}
} catch (e) {
throw e.toString();
}
} }
} }

View File

@ -19,7 +19,7 @@ class SignatoriesServices {
'X-Client-Key': xClientKey, 'X-Client-Key': xClientKey,
'X-Client-Secret': xClientKeySecret 'X-Client-Secret': xClientKeySecret
}; };
try {
http.Response response = await Request.instance http.Response response = await Request.instance
.getRequest(param: {}, path: path, headers: headers); .getRequest(param: {}, path: path, headers: headers);
@ -33,8 +33,5 @@ class SignatoriesServices {
print(response.reasonPhrase); print(response.reasonPhrase);
throw Exception(response.reasonPhrase); throw Exception(response.reasonPhrase);
} }
} catch (e) {
throw e.toString();
}
} }
} }

View File

@ -5,12 +5,13 @@ 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";
} }
String prefixHost() { String prefixHost() {

View File

@ -77,10 +77,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: async name: async
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.11.0" version: "2.10.0"
audioplayers: audioplayers:
dependency: "direct main" dependency: "direct main"
description: description:
@ -285,10 +285,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: characters name: characters
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.3.0" version: "1.2.1"
checked_yaml: checked_yaml:
dependency: transitive dependency: transitive
description: description:
@ -317,10 +317,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.17.2" version: "1.17.0"
convert: convert:
dependency: transitive dependency: transitive
description: description:
@ -873,26 +873,26 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: matcher name: matcher
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.12.16" version: "0.12.13"
material_color_utilities: material_color_utilities:
dependency: transitive dependency: transitive
description: description:
name: material_color_utilities name: material_color_utilities
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.5.0" version: "0.2.0"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.9.1" version: "1.8.0"
mime: mime:
dependency: transitive dependency: transitive
description: description:
@ -993,10 +993,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: path name: path
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.8.3" version: "1.8.2"
path_drawing: path_drawing:
dependency: transitive dependency: transitive
description: description:
@ -1422,10 +1422,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: source_span name: source_span
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.10.0" version: "1.9.1"
sqflite: sqflite:
dependency: transitive dependency: transitive
description: description:
@ -1566,10 +1566,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.6.0" version: "0.4.16"
timing: timing:
dependency: transitive dependency: transitive
description: description:
@ -1682,14 +1682,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.2" version: "1.0.2"
web:
dependency: transitive
description:
name: web
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
url: "https://pub.dev"
source: hosted
version: "0.1.4-beta"
web_socket_channel: web_socket_channel:
dependency: transitive dependency: transitive
description: description:
@ -1731,5 +1723,5 @@ packages:
source: hosted source: hosted
version: "3.1.2" version: "3.1.2"
sdks: sdks:
dart: ">=3.1.0-185.0.dev <4.0.0" dart: ">2.19.0 <3.0.0"
flutter: ">=3.7.0" flutter: ">=3.7.0"

View File

@ -98,7 +98,6 @@ dependencies:
url_launcher_android: ^6.0.38 url_launcher_android: ^6.0.38
share_plus: ^7.1.0 share_plus: ^7.1.0
animated_splash_screen: ^1.3.0 animated_splash_screen: ^1.3.0
dependency_overrides: dependency_overrides:
intl: ^0.18.0 intl: ^0.18.0