|
|
|
@ -1,11 +1,17 @@
|
|
|
|
|
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/feedback/COC_items.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/feedback/feedback_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/feedback/feedback-detail.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
@ -18,6 +24,12 @@ class StatusFeedbackPage extends StatefulWidget {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _StatusFeedbackPageState extends State<StatusFeedbackPage> {
|
|
|
|
|
String countryCode = '966';
|
|
|
|
|
String mobileNo = "";
|
|
|
|
|
TextEditingController complainNumberController = TextEditingController();
|
|
|
|
|
StatusType statusType = StatusType.ComplaintNumber;
|
|
|
|
|
int selectedStatusIndex = 3;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
|
|
@ -29,111 +41,273 @@ class _StatusFeedbackPageState extends State<StatusFeedbackPage> {
|
|
|
|
|
body: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: model.cOCItemList.isNotEmpty
|
|
|
|
|
? Container(
|
|
|
|
|
margin: EdgeInsets.only(top: 8.0, left: 8.0, right: 8.0, bottom: 80),
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
itemCount: model.cOCItemList.length,
|
|
|
|
|
itemBuilder: (context, index) => InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
},
|
|
|
|
|
child: Card(
|
|
|
|
|
shape: cardRadius(12),
|
|
|
|
|
margin: EdgeInsets.all(10),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(12.0),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(projectViewModel.isArabic ? model.cOCItemList[index].statusAr : model.cOCItemList[index].status,
|
|
|
|
|
style: TextStyle(fontSize: 14.0, letterSpacing: -0.56, fontWeight: FontWeight.bold)),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(top: 5.0),
|
|
|
|
|
child: Text(model.cOCItemList[index].formType.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins',
|
|
|
|
|
color: Color(0xff2B353E),
|
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
|
height: 18 / 12))),
|
|
|
|
|
myRichText(TranslationBase.of(context).number + ": ", model.cOCItemList[index].itemID.toString(), projectViewModel.isArabic),
|
|
|
|
|
Text(model.cOCItemList[index].cOCTitle,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins',
|
|
|
|
|
color: Color(0xff2B353E),
|
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
|
height: 18 / 12)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
Text(model.cOCItemList[index].date.split(" ")[0],
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins',
|
|
|
|
|
color: Color(0xff2B353E),
|
|
|
|
|
letterSpacing: -0.48)),
|
|
|
|
|
Text(model.cOCItemList[index].date.split(" ")[1].substring(0, 4),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins',
|
|
|
|
|
color: Color(0xff2B353E),
|
|
|
|
|
letterSpacing: -0.48)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: projectViewModel.isLogin
|
|
|
|
|
? !model.cOCItemList.isNotEmpty
|
|
|
|
|
? listData(model.cOCItemList, projectViewModel.isArabic, true)
|
|
|
|
|
: Center(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.4,
|
|
|
|
|
),
|
|
|
|
|
Image.asset(
|
|
|
|
|
'assets/images/comments.png',
|
|
|
|
|
width: 80,
|
|
|
|
|
height: 80,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 15,
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).noSearchResult,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
|
color: Color(0xff2B353E),
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
)
|
|
|
|
|
: Center(
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: SingleChildScrollView(
|
|
|
|
|
padding: EdgeInsets.all(21),
|
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.4,
|
|
|
|
|
),
|
|
|
|
|
Image.asset(
|
|
|
|
|
'assets/images/comments.png',
|
|
|
|
|
width: 80,
|
|
|
|
|
height: 80,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 15,
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).noSearchResult,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
|
color: Color(0xff2B353E),
|
|
|
|
|
TranslationBase.of(context).selectSearchCriteria,
|
|
|
|
|
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 21),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
List<RadioSelectionDialogModel> list = [
|
|
|
|
|
RadioSelectionDialogModel(TranslationBase.of(context).complaintNumber, 3),
|
|
|
|
|
RadioSelectionDialogModel(TranslationBase.of(context).fileNumber, 1),
|
|
|
|
|
RadioSelectionDialogModel(TranslationBase.of(context).identificationNumber, 2),
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
child: RadioSelectionDialog(
|
|
|
|
|
listData: list,
|
|
|
|
|
selectedIndex: selectedStatusIndex,
|
|
|
|
|
onValueSelected: (index) {
|
|
|
|
|
selectedStatusIndex = index;
|
|
|
|
|
setState(() {
|
|
|
|
|
if (index == 3) {
|
|
|
|
|
statusType = StatusType.ComplaintNumber;
|
|
|
|
|
} else if (index == 1) {
|
|
|
|
|
statusType = StatusType.FileNumber;
|
|
|
|
|
} else {
|
|
|
|
|
statusType = StatusType.IdentificationNumber;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.circular(15),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: Color(0xffefefef),
|
|
|
|
|
width: 1,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(
|
|
|
|
|
getSelected(context),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
|
color: Color(0xff2B353E),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.keyboard_arrow_down,
|
|
|
|
|
size: 22,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 12),
|
|
|
|
|
Directionality(
|
|
|
|
|
textDirection: TextDirection.ltr,
|
|
|
|
|
child: inputWidget(
|
|
|
|
|
statusType == StatusType.ComplaintNumber
|
|
|
|
|
? TranslationBase.of(context).enterComplainNumber
|
|
|
|
|
: (statusType == StatusType.FileNumber ? TranslationBase.of(context).enterfileNumber : TranslationBase.of(context).enterIdentificationNumber),
|
|
|
|
|
"",
|
|
|
|
|
complainNumberController,
|
|
|
|
|
isInputTypeNum: true)),
|
|
|
|
|
SizedBox(height: 12),
|
|
|
|
|
PhoneNumberSelectorWidget(onNumberChange: (value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
mobileNo = value;
|
|
|
|
|
});
|
|
|
|
|
}, onCountryChange: (value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
countryCode = value;
|
|
|
|
|
});
|
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
if (!projectViewModel.isLogin)
|
|
|
|
|
Container(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21),
|
|
|
|
|
child: DefaultButton(
|
|
|
|
|
TranslationBase.of(context).search,
|
|
|
|
|
projectViewModel.isLogin || (mobileNo.length < 9) || (complainNumberController.text.isEmpty)
|
|
|
|
|
? null
|
|
|
|
|
: () {
|
|
|
|
|
model.searchFeedback(countryCode, mobileNo, selectedStatusIndex, complainNumberController.text).then((value) {
|
|
|
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
|
|
|
Future.delayed(Duration(seconds: 1), () {
|
|
|
|
|
AppToast.showErrorToast(message: model.error);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
listData(model.cOCItemList, projectViewModel.isArabic, false);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
disabledColor: Colors.grey,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
bottomSheet: projectViewModel.isLogin ? Container(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21),
|
|
|
|
|
child: DefaultButton(
|
|
|
|
|
TranslationBase.of(context).search,
|
|
|
|
|
projectViewModel.isLogin ? null : () => {},
|
|
|
|
|
disabledColor: Colors.grey,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget listData(List<COCItem> cOCItemList, bool isArabic, bool isLogin) {
|
|
|
|
|
return ListView.builder(
|
|
|
|
|
padding: isLogin ? EdgeInsets.all(21) : null,
|
|
|
|
|
itemCount: cOCItemList.length,
|
|
|
|
|
shrinkWrap: isLogin ? false : true,
|
|
|
|
|
physics: isLogin ? null : NeverScrollableScrollPhysics(),
|
|
|
|
|
itemBuilder: (context, index) => InkWell(
|
|
|
|
|
onTap: () {},
|
|
|
|
|
child: Card(
|
|
|
|
|
shape: cardRadius(12),
|
|
|
|
|
margin: EdgeInsets.all(10),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(12.0),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(isArabic ? cOCItemList[index].statusAr : cOCItemList[index].status, style: TextStyle(fontSize: 14.0, letterSpacing: -0.56, fontWeight: FontWeight.bold)),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(top: 5.0),
|
|
|
|
|
child: Text(cOCItemList[index].formType.toString(),
|
|
|
|
|
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12))),
|
|
|
|
|
myRichText(TranslationBase.of(context).number + ": ", cOCItemList[index].itemID.toString(), isArabic),
|
|
|
|
|
Text(cOCItemList[index].cOCTitle,
|
|
|
|
|
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
Text(cOCItemList[index].date.split(" ")[0],
|
|
|
|
|
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48)),
|
|
|
|
|
Text(cOCItemList[index].date.split(" ")[1].substring(0, 4),
|
|
|
|
|
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
) : Container(),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller,
|
|
|
|
|
{VoidCallback suffixTap, bool isEnable = true, bool hasSelection = false, int lines, bool isInputTypeNum = false}) {
|
|
|
|
|
return Container(
|
|
|
|
|
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.circular(15),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: Color(0xffefefef),
|
|
|
|
|
width: 1,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: hasSelection ? () {} : null,
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
_labelText,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 11,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: Color(0xff2B353E),
|
|
|
|
|
letterSpacing: -0.44,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
TextField(
|
|
|
|
|
enabled: isEnable,
|
|
|
|
|
scrollPadding: EdgeInsets.zero,
|
|
|
|
|
keyboardType: isInputTypeNum ? TextInputType.number : TextInputType.text,
|
|
|
|
|
controller: _controller,
|
|
|
|
|
maxLines: lines,
|
|
|
|
|
onChanged: (value) => {setState(() {})},
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
height: 21 / 14,
|
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
|
color: Color(0xff2B353E),
|
|
|
|
|
letterSpacing: -0.44,
|
|
|
|
|
),
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
isDense: true,
|
|
|
|
|
hintText: _hintText,
|
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
height: 21 / 14,
|
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
|
color: Color(0xff575757),
|
|
|
|
|
letterSpacing: -0.56,
|
|
|
|
|
),
|
|
|
|
|
suffixIconConstraints: BoxConstraints(minWidth: 50),
|
|
|
|
|
suffixIcon: suffixTap == null ? null : IconButton(icon: Icon(Icons.mic, color: Color(0xff2E303A)), onPressed: suffixTap),
|
|
|
|
|
contentPadding: EdgeInsets.zero,
|
|
|
|
|
border: InputBorder.none,
|
|
|
|
|
focusedBorder: InputBorder.none,
|
|
|
|
|
enabledBorder: InputBorder.none,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
@ -141,4 +315,25 @@ class _StatusFeedbackPageState extends State<StatusFeedbackPage> {
|
|
|
|
|
gotodetails(item) {
|
|
|
|
|
Navigator.pushReplacement(context, FadePage(page: FeedbackDetails(items: item)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String getSelected(BuildContext context) {
|
|
|
|
|
switch (statusType) {
|
|
|
|
|
case StatusType.ComplaintNumber:
|
|
|
|
|
return TranslationBase.of(context).complaintNumber;
|
|
|
|
|
break;
|
|
|
|
|
case StatusType.FileNumber:
|
|
|
|
|
return TranslationBase.of(context).fileNumber;
|
|
|
|
|
break;
|
|
|
|
|
case StatusType.IdentificationNumber:
|
|
|
|
|
return TranslationBase.of(context).identificationNumber;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return TranslationBase.of(context).notClassified;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enum StatusType {
|
|
|
|
|
ComplaintNumber,
|
|
|
|
|
FileNumber,
|
|
|
|
|
IdentificationNumber,
|
|
|
|
|
}
|
|
|
|
|