Fixed minor bugs on adding land faas and editing land faas
parent
874f9653c0
commit
9fe152b793
|
@ -41,6 +41,8 @@ class AdditionalItemBloc
|
||||||
globalAdditionalItems.add(newAdditional);
|
globalAdditionalItems.add(newAdditional);
|
||||||
|
|
||||||
emit(AdditionalItemsLoaded(globalAdditionalItems));
|
emit(AdditionalItemsLoaded(globalAdditionalItems));
|
||||||
|
} else {
|
||||||
|
emit(AdditionalItemsErrorState('error'));
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(AdditionalItemsErrorState(e.toString()));
|
emit(AdditionalItemsErrorState(e.toString()));
|
||||||
|
|
|
@ -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()));
|
||||||
|
@ -30,11 +30,16 @@ class PropertyAppraisalBloc
|
||||||
try {
|
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');
|
||||||
|
print(tempID.getInt('tempid')! - 1);
|
||||||
|
print(event.appraisal.toJson());
|
||||||
|
print(response.body);
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
emit(ShowPropertyAppraisalSuccessAlertState());
|
emit(ShowPropertyAppraisalSuccessAlertState());
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
print('app error');
|
||||||
|
print(e.toString());
|
||||||
emit(ShowPropertyAppraisalErrorAlertState());
|
emit(ShowPropertyAppraisalErrorAlertState());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -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()));
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -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))!;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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));
|
||||||
|
// }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -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];
|
||||||
|
}
|
|
@ -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];
|
||||||
|
}
|
|
@ -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))!;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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))!;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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))!;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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,31 +45,32 @@ 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(
|
||||||
id: json["id"],
|
id: json["id"],
|
||||||
bldgapprDetailsId: json["bldgappr_details_id"],
|
bldgapprDetailsId: json["bldgappr_details_id"],
|
||||||
assessedById: json["assessed_by_id"],
|
assessedById: json["assessed_by_id"],
|
||||||
assessedByName: json["assessed_by_name"],
|
assessedByName: json["assessed_by_name"],
|
||||||
dateCreated: json["date_created"] == null
|
dateCreated: json["date_created"] == null
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json["date_created"]),
|
: DateTime.parse(json["date_created"]),
|
||||||
dateModified: json["date_modified"] == null
|
dateModified: json["date_modified"] == null
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json["date_modified"]),
|
: DateTime.parse(json["date_modified"]),
|
||||||
unitconstructCost: json["unitconstruct_cost"],
|
unitconstructCost: json["unitconstruct_cost"],
|
||||||
buildingCore: json["building_core"],
|
buildingCore: json["building_core"],
|
||||||
unitconstructSubtotal: json["unitconstruct_subtotal"],
|
unitconstructSubtotal: json["unitconstruct_subtotal"],
|
||||||
depreciationRate: json["depreciation_rate"],
|
depreciationRate: json["depreciation_rate"],
|
||||||
depreciationCost: json["depreciation_cost"],
|
depreciationCost: json["depreciation_cost"],
|
||||||
costAddItems: json["cost_add_items"],
|
costAddItems: json["cost_add_items"],
|
||||||
addItemsSubtotal: json["add_items_subtotal"],
|
addItemsSubtotal: json["add_items_subtotal"],
|
||||||
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
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,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) {
|
||||||
|
@ -75,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();
|
||||||
|
@ -82,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) {
|
||||||
|
@ -130,7 +114,7 @@ class _BldgLocationLandrefPage extends State<BldgLocationLandrefPage> {
|
||||||
borderRadius:
|
borderRadius:
|
||||||
BorderRadius.circular(5.0),
|
BorderRadius.circular(5.0),
|
||||||
),
|
),
|
||||||
child: Align(
|
child: const Align(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: Text(
|
child: Text(
|
||||||
"AGUSAN DEL NORTE",
|
"AGUSAN DEL NORTE",
|
||||||
|
@ -244,7 +228,7 @@ class _BldgLocationLandrefPage extends State<BldgLocationLandrefPage> {
|
||||||
child:
|
child:
|
||||||
customTextField("Area", "", 'area'))
|
customTextField("Area", "", 'area'))
|
||||||
]),
|
]),
|
||||||
SizedBox(
|
const SizedBox(
|
||||||
height: 50,
|
height: 50,
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
|
|
|
@ -231,17 +231,4 @@ class _GeneralDescriptionPage extends State<GeneralDescriptionPage> {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> _waitForAddPropertyInfoToComplete() async {
|
|
||||||
// Wait for the state change indicating completion
|
|
||||||
final propertyInfoState = context.read<PropertyInfoBloc>().state;
|
|
||||||
|
|
||||||
if (propertyInfoState is ShowGenDescErrorAlertState) {
|
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -46,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();
|
||||||
|
@ -64,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();
|
||||||
|
@ -82,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();
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -484,7 +484,15 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
|
||||||
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) {
|
||||||
|
@ -492,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: () {
|
||||||
|
@ -649,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
|
||||||
|
@ -723,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
|
||||||
|
@ -798,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
|
||||||
|
@ -1087,12 +1111,13 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
|
||||||
|
|
||||||
propertyAssessments.add(ass);
|
propertyAssessments.add(ass);
|
||||||
|
|
||||||
context.read<
|
context
|
||||||
PropertyAssessmentEditBloc>()
|
.read<
|
||||||
..add(UpdatePropertyAssessmentEdit(
|
PropertyAssessmentEditBloc>()
|
||||||
assessmentsEdit:
|
.add(UpdatePropertyAssessmentEdit(
|
||||||
propertyAssessments[
|
assessmentsEdit:
|
||||||
0]));
|
propertyAssessments[
|
||||||
|
0]));
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -1114,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(
|
||||||
|
|
|
@ -62,7 +62,19 @@ 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(
|
||||||
|
|
|
@ -79,20 +79,8 @@ class _EditLand extends State<EditLand> {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: FormBuilder(
|
child: Container(
|
||||||
key: landKey,
|
child: content(PrevBtn, NextBtn, onSAveAll),
|
||||||
|
|
||||||
// enabled: false,
|
|
||||||
onChanged: () {
|
|
||||||
landKey.currentState?.save();
|
|
||||||
|
|
||||||
print(landKey.currentState?.value.toString());
|
|
||||||
},
|
|
||||||
autovalidateMode: AutovalidateMode.disabled,
|
|
||||||
skipDisabled: true,
|
|
||||||
child: Container(
|
|
||||||
child: content(PrevBtn, NextBtn, onSAveAll),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -111,15 +99,16 @@ class _EditLand extends State<EditLand> {
|
||||||
case 1:
|
case 1:
|
||||||
return LandLocationAndBoundariesEdit(PrevBtn, NextBtn, widget.faas!);
|
return LandLocationAndBoundariesEdit(PrevBtn, NextBtn, widget.faas!);
|
||||||
case 2:
|
case 2:
|
||||||
return LandAppraisalEdit(PrevBtn, NextBtn);
|
return LandAppraisalEdit(PrevBtn, NextBtn, widget.faas.id!);
|
||||||
case 3:
|
case 3:
|
||||||
return OtherImprovementEditPage(PrevBtn, NextBtn);
|
return OtherImprovementEditPage(PrevBtn, NextBtn, widget.faas.id!);
|
||||||
case 4:
|
case 4:
|
||||||
return ValueAdjustmentEditPage(PrevBtn, NextBtn);
|
return ValueAdjustmentEditPage(PrevBtn, NextBtn, widget.faas.id!);
|
||||||
case 5:
|
case 5:
|
||||||
return LandPropertyAssessmentEditPage(PrevBtn, NextBtn);
|
return LandPropertyAssessmentEditPage(
|
||||||
|
PrevBtn, NextBtn, widget.faas.id!);
|
||||||
case 6:
|
case 6:
|
||||||
return LandSignatoriesEdit(onSAveAll);
|
return LandSignatoriesEdit(onSAveAll, widget.faas.id!);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return LandPropertyOwnerInfoEdit(NextBtn, widget.faas!);
|
return LandPropertyOwnerInfoEdit(NextBtn, widget.faas!);
|
||||||
|
|
|
@ -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();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -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();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -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();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,9 +1,12 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||||
|
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:unit2/bloc/passo/land/land_appraisal/land_appraisal_bloc.dart';
|
import 'package:unit2/bloc/passo/land/land_appraisal/land_appraisal_bloc.dart';
|
||||||
import 'package:unit2/model/passo/land_appr.dart';
|
import 'package:unit2/model/passo/land_appr.dart';
|
||||||
import 'package:unit2/screens/passo/Land/add_land/AddLandAppraisal.dart';
|
import 'package:unit2/screens/passo/Land/edit_land/AddLandAppraisalEdit.dart';
|
||||||
|
|
||||||
import 'package:unit2/utils/alerts.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';
|
||||||
|
@ -12,7 +15,8 @@ import 'package:unit2/widgets/passo/custom_button.dart';
|
||||||
class LandAppraisalEdit extends StatefulWidget {
|
class LandAppraisalEdit extends StatefulWidget {
|
||||||
Function PrevBtn;
|
Function PrevBtn;
|
||||||
Function NextBtn;
|
Function NextBtn;
|
||||||
LandAppraisalEdit(this.PrevBtn, this.NextBtn);
|
final int faasId;
|
||||||
|
LandAppraisalEdit(this.PrevBtn, this.NextBtn, this.faasId);
|
||||||
@override
|
@override
|
||||||
_LandAppraisalEdit createState() => _LandAppraisalEdit();
|
_LandAppraisalEdit createState() => _LandAppraisalEdit();
|
||||||
}
|
}
|
||||||
|
@ -32,231 +36,259 @@ class _LandAppraisalEdit extends State<LandAppraisalEdit> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocConsumer<LandAppraisalBloc, LandAppraisalState>(
|
return ProgressHUD(
|
||||||
listener: (context, state) {
|
padding: const EdgeInsets.all(24),
|
||||||
// TODO: implement listener
|
backgroundColor: Colors.black87,
|
||||||
}, builder: (context, state) {
|
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||||
final state = context.watch<LandAppraisalBloc>().state;
|
child: BlocConsumer<LandAppraisalBloc, LandAppraisalState>(
|
||||||
if (state is LandAppraisalLoaded) {
|
listener: (context, state) {
|
||||||
return Column(
|
if (state is LandAppraisalLoading) {
|
||||||
children: [
|
final progress = ProgressHUD.of(context);
|
||||||
Expanded(
|
progress!.showWithText("Please wait...");
|
||||||
child: SingleChildScrollView(
|
}
|
||||||
child: Padding(
|
if (state is LandAppraisalLoaded) {
|
||||||
padding: const EdgeInsets.all(15.0),
|
final progress = ProgressHUD.of(context);
|
||||||
child: Column(
|
progress?.dismiss();
|
||||||
children: [
|
}
|
||||||
Container(
|
if (state is LandAppraisalErrorState) {
|
||||||
margin: const EdgeInsets.only(
|
final progress = ProgressHUD.of(context);
|
||||||
left: 0, top: 20, right: 0, bottom: 10),
|
progress?.dismiss();
|
||||||
child: const Text('LAND APPRAISAL',
|
}
|
||||||
style: TextStyle(
|
}, builder: (context, state) {
|
||||||
fontWeight: FontWeight.bold, fontSize: 18),
|
final state = context.watch<LandAppraisalBloc>().state;
|
||||||
textAlign: TextAlign.left),
|
if (state is LandAppraisalLoaded) {
|
||||||
),
|
return Column(
|
||||||
Align(
|
children: [
|
||||||
alignment: Alignment.topRight,
|
Expanded(
|
||||||
child: ElevatedButton(
|
child: SingleChildScrollView(
|
||||||
style: ElevatedButton.styleFrom(
|
child: Padding(
|
||||||
backgroundColor: Colors.red,
|
padding: const EdgeInsets.all(15.0),
|
||||||
),
|
child: Column(
|
||||||
onPressed: () {
|
children: [
|
||||||
context
|
Container(
|
||||||
.read<LandAppraisalBloc>()
|
margin: const EdgeInsets.only(
|
||||||
.add(ShowLandAppraisal());
|
left: 0, top: 20, right: 0, bottom: 10),
|
||||||
},
|
child: const Text('LAND APPRAISAL',
|
||||||
child: Row(
|
style: TextStyle(
|
||||||
mainAxisSize: MainAxisSize.min,
|
fontWeight: FontWeight.bold, fontSize: 18),
|
||||||
children: [
|
textAlign: TextAlign.left),
|
||||||
const Text('ADD ITEM'), // <-- Text
|
),
|
||||||
const SizedBox(
|
Align(
|
||||||
width: 5,
|
alignment: Alignment.topRight,
|
||||||
),
|
child: ElevatedButton(
|
||||||
const Icon(
|
style: ElevatedButton.styleFrom(
|
||||||
// <-- Icon
|
backgroundColor: Colors.red,
|
||||||
Icons.add,
|
),
|
||||||
size: 24.0,
|
onPressed: () {
|
||||||
),
|
context
|
||||||
],
|
.read<LandAppraisalBloc>()
|
||||||
|
.add(ShowLandAppraisal());
|
||||||
|
},
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
const Text('ADD ITEM'), // <-- Text
|
||||||
|
const SizedBox(
|
||||||
|
width: 5,
|
||||||
|
),
|
||||||
|
const Icon(
|
||||||
|
// <-- Icon
|
||||||
|
Icons.add,
|
||||||
|
size: 24.0,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
child: DataTable(
|
||||||
|
// ignore: prefer_const_literals_to_create_immutables
|
||||||
|
columns: [
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('Classification'),
|
||||||
|
),
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('Sub-Classification'),
|
||||||
|
),
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('Area'),
|
||||||
|
),
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('Unit Value'),
|
||||||
|
),
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('Base MArket Value'),
|
||||||
|
),
|
||||||
|
const DataColumn(
|
||||||
|
label: Text('Action'),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
rows: state.land_appr.map((dataRow) {
|
||||||
|
return DataRow(
|
||||||
|
cells: [
|
||||||
|
DataCell(Text(dataRow.classification!)),
|
||||||
|
DataCell(Text(dataRow.subClass!)),
|
||||||
|
DataCell(Text(dataRow.area!)),
|
||||||
|
DataCell(Text(
|
||||||
|
((double.parse(dataRow.unitValue!)))
|
||||||
|
.toString())),
|
||||||
|
DataCell(Text(
|
||||||
|
((double.parse(dataRow.baseMarketval!)))
|
||||||
|
.toString())),
|
||||||
|
DataCell(Row(
|
||||||
|
children: [
|
||||||
|
InkWell(
|
||||||
|
child: Container(
|
||||||
|
height: 30,
|
||||||
|
width: 30,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.delete,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 20.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
deleteItem(dataRow.id!);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
child: Container(
|
||||||
|
height: 30,
|
||||||
|
width: 30,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.edit,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 20.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () {},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
))
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}).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();
|
||||||
|
}
|
||||||
|
;
|
||||||
|
},
|
||||||
),
|
),
|
||||||
SingleChildScrollView(
|
CustomButton(
|
||||||
scrollDirection: Axis.horizontal,
|
icon: const Icon(Icons.chevron_right_rounded,
|
||||||
child: DataTable(
|
color: Colors.white),
|
||||||
// ignore: prefer_const_literals_to_create_immutables
|
onPressed: () {
|
||||||
columns: [
|
{
|
||||||
const DataColumn(
|
widget.NextBtn();
|
||||||
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(
|
if (state is LandAppraisalDeletedState) {
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
if (state.success) {
|
||||||
// children: [
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
// Text(
|
successAlert(context, "Deletion Successful",
|
||||||
// 'Total',
|
"Extra item has been deleted successfully", () {
|
||||||
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
|
Navigator.of(context).pop();
|
||||||
// ),
|
context.read<LandAppraisalBloc>().add(LoadLandAppraisalEdit(
|
||||||
// Text(
|
land_appr: const <LandAppr>[], id: widget.faasId!));
|
||||||
// NumberFormat.currency(locale: 'en-PH', symbol: "₱")
|
});
|
||||||
// .format('1.0'),
|
});
|
||||||
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
|
}
|
||||||
// )
|
}
|
||||||
// ],
|
if (state is ShowAddLandAppraisalScreen) {
|
||||||
// ),
|
return ConstrainedBox(
|
||||||
// ),
|
constraints: const BoxConstraints(
|
||||||
Padding(
|
maxHeight: 700.0,
|
||||||
padding: const EdgeInsets.all(15.0),
|
),
|
||||||
child: Row(
|
child: AlertDialog(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
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: [
|
children: [
|
||||||
CustomButton(
|
Align(
|
||||||
icon: const Icon(Icons.chevron_left_rounded,
|
alignment: Alignment.topCenter,
|
||||||
color: Colors.white),
|
child: Container(
|
||||||
onPressed: () {
|
child: ConstrainedBox(
|
||||||
{
|
constraints: BoxConstraints(maxHeight: 500),
|
||||||
widget.PrevBtn();
|
child: Container(
|
||||||
}
|
child: AddLandAppraisalEditModal(widget.faasId),
|
||||||
;
|
),
|
||||||
},
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
CustomButton(
|
|
||||||
icon: const Icon(Icons.chevron_right_rounded,
|
|
||||||
color: Colors.white),
|
|
||||||
onPressed: () {
|
|
||||||
{
|
|
||||||
widget.NextBtn();
|
|
||||||
}
|
|
||||||
;
|
|
||||||
},
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
if (state is LandAppraisalDeletedState) {
|
|
||||||
if (state.success) {
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
successAlert(context, "Deletion Successful",
|
|
||||||
"Extra item has been deleted successfully", () {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
context.read<LandAppraisalBloc>().add(const LoadLandAppraisal());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
if (state is LandAppraisalErrorState) {
|
||||||
if (state is ShowAddLandAppraisalScreen) {
|
return SomethingWentWrong(
|
||||||
return ConstrainedBox(
|
message: onError,
|
||||||
constraints: BoxConstraints(
|
onpressed: () {
|
||||||
maxHeight: 700.0,
|
context.read<LandAppraisalBloc>().add(LoadLandAppraisalEdit(
|
||||||
),
|
land_appr: <LandAppr>[], id: widget.faasId!));
|
||||||
child: AlertDialog(
|
},
|
||||||
insetPadding: EdgeInsets.symmetric(
|
);
|
||||||
horizontal: 20.0,
|
}
|
||||||
vertical: 10.0,
|
return Container();
|
||||||
),
|
}),
|
||||||
title: Text(
|
);
|
||||||
'ADD LAND APPRAISAL',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
content: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Container(child: AddLandAppraisalModal()),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (state is LandAppraisalErrorState) {
|
|
||||||
return SomethingWentWrong(
|
|
||||||
message: onError,
|
|
||||||
onpressed: () {
|
|
||||||
context.read<LandAppraisalBloc>().add(LoadLandAppraisal());
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return Container();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,9 @@ 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:unit2/bloc/passo/land/land_boundaries_edit/land_boundaries_edit_bloc.dart';
|
import 'package:unit2/bloc/passo/land/land_boundaries_edit/land_boundaries_edit_bloc.dart';
|
||||||
import 'package:unit2/bloc/passo/land/land_location_edit/land_location_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_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';
|
||||||
import 'package:unit2/model/passo/land_property_owner.dart';
|
import 'package:unit2/model/passo/land_property_owner.dart';
|
||||||
import 'package:unit2/screens/passo/Land/add_land.dart';
|
|
||||||
import 'package:unit2/screens/passo/Land/edit_land/property_owner_info_edit.dart';
|
import 'package:unit2/screens/passo/Land/edit_land/property_owner_info_edit.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';
|
||||||
|
@ -53,7 +51,7 @@ class _LandLocationAndBoundariesEdit
|
||||||
return BlocConsumer<LandBoundariesEditBloc,
|
return BlocConsumer<LandBoundariesEditBloc,
|
||||||
LandBoundariesEditState>(
|
LandBoundariesEditState>(
|
||||||
listener: (context, state) {
|
listener: (context, state) {
|
||||||
if (state is LandLocationEditLoaded) {
|
if (state is LandBoundariesEditLoaded) {
|
||||||
final progress = ProgressHUD.of(context);
|
final progress = ProgressHUD.of(context);
|
||||||
progress?.dismiss();
|
progress?.dismiss();
|
||||||
}
|
}
|
||||||
|
@ -70,7 +68,11 @@ class _LandLocationAndBoundariesEdit
|
||||||
'street': landLoc.street,
|
'street': landLoc.street,
|
||||||
'brgy': landLoc.barangay,
|
'brgy': landLoc.barangay,
|
||||||
'municipality': landLoc.municipality,
|
'municipality': landLoc.municipality,
|
||||||
'province': landLoc.province
|
'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,
|
enabled: true,
|
||||||
onChanged: () {
|
onChanged: () {
|
||||||
|
@ -169,7 +171,7 @@ class _LandLocationAndBoundariesEdit
|
||||||
child: customTextField(
|
child: customTextField(
|
||||||
"West", "", "west"))
|
"West", "", "west"))
|
||||||
]),
|
]),
|
||||||
SizedBox(
|
const SizedBox(
|
||||||
height: 50,
|
height: 50,
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
|
@ -212,16 +214,18 @@ class _LandLocationAndBoundariesEdit
|
||||||
?.value['province'],
|
?.value['province'],
|
||||||
);
|
);
|
||||||
|
|
||||||
context.read<LandLocationEditBloc>()
|
context
|
||||||
..add(UpdateLandLocationEdit(
|
.read<LandLocationEditBloc>()
|
||||||
land_loc_edit: location,
|
.add(UpdateLandLocationEdit(
|
||||||
id: widget.land.id!));
|
land_loc_edit: location,
|
||||||
|
id: widget.land.id!));
|
||||||
|
|
||||||
context.read<LandBoundariesEditBloc>()
|
context
|
||||||
..add(UpdateLandBoundariesEdit(
|
.read<LandBoundariesEditBloc>()
|
||||||
land_boundaries_edit:
|
.add(UpdateLandBoundariesEdit(
|
||||||
boundaries,
|
land_boundaries_edit:
|
||||||
id: widget.land.id!));
|
boundaries,
|
||||||
|
id: widget.land.id!));
|
||||||
|
|
||||||
widget.NextBtn();
|
widget.NextBtn();
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,14 +1,21 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||||
|
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||||
import 'package:unit2/bloc/passo/land/other_improvements/other_improvements_bloc.dart';
|
import 'package:unit2/bloc/passo/land/other_improvements/other_improvements_bloc.dart';
|
||||||
|
import 'package:unit2/model/passo/other_improvements.dart';
|
||||||
import 'package:unit2/screens/passo/Land/add_land/AddOtherImprovementModal.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/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 OtherImprovementEditPage extends StatefulWidget {
|
class OtherImprovementEditPage extends StatefulWidget {
|
||||||
Function PrevBtn;
|
Function PrevBtn;
|
||||||
Function NextBtn;
|
Function NextBtn;
|
||||||
OtherImprovementEditPage(this.PrevBtn, this.NextBtn);
|
final int faasId;
|
||||||
|
OtherImprovementEditPage(this.PrevBtn, this.NextBtn, this.faasId);
|
||||||
@override
|
@override
|
||||||
_OtherImprovementEditPage createState() => _OtherImprovementEditPage();
|
_OtherImprovementEditPage createState() => _OtherImprovementEditPage();
|
||||||
}
|
}
|
||||||
|
@ -30,234 +37,277 @@ class _OtherImprovementEditPage extends State<OtherImprovementEditPage> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocConsumer<OtherImprovementsBloc, OtherImprovementsState>(
|
return Scaffold(
|
||||||
listener: (context, state) {
|
body: ProgressHUD(
|
||||||
// TODO: implement listener
|
padding: const EdgeInsets.all(24),
|
||||||
}, builder: (context, state) {
|
backgroundColor: Colors.black87,
|
||||||
final state = context.watch<OtherImprovementsBloc>().state;
|
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||||
if (state is OtherImprovementLoaded) {
|
child: BlocConsumer<OtherImprovementsBloc, OtherImprovementsState>(
|
||||||
return Column(
|
listener: (context, state) {
|
||||||
children: [
|
if (state is OtherImprovementLoading) {
|
||||||
Expanded(
|
final progress = ProgressHUD.of(context);
|
||||||
child: SingleChildScrollView(
|
progress!.showWithText("Please wait...");
|
||||||
child: Padding(
|
}
|
||||||
padding: const EdgeInsets.all(15.0),
|
if (state is OtherImprovementLoaded) {
|
||||||
child: Column(
|
final progress = ProgressHUD.of(context);
|
||||||
children: [
|
progress?.dismiss();
|
||||||
Container(
|
}
|
||||||
margin: const EdgeInsets.only(
|
if (state is OtherImprovementErrorState) {
|
||||||
left: 0, top: 20, right: 0, bottom: 10),
|
final progress = ProgressHUD.of(context);
|
||||||
child: const Text('OTHER IMPROVEMENTS',
|
progress?.dismiss();
|
||||||
style: TextStyle(
|
}
|
||||||
fontWeight: FontWeight.bold, fontSize: 18),
|
}, builder: (context, state) {
|
||||||
textAlign: TextAlign.left),
|
final state = context.watch<OtherImprovementsBloc>().state;
|
||||||
),
|
if (state is OtherImprovementLoaded) {
|
||||||
Align(
|
return Column(
|
||||||
alignment: Alignment.topRight,
|
children: [
|
||||||
child: ElevatedButton(
|
Expanded(
|
||||||
style: ElevatedButton.styleFrom(
|
child: SingleChildScrollView(
|
||||||
backgroundColor: Colors.red,
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(15.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(
|
||||||
|
left: 0, top: 20, right: 0, bottom: 10),
|
||||||
|
child: const Text('OTHER IMPROVEMENTS',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold, fontSize: 18),
|
||||||
|
textAlign: TextAlign.left),
|
||||||
),
|
),
|
||||||
|
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: () {
|
onPressed: () {
|
||||||
context
|
{
|
||||||
.read<OtherImprovementsBloc>()
|
widget.PrevBtn();
|
||||||
.add(ShowOtherImprovement());
|
}
|
||||||
|
;
|
||||||
},
|
},
|
||||||
child: Row(
|
),
|
||||||
mainAxisSize: MainAxisSize.min,
|
CustomButton(
|
||||||
children: [
|
icon: const Icon(Icons.chevron_right_rounded,
|
||||||
const Text('ADD ITEM'), // <-- Text
|
color: Colors.white),
|
||||||
const SizedBox(
|
onPressed: () {
|
||||||
width: 5,
|
{
|
||||||
),
|
widget.NextBtn();
|
||||||
const Icon(
|
}
|
||||||
// <-- Icon
|
;
|
||||||
Icons.add,
|
},
|
||||||
size: 24.0,
|
)
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
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),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
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),
|
if (state is OtherImprovementErrorState) {
|
||||||
// child: Row(
|
return SomethingWentWrong(
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
message: onError,
|
||||||
// children: [
|
onpressed: () {
|
||||||
// Text(
|
context.read<OtherImprovementsBloc>().add(
|
||||||
// 'Total',
|
LoadOtherImprovementEdit(
|
||||||
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
|
other_imps: const <OtherImprovements>[],
|
||||||
// ),
|
ids: widget.faasId));
|
||||||
// Text(
|
},
|
||||||
// NumberFormat.currency(locale: 'en-PH', symbol: "₱")
|
);
|
||||||
// .format('1.0'),
|
}
|
||||||
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
|
return Container();
|
||||||
// )
|
}),
|
||||||
// ],
|
),
|
||||||
// ),
|
);
|
||||||
// ),
|
|
||||||
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: [Container(child: AddOtherImprovementModal())],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return Container();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,14 +1,22 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||||
|
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||||
|
import 'package:unit2/bloc/passo/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/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/add_land/AddPropertyAssessmentModal.dart';
|
||||||
|
import 'package:unit2/screens/passo/Land/edit_land/AddPropertyAssessmentEditModal.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 LandPropertyAssessmentEditPage extends StatefulWidget {
|
class LandPropertyAssessmentEditPage extends StatefulWidget {
|
||||||
Function PrevBtn;
|
Function PrevBtn;
|
||||||
Function NextBtn;
|
Function NextBtn;
|
||||||
LandPropertyAssessmentEditPage(this.PrevBtn, this.NextBtn);
|
final int faasId;
|
||||||
|
LandPropertyAssessmentEditPage(this.PrevBtn, this.NextBtn, this.faasId);
|
||||||
@override
|
@override
|
||||||
_LandPropertyAssessmentEditPage createState() =>
|
_LandPropertyAssessmentEditPage createState() =>
|
||||||
_LandPropertyAssessmentEditPage();
|
_LandPropertyAssessmentEditPage();
|
||||||
|
@ -32,214 +40,248 @@ class _LandPropertyAssessmentEditPage
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocConsumer<LandPropertyAssessmentBloc,
|
return Scaffold(
|
||||||
LandPropertyAssessmentState>(listener: (context, state) {
|
body: ProgressHUD(
|
||||||
// TODO: implement listener
|
padding: const EdgeInsets.all(24),
|
||||||
}, builder: (context, state) {
|
backgroundColor: Colors.black87,
|
||||||
final state = context.watch<LandPropertyAssessmentBloc>().state;
|
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||||
if (state is LandPropertyAssessmentLoaded) {
|
child: BlocConsumer<LandPropertyAssessmentBloc,
|
||||||
return Column(
|
LandPropertyAssessmentState>(listener: (context, state) {
|
||||||
children: [
|
if (state is LandPropertyAssessmentLoading) {
|
||||||
Expanded(
|
final progress = ProgressHUD.of(context);
|
||||||
child: SingleChildScrollView(
|
progress!.showWithText("Please wait...");
|
||||||
child: Padding(
|
}
|
||||||
padding: const EdgeInsets.all(15.0),
|
if (state is LandPropertyAssessmentLoaded) {
|
||||||
child: Column(
|
final progress = ProgressHUD.of(context);
|
||||||
|
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: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
margin: const EdgeInsets.only(
|
child: AddPropertyAssessmentEditModal(widget.faasId))
|
||||||
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),
|
if (state is LandPropertyAssessmentErrorState) {
|
||||||
// child: Row(
|
return SomethingWentWrong(
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
message: onError,
|
||||||
// children: [
|
onpressed: () {
|
||||||
// Text(
|
context.read<LandPropertyAssessmentBloc>().add(
|
||||||
// 'Total',
|
LoadLandPropertyAssessmentEdit(
|
||||||
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
|
assessment: const <LandPropertyAssessment>[],
|
||||||
// ),
|
id: widget.faasId));
|
||||||
// Text(
|
},
|
||||||
// NumberFormat.currency(locale: 'en-PH', symbol: "₱")
|
);
|
||||||
// .format('1.0'),
|
}
|
||||||
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
|
|
||||||
// )
|
return Container();
|
||||||
// ],
|
}),
|
||||||
// ),
|
),
|
||||||
// ),
|
);
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.all(15.0),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
children: [
|
|
||||||
CustomButton(
|
|
||||||
icon: const Icon(Icons.chevron_left_rounded,
|
|
||||||
color: Colors.white),
|
|
||||||
onPressed: () {
|
|
||||||
{
|
|
||||||
widget.PrevBtn();
|
|
||||||
}
|
|
||||||
;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
CustomButton(
|
|
||||||
icon: const Icon(Icons.chevron_right_rounded,
|
|
||||||
color: Colors.white),
|
|
||||||
onPressed: () {
|
|
||||||
{
|
|
||||||
widget.NextBtn();
|
|
||||||
}
|
|
||||||
;
|
|
||||||
},
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (state is LandPropertyAssessmentDeletedState) {
|
|
||||||
if (state.success) {
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
successAlert(context, "Deletion Successful",
|
|
||||||
"Extra item has been deleted successfully", () {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
context
|
|
||||||
.read<LandPropertyAssessmentBloc>()
|
|
||||||
.add(const LoadLandPropertyAssessment());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (state is ShowAddLandPropertyAssessmentScreen) {
|
|
||||||
return ConstrainedBox(
|
|
||||||
constraints: BoxConstraints(maxHeight: 1000.0),
|
|
||||||
child: AlertDialog(
|
|
||||||
insetPadding: EdgeInsets.symmetric(
|
|
||||||
horizontal: 20.0,
|
|
||||||
vertical: 10.0,
|
|
||||||
),
|
|
||||||
title: Text(
|
|
||||||
'ADD PROPERTY ASSESSMENT',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
content: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [Container(child: AddPropertyAssessmentModal())],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return Container();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,20 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||||
|
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||||
import 'package:unit2/bloc/passo/land/land_value_adjustments/land_value_adjustments_bloc.dart';
|
import 'package:unit2/bloc/passo/land/land_value_adjustments/land_value_adjustments_bloc.dart';
|
||||||
|
import 'package:unit2/model/passo/land_value_adjustment.dart';
|
||||||
import 'package:unit2/screens/passo/Land/add_land/AddLandValueAdjustmentModal.dart';
|
import 'package:unit2/screens/passo/Land/add_land/AddLandValueAdjustmentModal.dart';
|
||||||
import 'package:unit2/utils/alerts.dart';
|
import 'package:unit2/utils/alerts.dart';
|
||||||
|
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 ValueAdjustmentEditPage extends StatefulWidget {
|
class ValueAdjustmentEditPage extends StatefulWidget {
|
||||||
Function PrevBtn;
|
Function PrevBtn;
|
||||||
Function NextBtn;
|
Function NextBtn;
|
||||||
ValueAdjustmentEditPage(this.PrevBtn, this.NextBtn);
|
final int faasId;
|
||||||
|
ValueAdjustmentEditPage(this.PrevBtn, this.NextBtn, this.faasId);
|
||||||
@override
|
@override
|
||||||
_ValueAdjustmentEditPage createState() => _ValueAdjustmentEditPage();
|
_ValueAdjustmentEditPage createState() => _ValueAdjustmentEditPage();
|
||||||
}
|
}
|
||||||
|
@ -30,217 +36,248 @@ class _ValueAdjustmentEditPage extends State<ValueAdjustmentEditPage> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocConsumer<LandValueAdjustmentsBloc, LandValueAdjustmentsState>(
|
return Scaffold(
|
||||||
listener: (context, state) {
|
body: ProgressHUD(
|
||||||
// TODO: implement listener
|
padding: const EdgeInsets.all(24),
|
||||||
}, builder: (context, state) {
|
backgroundColor: Colors.black87,
|
||||||
final state = context.watch<LandValueAdjustmentsBloc>().state;
|
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||||
if (state is LandValueAdjustmentsLoaded) {
|
child:
|
||||||
return Column(
|
BlocConsumer<LandValueAdjustmentsBloc, LandValueAdjustmentsState>(
|
||||||
children: [
|
listener: (context, state) {
|
||||||
Expanded(
|
if (state is LandValueAdjustmentsLoading) {
|
||||||
child: SingleChildScrollView(
|
final progress = ProgressHUD.of(context);
|
||||||
child: Padding(
|
progress!.showWithText("Please wait...");
|
||||||
padding: const EdgeInsets.all(15.0),
|
}
|
||||||
child: Column(
|
if (state is LandValueAdjustmentsLoaded) {
|
||||||
children: [
|
final progress = ProgressHUD.of(context);
|
||||||
Container(
|
progress?.dismiss();
|
||||||
margin: const EdgeInsets.only(
|
}
|
||||||
left: 0, top: 20, right: 0, bottom: 10),
|
if (state is LandValueAdjustmentsErrorState) {
|
||||||
child: const Text('VALUE ADJUSTMENTS',
|
final progress = ProgressHUD.of(context);
|
||||||
style: TextStyle(
|
progress?.dismiss();
|
||||||
fontWeight: FontWeight.bold, fontSize: 18),
|
}
|
||||||
textAlign: TextAlign.left),
|
}, builder: (context, state) {
|
||||||
),
|
final state = context.watch<LandValueAdjustmentsBloc>().state;
|
||||||
Align(
|
if (state is LandValueAdjustmentsLoaded) {
|
||||||
alignment: Alignment.topRight,
|
return Column(
|
||||||
child: ElevatedButton(
|
children: [
|
||||||
style: ElevatedButton.styleFrom(
|
Expanded(
|
||||||
backgroundColor: Colors.red,
|
child: SingleChildScrollView(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(15.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(
|
||||||
|
left: 0, top: 20, right: 0, bottom: 10),
|
||||||
|
child: const Text('VALUE ADJUSTMENTS',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold, fontSize: 18),
|
||||||
|
textAlign: TextAlign.left),
|
||||||
),
|
),
|
||||||
onPressed: () {
|
Align(
|
||||||
context
|
alignment: Alignment.topRight,
|
||||||
.read<LandValueAdjustmentsBloc>()
|
child: ElevatedButton(
|
||||||
.add(ShowLandValueAdjustments());
|
style: ElevatedButton.styleFrom(
|
||||||
},
|
backgroundColor: Colors.red,
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
const Text('ADD ITEM'), // <-- Text
|
|
||||||
const SizedBox(
|
|
||||||
width: 5,
|
|
||||||
),
|
),
|
||||||
const Icon(
|
onPressed: () {
|
||||||
// <-- Icon
|
context
|
||||||
Icons.add,
|
.read<LandValueAdjustmentsBloc>()
|
||||||
size: 24.0,
|
.add(ShowLandValueAdjustments());
|
||||||
|
},
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
const Text('ADD ITEM'), // <-- Text
|
||||||
|
const SizedBox(
|
||||||
|
width: 5,
|
||||||
|
),
|
||||||
|
const Icon(
|
||||||
|
// <-- Icon
|
||||||
|
Icons.add,
|
||||||
|
size: 24.0,
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
SingleChildScrollView(
|
||||||
),
|
scrollDirection: Axis.horizontal,
|
||||||
SingleChildScrollView(
|
child: DataTable(
|
||||||
scrollDirection: Axis.horizontal,
|
// ignore: prefer_const_literals_to_create_immutables
|
||||||
child: DataTable(
|
columns: [
|
||||||
// ignore: prefer_const_literals_to_create_immutables
|
const DataColumn(
|
||||||
columns: [
|
label: Text('Base Market Value'),
|
||||||
const DataColumn(
|
),
|
||||||
label: Text('Base Market Value'),
|
const DataColumn(
|
||||||
),
|
label: Text('Adjustment Factors'),
|
||||||
const DataColumn(
|
),
|
||||||
label: Text('Adjustment Factors'),
|
const DataColumn(
|
||||||
),
|
label: Text('% Adjustment'),
|
||||||
const DataColumn(
|
),
|
||||||
label: Text('% Adjustment'),
|
const DataColumn(
|
||||||
),
|
label: Text('Value Adjustment'),
|
||||||
const DataColumn(
|
),
|
||||||
label: Text('Value Adjustment'),
|
const DataColumn(
|
||||||
),
|
label: Text('Market Value'),
|
||||||
const DataColumn(
|
),
|
||||||
label: Text('Market Value'),
|
const DataColumn(
|
||||||
),
|
label: Text('Action'),
|
||||||
const DataColumn(
|
)
|
||||||
label: Text('Action'),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
rows: state.val_adj.map((dataRow) {
|
|
||||||
return DataRow(
|
|
||||||
cells: [
|
|
||||||
DataCell(Text(dataRow.baseMarketval!)),
|
|
||||||
DataCell(Text(dataRow.adjustmentFactors!)),
|
|
||||||
DataCell(Text(dataRow.adjustment!)),
|
|
||||||
DataCell(Text(dataRow.valueAdjustment!)),
|
|
||||||
DataCell(Text(dataRow.marketValue!)),
|
|
||||||
DataCell(Row(
|
|
||||||
children: [
|
|
||||||
InkWell(
|
|
||||||
child: Container(
|
|
||||||
height: 30,
|
|
||||||
width: 30,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
color: Colors.red,
|
|
||||||
),
|
|
||||||
child: Icon(
|
|
||||||
Icons.delete,
|
|
||||||
color: Colors.white,
|
|
||||||
size: 20.0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
deleteItem(dataRow.id!);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: 10,
|
|
||||||
),
|
|
||||||
InkWell(
|
|
||||||
child: Container(
|
|
||||||
height: 30,
|
|
||||||
width: 30,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
color: Colors.red,
|
|
||||||
),
|
|
||||||
child: Icon(
|
|
||||||
Icons.edit,
|
|
||||||
color: Colors.white,
|
|
||||||
size: 20.0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onTap: () {},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
))
|
|
||||||
],
|
],
|
||||||
);
|
rows: state.val_adj.map((dataRow) {
|
||||||
}).toList()))
|
return DataRow(
|
||||||
],
|
cells: [
|
||||||
|
DataCell(Text(dataRow.baseMarketval!)),
|
||||||
|
DataCell(
|
||||||
|
Text(dataRow.adjustmentFactors!)),
|
||||||
|
DataCell(Text(dataRow.adjustment!)),
|
||||||
|
DataCell(Text(dataRow.valueAdjustment!)),
|
||||||
|
DataCell(Text(dataRow.marketValue!)),
|
||||||
|
DataCell(Row(
|
||||||
|
children: [
|
||||||
|
InkWell(
|
||||||
|
child: Container(
|
||||||
|
height: 30,
|
||||||
|
width: 30,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.delete,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 20.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
deleteItem(dataRow.id!);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
child: Container(
|
||||||
|
height: 30,
|
||||||
|
width: 30,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.edit,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 20.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () {},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
))
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}).toList()))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
// Padding(
|
||||||
|
// padding: const EdgeInsets.only(left: 20.0, right: 20.0),
|
||||||
|
// child: Row(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
// children: [
|
||||||
|
// Text(
|
||||||
|
// 'Total',
|
||||||
|
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
|
||||||
|
// ),
|
||||||
|
// Text(
|
||||||
|
// NumberFormat.currency(locale: 'en-PH', symbol: "₱")
|
||||||
|
// .format('1.0'),
|
||||||
|
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
|
||||||
|
// )
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(15.0),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: [
|
||||||
|
CustomButton(
|
||||||
|
icon: const Icon(Icons.chevron_left_rounded,
|
||||||
|
color: Colors.white),
|
||||||
|
onPressed: () {
|
||||||
|
{
|
||||||
|
widget.PrevBtn();
|
||||||
|
}
|
||||||
|
;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
CustomButton(
|
||||||
|
icon: const Icon(Icons.chevron_right_rounded,
|
||||||
|
color: Colors.white),
|
||||||
|
onPressed: () {
|
||||||
|
{
|
||||||
|
widget.NextBtn();
|
||||||
|
}
|
||||||
|
;
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (state is LandValueAdjustmentsDeletedState) {
|
||||||
|
if (state.success) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
successAlert(context, "Deletion Successful",
|
||||||
|
"Extra item has been deleted successfully", () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
context.read<LandValueAdjustmentsBloc>().add(
|
||||||
|
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())],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)),
|
);
|
||||||
// Padding(
|
}
|
||||||
// padding: const EdgeInsets.only(left: 20.0, right: 20.0),
|
if (state is LandValueAdjustmentsErrorState) {
|
||||||
// child: Row(
|
return SomethingWentWrong(
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
message: onError,
|
||||||
// children: [
|
onpressed: () {
|
||||||
// Text(
|
context.read<LandValueAdjustmentsBloc>().add(
|
||||||
// 'Total',
|
LoadLandValueAdjustmentsEdit(
|
||||||
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
|
val_adj: const <ValueAdjustments>[],
|
||||||
// ),
|
id: widget.faasId));
|
||||||
// Text(
|
},
|
||||||
// NumberFormat.currency(locale: 'en-PH', symbol: "₱")
|
);
|
||||||
// .format('1.0'),
|
}
|
||||||
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
|
return Container();
|
||||||
// )
|
}),
|
||||||
// ],
|
),
|
||||||
// ),
|
);
|
||||||
// ),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.all(15.0),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
children: [
|
|
||||||
CustomButton(
|
|
||||||
icon: const Icon(Icons.chevron_left_rounded,
|
|
||||||
color: Colors.white),
|
|
||||||
onPressed: () {
|
|
||||||
{
|
|
||||||
widget.PrevBtn();
|
|
||||||
}
|
|
||||||
;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
CustomButton(
|
|
||||||
icon: const Icon(Icons.chevron_right_rounded,
|
|
||||||
color: Colors.white),
|
|
||||||
onPressed: () {
|
|
||||||
{
|
|
||||||
widget.NextBtn();
|
|
||||||
}
|
|
||||||
;
|
|
||||||
},
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (state is LandValueAdjustmentsDeletedState) {
|
|
||||||
if (state.success) {
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
successAlert(context, "Deletion Successful",
|
|
||||||
"Extra item has been deleted successfully", () {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
context
|
|
||||||
.read<LandValueAdjustmentsBloc>()
|
|
||||||
.add(const LoadLandValueAdjustments());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (state is ShowAddLandValueAdjustmentsScreen) {
|
|
||||||
return ConstrainedBox(
|
|
||||||
constraints: BoxConstraints(maxHeight: 1000.0),
|
|
||||||
child: AlertDialog(
|
|
||||||
insetPadding: EdgeInsets.symmetric(
|
|
||||||
horizontal: 20.0,
|
|
||||||
vertical: 10.0,
|
|
||||||
),
|
|
||||||
title: Text(
|
|
||||||
'ADD VALUE ADJUSTMENTS',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
content: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [Expanded(child: AddLandValueAdjustmentModal())],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return Container();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import 'package:unit2/bloc/passo/land/land_appraisal/land_appraisal_bloc.dart';
|
||||||
import 'package:unit2/bloc/passo/land/land_boundaries_edit/land_boundaries_edit_bloc.dart';
|
import 'package:unit2/bloc/passo/land/land_boundaries_edit/land_boundaries_edit_bloc.dart';
|
||||||
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_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';
|
||||||
|
@ -39,10 +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_boundaries.dart';
|
||||||
import 'package:unit2/model/passo/land_property_loc.dart';
|
import 'package:unit2/model/passo/land_property_loc.dart';
|
||||||
import 'package:unit2/model/passo/land_property_owner.dart';
|
import 'package:unit2/model/passo/land_property_owner.dart';
|
||||||
import 'package:unit2/model/passo/land_ref.dart';
|
import 'package:unit2/model/passo/land_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';
|
||||||
|
@ -300,14 +306,20 @@ Card _listCard(LandPropertyOwner property_info, context, index) {
|
||||||
..add(LoadLandLocationEdit(
|
..add(LoadLandLocationEdit(
|
||||||
land_loc_edit: LandPropertyLoc(),
|
land_loc_edit: LandPropertyLoc(),
|
||||||
id: property_info.id))),
|
id: property_info.id))),
|
||||||
|
BlocProvider(
|
||||||
|
create: (context) => LandExtEditBloc()
|
||||||
|
..add(LoadLandExtEdit(
|
||||||
|
land_ext_edit: LandExt(), id: property_info.id))),
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
create: (context) => LandBoundariesEditBloc()
|
create: (context) => LandBoundariesEditBloc()
|
||||||
..add(LoadLandBoundariesEdit(
|
..add(LoadLandBoundariesEdit(
|
||||||
land_boundaries_edit: LandPropertyBoundaries(),
|
land_boundaries_edit: LandPropertyBoundaries(),
|
||||||
id: property_info.id))),
|
id: property_info.id))),
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
create: (context) =>
|
create: (context) => LandAppraisalBloc()
|
||||||
LandAppraisalBloc()..add(LoadLandAppraisal())),
|
..add(LoadLandAppraisalEdit(
|
||||||
|
land_appr: const <LandAppr>[],
|
||||||
|
id: property_info.id!))),
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
create: (context) => LandClassificationBloc()
|
create: (context) => LandClassificationBloc()
|
||||||
..add(LoadLandClassification())),
|
..add(LoadLandClassification())),
|
||||||
|
@ -316,8 +328,10 @@ Card _listCard(LandPropertyOwner property_info, context, index) {
|
||||||
..add(LoadLandSubClassification(
|
..add(LoadLandSubClassification(
|
||||||
cityCode: "1", classCode: 1))),
|
cityCode: "1", classCode: 1))),
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
create: (context) =>
|
create: (context) => OtherImprovementsBloc()
|
||||||
OtherImprovementsBloc()..add(LoadOtherImprovement())),
|
..add(LoadOtherImprovementEdit(
|
||||||
|
other_imps: const <OtherImprovements>[],
|
||||||
|
ids: property_info.id!))),
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
create: (context) =>
|
create: (context) =>
|
||||||
TypeOfLocationBloc()..add(LoadTypeOfLocation())),
|
TypeOfLocationBloc()..add(LoadTypeOfLocation())),
|
||||||
|
@ -326,7 +340,9 @@ Card _listCard(LandPropertyOwner property_info, context, index) {
|
||||||
TypeOfRoadBloc()..add(LoadTypeOfRoad())),
|
TypeOfRoadBloc()..add(LoadTypeOfRoad())),
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
create: (context) => LandPropertyAssessmentBloc()
|
create: (context) => LandPropertyAssessmentBloc()
|
||||||
..add(LoadLandPropertyAssessment())),
|
..add(LoadLandPropertyAssessmentEdit(
|
||||||
|
assessment: <LandPropertyAssessment>[],
|
||||||
|
id: property_info.id!))),
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
create: (context) => LandTreesImprovementsBloc()
|
create: (context) => LandTreesImprovementsBloc()
|
||||||
..add(LoadLandTreesImprovements())),
|
..add(LoadLandTreesImprovements())),
|
||||||
|
@ -334,7 +350,9 @@ Card _listCard(LandPropertyOwner property_info, context, index) {
|
||||||
create: (context) => LandExtBloc()..add(LoadLandExt())),
|
create: (context) => LandExtBloc()..add(LoadLandExt())),
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
create: (context) => LandValueAdjustmentsBloc()
|
create: (context) => LandValueAdjustmentsBloc()
|
||||||
..add(LoadLandValueAdjustments())),
|
..add(LoadLandValueAdjustmentsEdit(
|
||||||
|
val_adj: <ValueAdjustments>[],
|
||||||
|
id: property_info.id!))),
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
create: (context) =>
|
create: (context) =>
|
||||||
SignatoriesBloc()..add(LoadSignatories())),
|
SignatoriesBloc()..add(LoadSignatories())),
|
||||||
|
|
|
@ -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.",
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -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>;
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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;
|
||||||
|
try {
|
||||||
|
response = await Request.instance.putRequest(
|
||||||
|
path: path, body: data.toJson(), headers: headers, param: params);
|
||||||
|
} catch (e) {
|
||||||
|
log(e.toString());
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
// return result;
|
Future<LandExt> fetchEdit(tempID) async {
|
||||||
// } else {
|
String path = Url.instance.getLandExt();
|
||||||
// throw Exception(response.reasonPhrase);
|
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);
|
||||||
|
|
||||||
// Future<http.Response?> addEdit(LandExtEdit assessment) async {
|
print('Landextedit');
|
||||||
// http.Response? response;
|
print(response.body);
|
||||||
// try {
|
|
||||||
// response = await http.post(
|
|
||||||
// Uri.parse("$baseUrl${Url.instance.getLandExt()}"),
|
|
||||||
// headers: {
|
|
||||||
// HttpHeaders.contentTypeHeader: "application/json",
|
|
||||||
// },
|
|
||||||
// body: jsonEncode(assessment.toJson()));
|
|
||||||
// } catch (e) {
|
|
||||||
// log(e.toString());
|
|
||||||
// }
|
|
||||||
// return response;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Future<http.Response?> updateEdit(
|
if (response.statusCode == 200) {
|
||||||
// LandExtEdit assessment, id) async {
|
final jsonData = jsonDecode(response.body);
|
||||||
// print(id);
|
final dataList = jsonData['data'] as List<dynamic>;
|
||||||
// http.Response? response;
|
final result = LandExt.fromJson(dataList[0] as Map<String, dynamic>);
|
||||||
// try {
|
|
||||||
// response = await http.put(Uri.parse(
|
return result;
|
||||||
// // ignore: unnecessary_brace_in_string_interps
|
} else {
|
||||||
// "$baseUrl${Url.instance.getLandExt()}?bldgappr_details_id=${id}"),
|
print(response.reasonPhrase);
|
||||||
// headers: {
|
throw Exception(response.reasonPhrase);
|
||||||
// HttpHeaders.contentTypeHeader: "application/json",
|
}
|
||||||
// },
|
} catch (e) {
|
||||||
// body: jsonEncode(assessment.toJson()));
|
throw e.toString();
|
||||||
// } catch (e) {
|
}
|
||||||
// log(e.toString());
|
}
|
||||||
// }
|
|
||||||
// return response;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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
|
|
||||||
.getRequest(param: {}, path: path, headers: headers);
|
|
||||||
if (response.statusCode == 200) {
|
|
||||||
final List result = jsonDecode(response.body)['data'];
|
|
||||||
|
|
||||||
return result.map(((e) => Memoranda.fromJson(e))).toList();
|
http.Response response = await Request.instance
|
||||||
} else {
|
.getRequest(param: {}, path: path, headers: headers);
|
||||||
throw Exception(response.reasonPhrase);
|
return response;
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
throw e.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,22 +19,19 @@ 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
|
|
||||||
.getRequest(param: {}, path: path, headers: headers);
|
|
||||||
|
|
||||||
print('Signatories');
|
http.Response response = await Request.instance
|
||||||
print(response.statusCode);
|
.getRequest(param: {}, path: path, headers: headers);
|
||||||
if (response.statusCode == 200) {
|
|
||||||
final List result = jsonDecode(response.body)['data'];
|
|
||||||
|
|
||||||
return result.map(((e) => Signatories.fromJson(e))).toList();
|
print('Signatories');
|
||||||
} else {
|
print(response.statusCode);
|
||||||
print(response.reasonPhrase);
|
if (response.statusCode == 200) {
|
||||||
throw Exception(response.reasonPhrase);
|
final List result = jsonDecode(response.body)['data'];
|
||||||
}
|
|
||||||
} catch (e) {
|
return result.map(((e) => Signatories.fromJson(e))).toList();
|
||||||
throw e.toString();
|
} else {
|
||||||
|
print(response.reasonPhrase);
|
||||||
|
throw Exception(response.reasonPhrase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ dependencies:
|
||||||
url_launcher: ^6.1.11
|
url_launcher: ^6.1.11
|
||||||
url_launcher_android: ^6.0.38
|
url_launcher_android: ^6.0.38
|
||||||
share_plus: ^7.1.0
|
share_plus: ^7.1.0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
|
Loading…
Reference in New Issue