Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
UPSMF
uphrh-smf-mobile
Commits
43e617b2
Commit
43e617b2
authored
3 years ago
by
Shoaib
Browse files
Options
Download
Patches
Plain Diff
L2 completed.
parent
5e0a5296
master
add-assessor-location
deps-update
two-lead-assessor
No related merge requests found
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
lib/constants/app_constants.dart
+1
-0
lib/constants/app_constants.dart
lib/l10n/app_en.arb
+1
-0
lib/l10n/app_en.arb
lib/models/application_model.dart
+4
-0
lib/models/application_model.dart
lib/pages/application_details_page.dart
+48
-11
lib/pages/application_details_page.dart
lib/repositories/application_repository.dart
+1
-0
lib/repositories/application_repository.dart
lib/util/helper.dart
+13
-6
lib/util/helper.dart
lib/widgets/application_card.dart
+18
-1
lib/widgets/application_card.dart
lib/widgets/assistant_inspector_dialog.dart
+19
-3
lib/widgets/assistant_inspector_dialog.dart
with
105 additions
and
21 deletions
+105
-21
lib/constants/app_constants.dart
+
1
−
0
View file @
43e617b2
...
...
@@ -21,6 +21,7 @@ class InspectionStatus {
static
const
String
newInspection
=
'NEW'
;
static
const
String
sentForInspection
=
'SENTFORINS'
;
static
const
String
inspectionCompleted
=
'INSCOMPLETED'
;
static
const
String
leadInspectorCompleted
=
'LEADINSCOMPLETED'
;
static
const
String
inspectionPending
=
'PENDING'
;
static
const
String
returned
=
'RETURNED'
;
}
...
...
This diff is collapsed.
Click to expand it.
lib/l10n/app_en.arb
+
1
−
0
View file @
43e617b2
...
...
@@ -15,6 +15,7 @@
"next"
:
"Next"
,
"previous"
:
"previous"
,
"inspectionCompleted"
:
"Inspection completed"
,
"leadInspectorCompleted"
:
"Lead inspector completed"
,
"completed"
:
"Completed"
,
"sentForInspection"
:
"Sent for inspection"
,
"noApplications"
:
"No applications at the moment"
,
...
...
This diff is collapsed.
Click to expand it.
lib/models/application_model.dart
+
4
−
0
View file @
43e617b2
...
...
@@ -11,6 +11,7 @@ class Application {
final
List
leadInspector
;
final
Map
inspectorDataObject
;
final
Map
inspectorSummaryDataObject
;
final
String
inspectionStatus
;
final
String
scheduledDate
;
final
String
createdDate
;
final
String
createdBy
;
...
...
@@ -26,6 +27,7 @@ class Application {
required
this
.
leadInspector
,
required
this
.
inspectorDataObject
,
required
this
.
inspectorSummaryDataObject
,
required
this
.
inspectionStatus
,
required
this
.
scheduledDate
,
required
this
.
createdDate
,
required
this
.
createdBy
,
...
...
@@ -45,6 +47,7 @@ class Application {
?
json
[
'inspectorDataObject'
][
'dataObject'
]
:
{},
inspectorSummaryDataObject:
json
[
'inspectorSummaryDataObject'
]
??
{},
inspectionStatus:
json
[
'inspection'
][
'status'
]
??
''
,
scheduledDate:
json
[
'inspection'
][
'scheduledDate'
]
??
''
,
createdDate:
json
[
'createdDate'
],
createdBy:
json
[
'createdBy'
],
...
...
@@ -62,6 +65,7 @@ class Application {
leadInspector
,
inspectorDataObject
,
inspectorSummaryDataObject
,
inspectionStatus
,
scheduledDate
,
createdDate
,
createdBy
...
...
This diff is collapsed.
Click to expand it.
lib/pages/application_details_page.dart
+
48
−
11
View file @
43e617b2
...
...
@@ -50,6 +50,7 @@ class _ApplicationDetailsPageState extends State<ApplicationDetailsPage>
final
List
<
Map
>
_inspectors
=
[];
String
_inspectionSummary
=
''
;
String
_errorMessage
=
''
;
String
_inspectionStatus
=
''
;
@override
void
initState
()
{
...
...
@@ -87,6 +88,18 @@ class _ApplicationDetailsPageState extends State<ApplicationDetailsPage>
'name'
:
'
${widget.application.inspectors[i]['firstName']}
${widget.application.inspectors[i]['lastName']}
'
,
});
if
(
widget
.
application
.
inspectors
[
i
][
'id'
]
==
userId
&&
!
_isleadInspector
)
{
_note
=
widget
.
application
.
inspectors
[
i
][
'comments'
]
??
''
;
_inspectionStatus
=
widget
.
application
.
inspectors
[
i
][
'status'
]
??
false
;
_iConcent
=
widget
.
application
.
inspectors
[
i
][
'consentApplication'
]
??
false
;
if
(
widget
.
application
.
inspectors
[
i
][
'consentApplication'
]
!=
null
)
{
_iDisagree
=
widget
.
application
.
inspectors
[
i
][
'consentApplication'
]
?
false
:
true
;
}
}
setState
(()
{});
}
}
...
...
@@ -234,6 +247,7 @@ class _ApplicationDetailsPageState extends State<ApplicationDetailsPage>
builder:
(
context
)
=
>
StatefulBuilder
(
builder:
(
context
,
setState
)
{
return
AssistantInspectorDialog
(
noteText:
_note
,
status:
_inspectionStatus
,
parentAction:
triggerUpdate
,
);
}));
...
...
@@ -247,7 +261,7 @@ class _ApplicationDetailsPageState extends State<ApplicationDetailsPage>
@override
Widget
build
(
BuildContext
context
)
{
// print(widget.application
Fields
);
// print(widget.application
.inspectorDataObject
);
return
Scaffold
(
key:
_scaffoldKey
,
appBar:
AppBar
(
...
...
@@ -633,7 +647,14 @@ class _ApplicationDetailsPageState extends State<ApplicationDetailsPage>
field
.
keys
.
elementAt
(
i
)],
applicationStatus:
widget
.
application
.
status
,
.
application
.
inspectionStatus
==
InspectionStatus
.
leadInspectorCompleted
?
InspectionStatus
.
inspectionCompleted
:
widget
.
application
.
status
,
parentAction:
updateField
,
)
:
widget
.
application
.
status
==
...
...
@@ -691,12 +712,19 @@ class _ApplicationDetailsPageState extends State<ApplicationDetailsPage>
?
ButtonTheme
(
child:
OutlinedButton
(
onPressed:
()
{
if
(
!
_iDisagree
)
{
if
(
!
_iDisagree
&&
_inspectionStatus
!=
InspectionStatus
.
inspectionCompleted
)
{
_displayCommentDialog
();
}
setState
(()
{
_iDisagree
=
!
_iDisagree
;
});
if
(
_inspectionStatus
!=
InspectionStatus
.
inspectionCompleted
)
{
setState
(()
{
_iDisagree
=
!
_iDisagree
;
});
}
},
style:
OutlinedButton
.
styleFrom
(
backgroundColor:
_iDisagree
...
...
@@ -743,12 +771,19 @@ class _ApplicationDetailsPageState extends State<ApplicationDetailsPage>
padding:
const
EdgeInsets
.
only
(
left:
10
),
child:
TextButton
(
onPressed:
()
{
if
(
!
_iConcent
)
{
if
(
!
_iConcent
&&
_inspectionStatus
!=
InspectionStatus
.
inspectionCompleted
)
{
_displayCommentDialog
();
}
setState
(()
{
_iConcent
=
!
_iConcent
;
});
if
(
_inspectionStatus
!=
InspectionStatus
.
inspectionCompleted
)
{
setState
(()
{
_iConcent
=
!
_iConcent
;
});
}
},
style:
TextButton
.
styleFrom
(
// primary: Colors.white,
...
...
@@ -863,7 +898,9 @@ class _ApplicationDetailsPageState extends State<ApplicationDetailsPage>
],
))
:
widget
.
application
.
status
!=
InspectionStatus
.
inspectionCompleted
InspectionStatus
.
inspectionCompleted
&&
widget
.
application
.
inspectionStatus
!=
InspectionStatus
.
leadInspectorCompleted
?
TextButton
(
onPressed:
()
{
_submitInspection
();
...
...
This diff is collapsed.
Click to expand it.
lib/repositories/application_repository.dart
+
1
−
0
View file @
43e617b2
...
...
@@ -6,6 +6,7 @@ import 'package:smf_mobile/database/offline_model.dart';
import
'package:smf_mobile/models/application_model.dart'
;
import
'package:smf_mobile/services/application_service.dart'
;
import
'package:smf_mobile/util/helper.dart'
;
import
'dart:developer'
as
developer
;
class
ApplicationRespository
with
ChangeNotifier
{
late
Map
_data
;
...
...
This diff is collapsed.
Click to expand it.
lib/util/helper.dart
+
13
−
6
View file @
43e617b2
...
...
@@ -76,12 +76,19 @@ class Helper {
static
getInspectionStatus
(
BuildContext
context
,
String
status
)
{
String
_inspectionStatus
=
''
;
if
(
status
==
InspectionStatus
.
inspectionCompleted
)
{
_inspectionStatus
=
AppLocalizations
.
of
(
context
)
!.
completed
;
}
else
if
(
status
==
InspectionStatus
.
sentForInspection
)
{
_inspectionStatus
=
AppLocalizations
.
of
(
context
)
!.
sentForInspection
;
}
else
{
_inspectionStatus
=
capitalize
(
status
);
switch
(
status
)
{
case
InspectionStatus
.
inspectionCompleted
:
_inspectionStatus
=
AppLocalizations
.
of
(
context
)
!.
completed
;
break
;
case
InspectionStatus
.
sentForInspection
:
_inspectionStatus
=
AppLocalizations
.
of
(
context
)
!.
sentForInspection
;
break
;
case
InspectionStatus
.
leadInspectorCompleted
:
_inspectionStatus
=
AppLocalizations
.
of
(
context
)
!.
leadInspectorCompleted
;
break
;
default
:
_inspectionStatus
=
capitalize
(
status
);
}
// print(_inspectionStatus);
return
_inspectionStatus
;
...
...
This diff is collapsed.
Click to expand it.
lib/widgets/application_card.dart
+
18
−
1
View file @
43e617b2
import
'package:flutter/material.dart'
;
import
'package:google_fonts/google_fonts.dart'
;
import
'package:smf_mobile/constants/app_constants.dart'
;
import
'package:smf_mobile/constants/app_urls.dart'
;
import
'package:smf_mobile/constants/color_constants.dart'
;
import
'package:smf_mobile/models/application_model.dart'
;
...
...
@@ -23,6 +24,19 @@ class _ApplicationCardState extends State<ApplicationCard> {
super
.
initState
();
}
String
_getApplicationStatus
(
String
inspetionStatus
,
String
actualStatus
)
{
String
status
=
''
;
if
(
actualStatus
==
InspectionStatus
.
inspectionCompleted
)
{
status
=
InspectionStatus
.
inspectionCompleted
;
}
if
(
inspetionStatus
==
InspectionStatus
.
leadInspectorCompleted
)
{
status
=
InspectionStatus
.
leadInspectorCompleted
;
}
else
{
status
=
actualStatus
;
}
return
status
;
}
@override
Widget
build
(
BuildContext
context
)
{
return
InkWell
(
...
...
@@ -96,7 +110,10 @@ class _ApplicationCardState extends State<ApplicationCard> {
padding:
const
EdgeInsets
.
only
(
bottom:
10
),
child:
Text
(
Helper
.
getInspectionStatus
(
context
,
widget
.
application
.
status
),
context
,
_getApplicationStatus
(
widget
.
application
.
inspectionStatus
,
widget
.
application
.
status
)),
style:
GoogleFonts
.
lato
(
color:
AppColors
.
black60
,
fontSize:
14.0
,
...
...
This diff is collapsed.
Click to expand it.
lib/widgets/assistant_inspector_dialog.dart
+
19
−
3
View file @
43e617b2
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:google_fonts/google_fonts.dart'
;
import
'package:smf_mobile/constants/app_constants.dart'
;
import
'package:smf_mobile/constants/color_constants.dart'
;
// import 'package:flutter_gen/gen_l10n/app_localizations.dart';
class
AssistantInspectorDialog
extends
StatefulWidget
{
final
String
noteText
;
final
String
status
;
final
ValueChanged
<
Map
>
parentAction
;
const
AssistantInspectorDialog
({
Key
?
key
,
required
this
.
noteText
,
required
this
.
status
,
required
this
.
parentAction
,
})
:
super
(
key:
key
);
...
...
@@ -83,6 +86,10 @@ class _AssistantInspectorDialogState extends State<AssistantInspectorDialog> {
child:
Focus
(
child:
TextFormField
(
// autofocus: true,
enabled:
widget
.
status
==
InspectionStatus
.
inspectionCompleted
?
false
:
true
,
controller:
_noteController
,
textCapitalization:
TextCapitalization
.
sentences
,
...
...
@@ -121,7 +128,10 @@ class _AssistantInspectorDialogState extends State<AssistantInspectorDialog> {
child:
OutlinedButton
(
onPressed:
()
{
Navigator
.
of
(
context
)
.
pop
(
false
);
_saveData
(
false
);
if
(
widget
.
status
!=
InspectionStatus
.
inspectionCompleted
)
{
_saveData
(
false
);
}
},
style:
OutlinedButton
.
styleFrom
(
// primary: Colors.white,
...
...
@@ -146,7 +156,10 @@ class _AssistantInspectorDialogState extends State<AssistantInspectorDialog> {
child:
OutlinedButton
(
onPressed:
()
{
Navigator
.
of
(
context
)
.
pop
(
false
);
_saveData
(
true
);
if
(
widget
.
status
!=
InspectionStatus
.
inspectionCompleted
)
{
_saveData
(
true
);
}
},
style:
OutlinedButton
.
styleFrom
(
// primary: Colors.white,
...
...
@@ -171,7 +184,10 @@ class _AssistantInspectorDialogState extends State<AssistantInspectorDialog> {
child:
TextButton
(
onPressed:
()
{
Navigator
.
of
(
context
)
.
pop
(
false
);
_saveData
(
true
);
if
(
widget
.
status
!=
InspectionStatus
.
inspectionCompleted
)
{
_saveData
(
true
);
}
},
style:
TextButton
.
styleFrom
(
// primary: Colors.white,
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets