fixed conflict on pubspec.yaml

feature/passo/PASSO-#1-Sync-data-from-device-to-postgre-and-vice-versa
cyzoox 2023-10-03 09:16:28 +08:00
parent 337fb64bdf
commit d7324e34f1
13 changed files with 1113 additions and 997 deletions

View File

@ -42,7 +42,7 @@ class AdditionalItemBloc
emit(AdditionalItemsLoaded(globalAdditionalItems)); emit(AdditionalItemsLoaded(globalAdditionalItems));
} else { } else {
emit(AdditionalItemsErrorState('error')); emit(const AdditionalItemsErrorState('error'));
} }
} catch (e) { } catch (e) {
emit(AdditionalItemsErrorState(e.toString())); emit(AdditionalItemsErrorState(e.toString()));
@ -56,7 +56,7 @@ class AdditionalItemBloc
if (response.statusCode == 200) { if (response.statusCode == 200) {
globalAdditionalItems globalAdditionalItems
.removeWhere(((AdditionalItems element) => element.id == event.id)); .removeWhere(((AdditionalItems element) => element.id == event.id));
emit(AdditionalItemsDeletedState(success: true)); emit(const AdditionalItemsDeletedState(success: true));
} }
}); });

View File

@ -12,14 +12,14 @@ part 'property_appraisal_state.dart';
class PropertyAppraisalBloc class PropertyAppraisalBloc
extends Bloc<PropertyAppraisalEvent, PropertyAppraisalState> { extends Bloc<PropertyAppraisalEvent, PropertyAppraisalState> {
PropertyAppraisalBloc() : super(PropertyAppraisalInitial()) { PropertyAppraisalBloc() : super(PropertyAppraisalLoading()) {
List<PropertyAppraisal> globalPropertyAppraisal = []; List<PropertyAppraisal> globalPropertyAppraisal = [];
on<LoadPropertyAppraisal>((event, emit) async { on<LoadPropertyAppraisal>((event, emit) async {
emit(PropertyAppraisalLoading()); emit(PropertyAppraisalLoading());
try { try {
final appraisal = await PropertyAppraisalServices.instance.fetch(); // final appraisal = await PropertyAppraisalServices.instance.fetch();
print(appraisal); // print(appraisal);
emit(PropertyAppraisalLoaded(appraisal)); emit(PropertyAppraisalLoaded(PropertyAppraisal()));
} catch (e) { } catch (e) {
emit(PropertyAppraisalErrorState(e.toString())); emit(PropertyAppraisalErrorState(e.toString()));
} }

View File

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

View File

@ -580,8 +580,9 @@ class _PropertyAssessmentPage extends State<PropertyAssessmentPage> {
propertyAssessments.add(ass); propertyAssessments.add(ass);
context.read<PropertyAssessmentBloc>() context
..add(UpdatePropertyAssessment( .read<PropertyAssessmentBloc>()
.add(UpdatePropertyAssessment(
assessment: assessment:
propertyAssessments[0])); propertyAssessments[0]));
widget.function(); widget.function();

View File

@ -1129,10 +1129,30 @@ class _PropertyAssessmentEditPage extends State<PropertyAssessmentEditPage> {
), ),
); );
} }
if (state is MemorandaErrorState) {
return SomethingWentWrong(
message: state.error,
onpressed: () {
context
.read<MemorandaBloc>()
.add(const LoadMemoranda());
},
);
}
return Container(); return Container();
}, },
); );
} }
if (state is SignatoriesErrorState) {
return SomethingWentWrong(
message: state.error,
onpressed: () {
context
.read<SignatoriesBloc>()
.add(const LoadSignatories());
},
);
}
return Container(); return Container();
}, },
); );

View File

@ -1,6 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:unit2/bloc/passo/land/land_appraisal/land_appraisal_bloc.dart'; import 'package:unit2/bloc/passo/land/land_appraisal/land_appraisal_bloc.dart';
@ -105,7 +107,12 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BlocBuilder<LandValueAdjustmentsBloc, LandValueAdjustmentsState>( return Scaffold(
body: ProgressHUD(
padding: const EdgeInsets.all(24),
backgroundColor: Colors.black87,
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
child: BlocBuilder<LandValueAdjustmentsBloc, LandValueAdjustmentsState>(
buildWhen: (previous, current) { buildWhen: (previous, current) {
return false; return false;
}, builder: (context, state) { }, builder: (context, state) {
@ -123,7 +130,8 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
builder: (context, state) { builder: (context, state) {
if (state is TypeOfRoadLoaded) { if (state is TypeOfRoadLoaded) {
final roadType = state.road_type; final roadType = state.road_type;
return BlocConsumer<TypeOfLocationBloc, TypeOfLocationState>( return BlocConsumer<TypeOfLocationBloc,
TypeOfLocationState>(
listener: (context, state) { listener: (context, state) {
// TODO: implement listener // TODO: implement listener
}, },
@ -141,7 +149,8 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
child: SingleChildScrollView( child: SingleChildScrollView(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@ -154,12 +163,14 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
bottom: 0), bottom: 0),
child: Expanded( child: Expanded(
flex: 1, flex: 1,
child: child: FormBuilderDropdown<
FormBuilderDropdown<LandAppr?>( LandAppr?>(
name: 'land_appr_item', name: 'land_appr_item',
autofocus: false, autofocus: false,
decoration: normalTextFieldStyle( decoration:
"Land Appraisal Items", ""), normalTextFieldStyle(
"Land Appraisal Items",
""),
items: land_appr items: land_appr
.map((land_appr) => .map((land_appr) =>
DropdownMenuItem< DropdownMenuItem<
@ -170,8 +181,10 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
"")), "")),
)) ))
.toList(), .toList(),
onChanged: (selectedLandAppr) { onChanged:
if (selectedLandAppr != null) { (selectedLandAppr) {
if (selectedLandAppr !=
null) {
setState(() { setState(() {
_unitValue = double.parse( _unitValue = double.parse(
selectedLandAppr selectedLandAppr
@ -197,7 +210,8 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
TypeOfRoad?>( TypeOfRoad?>(
name: 'road_type', name: 'road_type',
autofocus: false, autofocus: false,
decoration: normalTextFieldStyle( decoration:
normalTextFieldStyle(
"Type of Road", ""), "Type of Road", ""),
items: roadType items: roadType
.map((roadType) => .map((roadType) =>
@ -216,8 +230,8 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
double.parse( double.parse(
selectedRoad selectedRoad
.deduction!); .deduction!);
_roadType = _roadType = selectedRoad
selectedRoad.roadType!; .roadType!;
}); });
} }
}, },
@ -239,8 +253,10 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
TypeOfLocation?>( TypeOfLocation?>(
name: 'loc_type_road', name: 'loc_type_road',
autofocus: false, autofocus: false,
decoration: normalTextFieldStyle( decoration:
"Distance to Road", ""), normalTextFieldStyle(
"Distance to Road",
""),
items: state.loc_type items: state.loc_type
.map((locTypeRoad) => .map((locTypeRoad) =>
DropdownMenuItem< DropdownMenuItem<
@ -251,11 +267,13 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
"")), "")),
)) ))
.toList(), .toList(),
onChanged: (selectedLoadRoad) { onChanged:
if (selectedLoadRoad != null) { (selectedLoadRoad) {
if (selectedLoadRoad !=
null) {
setState(() { setState(() {
_locTypeRoad = double.parse( _locTypeRoad = double
selectedLoadRoad .parse(selectedLoadRoad
.allRoadTypes!); .allRoadTypes!);
_locRdDistance = _locRdDistance =
selectedLoadRoad selectedLoadRoad
@ -277,8 +295,10 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
TypeOfLocation?>( TypeOfLocation?>(
name: 'loc_type_pob', name: 'loc_type_pob',
autofocus: false, autofocus: false,
decoration: normalTextFieldStyle( decoration:
"Distance to Poblacion", ""), normalTextFieldStyle(
"Distance to Poblacion",
""),
items: state.loc_type items: state.loc_type
.map((locTypePob) => .map((locTypePob) =>
DropdownMenuItem< DropdownMenuItem<
@ -290,10 +310,11 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
)) ))
.toList(), .toList(),
onChanged: (selectedLocPob) { onChanged: (selectedLocPob) {
if (selectedLocPob != null) { if (selectedLocPob !=
null) {
setState(() { setState(() {
_locTypePob = double.parse( _locTypePob = double
selectedLocPob .parse(selectedLocPob
.localTradingCenter!); .localTradingCenter!);
_locPobDistance = _locPobDistance =
@ -343,7 +364,8 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
child: Text(NumberFormat.currency( child: Text(NumberFormat.currency(
locale: 'en-PH', locale: 'en-PH',
symbol: "", symbol: "",
).format(calculateValueAdjustment())), ).format(
calculateValueAdjustment())),
), ),
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
@ -373,21 +395,24 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
Container( Container(
width: 120, width: 120,
height: 60, height: 60,
padding: const EdgeInsets.all(8.0), padding:
const EdgeInsets.all(8.0),
child: ElevatedButton( child: ElevatedButton(
onPressed: () async { onPressed: () async {
final tempID = final tempID =
await SharedPreferences await SharedPreferences
.getInstance(); .getInstance();
print(tempID.getInt('landid')); print(tempID
.getInt('landid'));
var adjustments = ValueAdjustments( var adjustments = ValueAdjustments(
landapprDetailsId: tempID landapprDetailsId:
.getInt('landid')! - tempID.getInt(
'landid')! -
1, 1,
baseMarketval: baseMarketval:
_unitValue.toString(), _unitValue
adjustmentFactors: .toString(),
_roadType + adjustmentFactors: _roadType +
' , ' + ' , ' +
_locPobDistance + _locPobDistance +
' km from road , ' + ' km from road , ' +
@ -406,12 +431,12 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
context context
.read< .read<
LandValueAdjustmentsBloc>() LandValueAdjustmentsBloc>()
.add( .add(AddLandValueAdjustments(
AddLandValueAdjustments(
val_adj: val_adj:
adjustments)); adjustments));
}, },
style: ElevatedButton.styleFrom( style:
ElevatedButton.styleFrom(
primary: Colors.black, primary: Colors.black,
), ),
child: const Text("Submit"), child: const Text("Submit"),
@ -423,7 +448,8 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
Container( Container(
width: 120, width: 120,
height: 60, height: 60,
padding: const EdgeInsets.all(8.0), padding:
const EdgeInsets.all(8.0),
child: ElevatedButton( child: ElevatedButton(
onPressed: () { onPressed: () {
context context
@ -432,7 +458,8 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
.add( .add(
const LoadLandValueAdjustments()); const LoadLandValueAdjustments());
}, },
style: ElevatedButton.styleFrom( style:
ElevatedButton.styleFrom(
primary: Colors.black, primary: Colors.black,
), ),
child: const Text("Cancel"), child: const Text("Cancel"),
@ -493,6 +520,8 @@ class _AddLandValueAdjustmentModal extends State<AddLandValueAdjustmentModal> {
return Container( return Container(
child: Text("Land Value Adjustment"), child: Text("Land Value Adjustment"),
); );
}); }),
),
);
} }
} }

View File

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

View File

@ -16,14 +16,6 @@ class ValueAdjustmentPage extends StatefulWidget {
} }
class _ValueAdjustmentPage extends State<ValueAdjustmentPage> { class _ValueAdjustmentPage extends State<ValueAdjustmentPage> {
// double _totalMarketValue(items) {
// double total = 0;
// items.forEach((row) {
// total += double.parse(row);
// });
// return total;
// }
void deleteItem(int itemId) { void deleteItem(int itemId) {
context context
.read<LandValueAdjustmentsBloc>() .read<LandValueAdjustmentsBloc>()

View File

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

View File

@ -266,13 +266,11 @@ class _LandAppraisalEdit extends State<LandAppraisalEdit> {
alignment: Alignment.topCenter, alignment: Alignment.topCenter,
child: Container( child: Container(
child: ConstrainedBox( child: ConstrainedBox(
constraints: BoxConstraints(maxHeight: 500), constraints: const BoxConstraints(maxHeight: 500),
child: Container(
child: AddLandAppraisalEditModal(widget.faasId), child: AddLandAppraisalEditModal(widget.faasId),
), ),
), ),
), ),
),
], ],
), ),
), ),
@ -283,7 +281,7 @@ class _LandAppraisalEdit extends State<LandAppraisalEdit> {
message: onError, message: onError,
onpressed: () { onpressed: () {
context.read<LandAppraisalBloc>().add(LoadLandAppraisalEdit( context.read<LandAppraisalBloc>().add(LoadLandAppraisalEdit(
land_appr: <LandAppr>[], id: widget.faasId!)); land_appr: const <LandAppr>[], id: widget.faasId!));
}, },
); );
} }

View File

@ -53,6 +53,7 @@ import 'package:unit2/screens/passo/Test%20Envi/speed_dial.dart';
import 'package:unit2/theme-data.dart/colors.dart'; import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/global_context.dart'; import 'package:unit2/utils/global_context.dart';
import 'package:unit2/utils/text_container.dart'; import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/empty_data.dart';
import 'package:unit2/widgets/error_state.dart'; import 'package:unit2/widgets/error_state.dart';
import 'package:flutter_speed_dial/flutter_speed_dial.dart'; import 'package:flutter_speed_dial/flutter_speed_dial.dart';
@ -106,6 +107,7 @@ class BuildingHome extends StatelessWidget {
}, },
builder: (context, state) { builder: (context, state) {
if (state is PropertyInfoLoaded) { if (state is PropertyInfoLoaded) {
if (state.property_info.isNotEmpty) {
List<PropertyInfo> propertyList = state.property_info; List<PropertyInfo> propertyList = state.property_info;
return Container( return Container(
padding: const EdgeInsets.symmetric(horizontal: 12), padding: const EdgeInsets.symmetric(horizontal: 12),
@ -124,6 +126,11 @@ class BuildingHome extends StatelessWidget {
], ],
), ),
); );
} else {
return const EmptyData(
message:
"You don't have any building faas added. Please click + to add");
}
} }
if (state is PropertyInfoErrorState) { if (state is PropertyInfoErrorState) {
return SomethingWentWrong( return SomethingWentWrong(

View File

@ -47,6 +47,7 @@ import 'package:unit2/screens/passo/Land/edit_land.dart';
import 'package:unit2/theme-data.dart/colors.dart'; import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/alerts.dart'; import 'package:unit2/utils/alerts.dart';
import 'package:unit2/utils/text_container.dart'; import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/empty_data.dart';
import 'package:unit2/widgets/error_state.dart'; import 'package:unit2/widgets/error_state.dart';
import 'package:flutter_speed_dial/flutter_speed_dial.dart'; import 'package:flutter_speed_dial/flutter_speed_dial.dart';
@ -94,6 +95,7 @@ class LandHome extends StatelessWidget {
}, },
builder: (context, state) { builder: (context, state) {
if (state is LandLoaded) { if (state is LandLoaded) {
if (state.land.isNotEmpty) {
List<LandPropertyOwner> propertyList = state.land; List<LandPropertyOwner> propertyList = state.land;
return Container( return Container(
padding: const EdgeInsets.symmetric(horizontal: 12), padding: const EdgeInsets.symmetric(horizontal: 12),
@ -112,6 +114,11 @@ class LandHome extends StatelessWidget {
], ],
), ),
); );
} else {
return const EmptyData(
message:
"You don't have any land faas added. Please click + to add");
}
} }
if (state is LandErrorState) { if (state is LandErrorState) {
return SomethingWentWrong( return SomethingWentWrong(

View File

@ -99,6 +99,7 @@ dependencies:
share_plus: ^7.1.0 share_plus: ^7.1.0
animated_splash_screen: ^1.3.0 animated_splash_screen: ^1.3.0
sqflite: ^2.3.0 sqflite: ^2.3.0
dependency_overrides: dependency_overrides:
intl: ^0.18.0 intl: ^0.18.0