Skip to content

Commit 9834c80

Browse files
committed
up
1 parent 2d3ba65 commit 9834c80

22 files changed

+1197
-696
lines changed

android/app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
1010
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
1111
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
12+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
13+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
1214
<uses-feature android:name="android.hardware.camera" />
1315
<!-- <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /> -->
1416
<application

lib/models/Room.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class RoomsToPropertyModel {
8484
flooring: json["flooring"],
8585
balcony: json["balcony"],
8686
wardrobe: json["wardrobe"],
87-
facility: json["facility"] == "" ? "84" : json["facility"],
87+
facility: json["facility"],
8888
);
8989

9090
Map<String, dynamic> toJson() => {

lib/models/Subroom.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class SubRoomElement {
7272
subRoomId: json["sub_room_id"],
7373
roomSize1: double.parse(json["room_size1"].toString()),
7474
roomSize2: double.parse(json["room_size2"].toString()),
75-
facility: json["facility"] == "" ? "84" : json["facility"],
75+
facility: json["facility"],
7676
);
7777

7878
Map<String, dynamic> toJson() => {

lib/services/subRoomService.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class SubRoomService extends AuthService {
1010
AuthService.BASE_URI + 'api/subroom/create',
1111
method: 'POST',
1212
body: payload);
13+
print(response.body);
1314
if (response.statusCode == 200)
1415
return true;
1516
else

lib/views/Admin/Inspection/FullInspection/fullInspectionScreen.dart

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,34 @@ class _FullInspectionScreenState extends State<FullInspectionScreen> {
175175
bool saveLoader = false;
176176
bool showSummary = false;
177177

178+
saveData() async {
179+
setState(() {
180+
saveLoader = true;
181+
});
182+
var fullInspectionCacheData = json.encode({
183+
"rows": rows,
184+
"newBillAmounts": newBillAmounts,
185+
"issueTableList": issueTableList,
186+
"summary": _summaryController.text,
187+
}).toString();
188+
bool success = await prefs.setString(
189+
"full-${propertyElement.tableproperty.propertyId}",
190+
fullInspectionCacheData);
191+
if (success) {
192+
showInSnackBar(context, "Full Inspection Saved", 1600);
193+
} else {
194+
showInSnackBar(context, "Error Saving Full Inspection", 1600);
195+
}
196+
setState(() {
197+
saveLoader = false;
198+
});
199+
}
200+
178201
@override
179202
Widget build(BuildContext context) {
180203
return WillPopScope(
181204
onWillPop: () async {
205+
await saveData();
182206
Navigator.of(context).pop();
183207
Navigator.of(context).pop();
184208
return true;
@@ -200,26 +224,7 @@ class _FullInspectionScreenState extends State<FullInspectionScreen> {
200224
color: Color(0xff314b8c),
201225
),
202226
onPressed: () async {
203-
setState(() {
204-
saveLoader = true;
205-
});
206-
var fullInspectionCacheData = json.encode({
207-
"rows": rows,
208-
"newBillAmounts": newBillAmounts,
209-
"issueTableList": issueTableList,
210-
"summary": _summaryController.text,
211-
}).toString();
212-
bool success = await prefs.setString(
213-
"full-${propertyElement.tableproperty.propertyId}",
214-
fullInspectionCacheData);
215-
if (success) {
216-
showInSnackBar(context, "Full Inspection Saved", 1600);
217-
} else {
218-
showInSnackBar(context, "Error Saving Full Inspection", 1600);
219-
}
220-
setState(() {
221-
saveLoader = false;
222-
});
227+
await saveData();
223228
Navigator.of(context).pop();
224229
Navigator.of(context).pop();
225230
},
@@ -262,7 +267,7 @@ class _FullInspectionScreenState extends State<FullInspectionScreen> {
262267
padding: EdgeInsets.symmetric(
263268
horizontal: 8, vertical: 4),
264269
child: Text(
265-
"Pending Bills",
270+
"Pending Bills (${bills.length})",
266271
style: Theme.of(context)
267272
.primaryTextTheme
268273
.headline6
@@ -618,6 +623,7 @@ class _FullInspectionScreenState extends State<FullInspectionScreen> {
618623
height: 55,
619624
color: Color(0xff314B8C),
620625
onPressed: () async {
626+
await saveData();
621627
int checkerA = 0;
622628
FocusScope.of(context).unfocus();
623629
for (int i = 0; i < issueTableList.length; i++) {
@@ -1016,6 +1022,7 @@ class _FullInspectionScreenState extends State<FullInspectionScreen> {
10161022
}
10171023

10181024
showRoomSelect() {
1025+
FocusScope.of(context).unfocus();
10191026
roomsAvailable.clear();
10201027
roomsAvailable.addAll(roomsAvailable2);
10211028
issueTableList.forEach((elementx) {

lib/views/Admin/Inspection/IssueBaseInspection/issueInspectionScreen.dart

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,33 @@ class _IssueInspectionScreenState extends State<IssueInspectionScreen> {
141141
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
142142
bool saveLoader = false;
143143
bool showSummary = false;
144+
saveData() async {
145+
setState(() {
146+
saveLoader = true;
147+
});
148+
var fullInspectionCacheData = json.encode({
149+
"rows": rows,
150+
"issueTableList": issueTableList,
151+
"summary": _summaryController.text,
152+
}).toString();
153+
bool success = await prefs.setString(
154+
"issue-${propertyElement.tableproperty.propertyId}",
155+
fullInspectionCacheData);
156+
if (success) {
157+
showInSnackBar(context, "Issue Inspection Saved", 1600);
158+
} else {
159+
showInSnackBar(context, "Error Saving Issue Inspection", 1600);
160+
}
161+
setState(() {
162+
saveLoader = false;
163+
});
164+
}
144165

145166
@override
146167
Widget build(BuildContext context) {
147168
return WillPopScope(
148169
onWillPop: () async {
170+
await saveData();
149171
Navigator.of(context).pop();
150172
Navigator.of(context).pop();
151173
return true;
@@ -168,26 +190,7 @@ class _IssueInspectionScreenState extends State<IssueInspectionScreen> {
168190
color: Color(0xff314b8c),
169191
),
170192
onPressed: () async {
171-
setState(() {
172-
saveLoader = true;
173-
});
174-
var fullInspectionCacheData = json.encode({
175-
"rows": rows,
176-
"issueTableList": issueTableList,
177-
"summary": _summaryController.text,
178-
}).toString();
179-
bool success = await prefs.setString(
180-
"issue-${propertyElement.tableproperty.propertyId}",
181-
fullInspectionCacheData);
182-
if (success) {
183-
showInSnackBar(context, "Issue Inspection Saved", 1600);
184-
} else {
185-
showInSnackBar(
186-
context, "Error Saving Issue Inspection", 1600);
187-
}
188-
setState(() {
189-
saveLoader = false;
190-
});
193+
await saveData();
191194
Navigator.of(context).pop();
192195
Navigator.of(context).pop();
193196
},
@@ -373,6 +376,7 @@ class _IssueInspectionScreenState extends State<IssueInspectionScreen> {
373376
height: 55,
374377
color: Color(0xff314B8C),
375378
onPressed: () async {
379+
await saveData();
376380
int checkerA = 0;
377381
FocusScope.of(context).unfocus();
378382
for (int i = 0; i < issueTableList.length; i++) {
@@ -712,6 +716,7 @@ class _IssueInspectionScreenState extends State<IssueInspectionScreen> {
712716
}
713717

714718
showRoomSelect() {
719+
FocusScope.of(context).unfocus();
715720
roomsAvailable.clear();
716721
roomsAvailable.addAll(roomsAvailable2);
717722
issueTableList.forEach((elementx) {

lib/views/Admin/Inspection/MoveInInspection/moveInInspectionScreen.dart

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,34 @@ class _MoveInInspectionScreenState extends State<MoveInInspectionScreen> {
229229
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
230230
bool saveLoader = false;
231231
bool showSummary = false;
232+
saveData() async {
233+
setState(() {
234+
saveLoader = true;
235+
});
236+
var fullInspectionCacheData = json.encode({
237+
"newBillAmounts": newBillAmounts,
238+
"rows": rows,
239+
"issueTableList": issueTableList,
240+
"summary": _summaryController.text,
241+
}).toString();
242+
bool success = await prefs.setString(
243+
"movein-${propertyElement.tableproperty.propertyId}",
244+
fullInspectionCacheData);
245+
if (success) {
246+
showInSnackBar(context, "Move-In Inspection Saved", 1600);
247+
} else {
248+
showInSnackBar(context, "Error Saving Move-In Inspection", 1600);
249+
}
250+
setState(() {
251+
saveLoader = false;
252+
});
253+
}
232254

233255
@override
234256
Widget build(BuildContext context) {
235257
return WillPopScope(
236258
onWillPop: () async {
259+
await saveData();
237260
Navigator.of(context).pop();
238261
Navigator.of(context).pop();
239262
return true;
@@ -256,27 +279,7 @@ class _MoveInInspectionScreenState extends State<MoveInInspectionScreen> {
256279
color: Color(0xff314b8c),
257280
),
258281
onPressed: () async {
259-
setState(() {
260-
saveLoader = true;
261-
});
262-
var fullInspectionCacheData = json.encode({
263-
"newBillAmounts": newBillAmounts,
264-
"rows": rows,
265-
"issueTableList": issueTableList,
266-
"summary": _summaryController.text,
267-
}).toString();
268-
bool success = await prefs.setString(
269-
"movein-${propertyElement.tableproperty.propertyId}",
270-
fullInspectionCacheData);
271-
if (success) {
272-
showInSnackBar(context, "Move-In Inspection Saved", 1600);
273-
} else {
274-
showInSnackBar(
275-
context, "Error Saving Move-In Inspection", 1600);
276-
}
277-
setState(() {
278-
saveLoader = false;
279-
});
282+
await saveData();
280283
Navigator.of(context).pop();
281284
Navigator.of(context).pop();
282285
},
@@ -318,7 +321,7 @@ class _MoveInInspectionScreenState extends State<MoveInInspectionScreen> {
318321
padding: EdgeInsets.symmetric(
319322
horizontal: 8, vertical: 4),
320323
child: Text(
321-
"Pending Bills",
324+
"Pending Bills (${bills.length})",
322325
style: Theme.of(context)
323326
.primaryTextTheme
324327
.headline6
@@ -816,6 +819,7 @@ class _MoveInInspectionScreenState extends State<MoveInInspectionScreen> {
816819
}
817820

818821
showRoomSelect() {
822+
FocusScope.of(context).unfocus();
819823
roomsAvailable.clear();
820824
roomsAvailable.addAll(roomsAvailable2);
821825
issueTableList.forEach((elementx) {
@@ -1445,6 +1449,7 @@ class _MoveInInspectionScreenState extends State<MoveInInspectionScreen> {
14451449
height: 55,
14461450
color: Color(0xff314B8C),
14471451
onPressed: () async {
1452+
await saveData();
14481453
int checkerA = 0;
14491454
FocusScope.of(context).unfocus();
14501455
for (int i = 0; i < issueTableList.length; i++) {

0 commit comments

Comments
 (0)