|
|
|
@ -127,7 +127,7 @@ class CreateRequestPageState extends State<CreateRequestPage> {
|
|
|
|
|
|
|
|
|
|
|
|
return Scaffold(
|
|
|
|
return Scaffold(
|
|
|
|
key: _scaffoldKey,
|
|
|
|
key: _scaffoldKey,
|
|
|
|
appBar: const DefaultAppBar(title: TranslationKeys.newServiceRequest),
|
|
|
|
appBar: DefaultAppBar(title: context.translation.newServiceRequest),
|
|
|
|
body: SafeArea(
|
|
|
|
body: SafeArea(
|
|
|
|
child: LoadingManager(
|
|
|
|
child: LoadingManager(
|
|
|
|
isLoading: _isLoading,
|
|
|
|
isLoading: _isLoading,
|
|
|
|
@ -252,7 +252,7 @@ class CreateRequestPageState extends State<CreateRequestPage> {
|
|
|
|
ATextFormField(
|
|
|
|
ATextFormField(
|
|
|
|
controller: _reviewCommentController,
|
|
|
|
controller: _reviewCommentController,
|
|
|
|
initialValue: _serviceRequest.reviewComment,
|
|
|
|
initialValue: _serviceRequest.reviewComment,
|
|
|
|
hintText: _subtitle.comment,
|
|
|
|
hintText: context.translation.comment,
|
|
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
textInputType: TextInputType.multiline,
|
|
|
|
textInputType: TextInputType.multiline,
|
|
|
|
onSaved: (value) {
|
|
|
|
onSaved: (value) {
|
|
|
|
@ -262,7 +262,7 @@ class CreateRequestPageState extends State<CreateRequestPage> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
12.height,
|
|
|
|
12.height,
|
|
|
|
MultiFilesPicker(
|
|
|
|
MultiFilesPicker(
|
|
|
|
label: _subtitle.deviceFiles,
|
|
|
|
label: context.translation.deviceFiles,
|
|
|
|
files: _deviceImages,
|
|
|
|
files: _deviceImages,
|
|
|
|
enabled: widget.serviceRequest == null ? true : false,
|
|
|
|
enabled: widget.serviceRequest == null ? true : false,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -275,11 +275,11 @@ class CreateRequestPageState extends State<CreateRequestPage> {
|
|
|
|
ATextFormField(
|
|
|
|
ATextFormField(
|
|
|
|
controller: _maintenanceController,
|
|
|
|
controller: _maintenanceController,
|
|
|
|
initialValue: _serviceRequest.callComments,
|
|
|
|
initialValue: _serviceRequest.callComments,
|
|
|
|
hintText: _subtitle.maintenanceIssue,
|
|
|
|
hintText: context.translation.maintenanceIssue,
|
|
|
|
prefixIconData: FontAwesomeIcons.triangleExclamation,
|
|
|
|
prefixIconData: FontAwesomeIcons.triangleExclamation,
|
|
|
|
style: Theme.of(context).textTheme.titleLarge,
|
|
|
|
style: Theme.of(context).textTheme.titleLarge,
|
|
|
|
textInputType: TextInputType.multiline,
|
|
|
|
textInputType: TextInputType.multiline,
|
|
|
|
validator: (value) => widget.serviceRequest != null || Validator.hasValue(value) ? null : _subtitle.maintenanceIssueRequired,
|
|
|
|
validator: (value) => widget.serviceRequest != null || Validator.hasValue(value) ? null : context.translation.maintenanceIssueRequired,
|
|
|
|
onSaved: (value) {
|
|
|
|
onSaved: (value) {
|
|
|
|
_serviceRequest.callComments = value;
|
|
|
|
_serviceRequest.callComments = value;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
@ -302,7 +302,7 @@ class CreateRequestPageState extends State<CreateRequestPage> {
|
|
|
|
ATextFormField(
|
|
|
|
ATextFormField(
|
|
|
|
controller: _commentController,
|
|
|
|
controller: _commentController,
|
|
|
|
initialValue: _serviceRequest.comments,
|
|
|
|
initialValue: _serviceRequest.comments,
|
|
|
|
hintText: _subtitle.comment,
|
|
|
|
hintText: context.translation.comment,
|
|
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
textInputType: TextInputType.multiline,
|
|
|
|
textInputType: TextInputType.multiline,
|
|
|
|
onSaved: (value) {
|
|
|
|
onSaved: (value) {
|
|
|
|
@ -316,7 +316,7 @@ class CreateRequestPageState extends State<CreateRequestPage> {
|
|
|
|
onPressed: () async {
|
|
|
|
onPressed: () async {
|
|
|
|
if (!_formKey.currentState.validate()) return;
|
|
|
|
if (!_formKey.currentState.validate()) return;
|
|
|
|
if (_asset?.id == null) {
|
|
|
|
if (_asset?.id == null) {
|
|
|
|
Fluttertoast.showToast(msg: _subtitle.pickDevice);
|
|
|
|
Fluttertoast.showToast(msg: context.translation.pickDevice);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (_serviceRequest.firstAction?.name == "Need a visit" && _dateTime == null) {
|
|
|
|
if (_serviceRequest.firstAction?.name == "Need a visit" && _dateTime == null) {
|
|
|
|
@ -361,17 +361,17 @@ class CreateRequestPageState extends State<CreateRequestPage> {
|
|
|
|
setState(() {});
|
|
|
|
setState(() {});
|
|
|
|
if (status >= 200 && status < 300) {
|
|
|
|
if (status >= 200 && status < 300) {
|
|
|
|
Fluttertoast.showToast(
|
|
|
|
Fluttertoast.showToast(
|
|
|
|
msg: _subtitle.requestCompleteSuccessfully,
|
|
|
|
msg: context.translation.successfulRequestMessage,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
String errorMessage = HttpStatusManger.getStatusMessage(status: status, subtitle: _subtitle);
|
|
|
|
String errorMessage = HttpStatusManger.getStatusMessage(status: status, subtitle: context.translation);
|
|
|
|
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
|
|
|
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
|
|
|
content: Text(errorMessage),
|
|
|
|
content: Text(errorMessage),
|
|
|
|
));
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
label: TranslationKeys.submitRequest),
|
|
|
|
label: context.translation.submitRequest),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
).paddingOnly(start: 16, end: 16, bottom: 24, top: 16),
|
|
|
|
).paddingOnly(start: 16, end: 16, bottom: 24, top: 16),
|
|
|
|
|