|
|
|
|
@ -3,6 +3,7 @@ import 'package:easy_localization/easy_localization.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/app_state/app_state.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/classes/colors.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/classes/utils.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
|
|
|
|
|
@ -60,6 +61,7 @@ class _EtqanOvrCreateRequestState extends State<EtqanOvrCreateRequest> {
|
|
|
|
|
hint: LocaleKeys.selectProject.tr(),
|
|
|
|
|
value: _getProjectDisplayName(provider.selectedProject),
|
|
|
|
|
onTap: () => _showProjectSelectionSheet(context, provider),
|
|
|
|
|
isMandatory: true,
|
|
|
|
|
),
|
|
|
|
|
16.height,
|
|
|
|
|
// _buildDropdownField(
|
|
|
|
|
@ -81,7 +83,39 @@ class _EtqanOvrCreateRequestState extends State<EtqanOvrCreateRequest> {
|
|
|
|
|
)).expanded,
|
|
|
|
|
DefaultButton(LocaleKeys.submit.tr(), () async {
|
|
|
|
|
provider.setDescription(_descriptionController.text);
|
|
|
|
|
await provider.submitRequest(context);
|
|
|
|
|
if (provider.selectedProject == null) {
|
|
|
|
|
Utils.showErrorDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
message: LocaleKeys.pleaseSelectProject.tr(),
|
|
|
|
|
onOkTapped: () {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!provider.isDescriptionValid()) {
|
|
|
|
|
Utils.showErrorDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
message: LocaleKeys.pleaseEnterDescription.tr(),
|
|
|
|
|
onOkTapped: () {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Map<String, dynamic>? ticketInfo = await provider.submitRequest(context);
|
|
|
|
|
if (ticketInfo != null) {
|
|
|
|
|
String ticketNumber = ticketInfo['ticketNumber'] ?? '';
|
|
|
|
|
String ticketId = ticketInfo['id'] ?? '';
|
|
|
|
|
String successMessage = '${LocaleKeys.requestCreatedSuccessfully.tr()}\n\n${LocaleKeys.ticketNumber.tr()}: $ticketNumber\n${LocaleKeys.ticketId.tr()}: $ticketId';
|
|
|
|
|
Utils.showErrorDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
message: successMessage,
|
|
|
|
|
onOkTapped: () {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}).insideContainer,
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
@ -137,7 +171,7 @@ class _EtqanOvrCreateRequestState extends State<EtqanOvrCreateRequest> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _buildDropdownField({required String label, required String hint, String? value, required VoidCallback onTap}) {
|
|
|
|
|
Widget _buildDropdownField({required String label, required String hint, String? value, required VoidCallback onTap, bool isMandatory = false}) {
|
|
|
|
|
return InkWell(
|
|
|
|
|
onTap: onTap,
|
|
|
|
|
borderRadius: BorderRadius.circular(15),
|
|
|
|
|
@ -150,7 +184,12 @@ class _EtqanOvrCreateRequestState extends State<EtqanOvrCreateRequest> {
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(label, style: const TextStyle(fontSize: 11, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.44)),
|
|
|
|
|
Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(label, style: const TextStyle(fontSize: 11, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.44)),
|
|
|
|
|
if (isMandatory) const Text(' *', style: TextStyle(fontSize: 11, fontWeight: FontWeight.w600, color: Colors.red, letterSpacing: -0.44)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 4),
|
|
|
|
|
Text(value ?? hint, style: TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: value != null ? const Color(0xff2B353E) : const Color(0xff575757), letterSpacing: -0.56)),
|
|
|
|
|
],
|
|
|
|
|
@ -227,7 +266,12 @@ class _EtqanOvrCreateRequestState extends State<EtqanOvrCreateRequest> {
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(LocaleKeys.description.tr(), style: const TextStyle(fontSize: 11, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.44)),
|
|
|
|
|
Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(LocaleKeys.description.tr(), style: const TextStyle(fontSize: 11, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.44)),
|
|
|
|
|
const Text(' *', style: TextStyle(fontSize: 11, fontWeight: FontWeight.w600, color: Colors.red, letterSpacing: -0.44)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
GestureDetector(
|
|
|
|
|
onTap:
|
|
|
|
|
provider.speechEnabled
|
|
|
|
|
|