From d66d0a591298583c63509b10f7060ec153e1c6d3 Mon Sep 17 00:00:00 2001 From: jayesh Date: Tue, 30 Apr 2024 17:11:38 +0530 Subject: [PATCH] contact us completed --- lib/Utils/Common/CommonAppBar.dart | 12 - lib/Utils/api_urls.dart | 1 + lib/Utils/image_preview_screen.dart | 2 +- lib/controller/contact_us_controller.dart | 9 + .../contactUs/cancel_ticket_bottom_sheet.dart | 46 +- .../contactUs/contact_us_details.dart | 931 ++++++++++-------- .../Sidemenu/contactUs/contact_us_main.dart | 497 ++++------ .../contactUs/create_ticket_bottom_sheet.dart | 374 +++---- .../ticket_confirmed_bottom_sheet.dart | 3 +- .../Sidemenu/myProfile/my_profile_screen.dart | 60 +- lib/view/login/VerifyOtp.dart | 19 +- .../ContactUsApi/contact_us_api.dart | 21 +- pubspec.lock | 26 +- 13 files changed, 1042 insertions(+), 959 deletions(-) diff --git a/lib/Utils/Common/CommonAppBar.dart b/lib/Utils/Common/CommonAppBar.dart index a5b6d8f..e10faa0 100644 --- a/lib/Utils/Common/CommonAppBar.dart +++ b/lib/Utils/Common/CommonAppBar.dart @@ -85,18 +85,6 @@ class CommonAppbar extends StatelessWidget implements PreferredSizeWidget { ), ), actions: [ - // if (calendarWidget == true) - // InkWell( - // onTap: onCustomActionPressed, - // child: Padding( - // padding: EdgeInsets.only(right: 14.w), - // child: Icon( - // Icons.calendar_month_outlined, - // color: Color(0xFF3192D8), - // size: 28, - // ), - // ), - // ), if (customActionWidget != null) InkWell( onTap: onCustomActionPressed, diff --git a/lib/Utils/api_urls.dart b/lib/Utils/api_urls.dart index 1904f5c..d7ad28e 100644 --- a/lib/Utils/api_urls.dart +++ b/lib/Utils/api_urls.dart @@ -61,4 +61,5 @@ class ApiUrls { static String getcontactusDetails = "${base}get-detailed-ticket-data-with-chats/"; static String sendMessage = "${base}send-message-to-admin"; + static String updateTicketStatusApi = "${base}update-ticket-status"; } diff --git a/lib/Utils/image_preview_screen.dart b/lib/Utils/image_preview_screen.dart index 4a0718b..c231427 100644 --- a/lib/Utils/image_preview_screen.dart +++ b/lib/Utils/image_preview_screen.dart @@ -42,7 +42,7 @@ class _ImagePreviewScreenState extends State { CachedNetworkImage( imageUrl: image, placeholder: (context, url) { - return Center( + return const Center( child: CircularProgressIndicator( color: Colors.redAccent, ), diff --git a/lib/controller/contact_us_controller.dart b/lib/controller/contact_us_controller.dart index 569309e..652ad10 100644 --- a/lib/controller/contact_us_controller.dart +++ b/lib/controller/contact_us_controller.dart @@ -5,8 +5,17 @@ import 'package:traderscircuit/model/ContactUsModel/contact_us_cat_model.dart'; import 'package:traderscircuit/model/ContactUsModel/contact_us_model.dart'; import 'package:intl/intl.dart'; +import '../model/ContactUsModel/ticket_details_model.dart'; + class ContactUsController extends GetxController { RxBool isLoading = true.obs; + bool isTicketClosed = false; + RxBool isDetailsLoading = true.obs; + TicketDetailsModel? ticketDetailsModel; + RxInt allC = 0.obs; + RxInt openC = 0.obs; + RxInt closeC = 0.obs; + RxInt resolvedC = 0.obs; //contact us page controller RxList attachmentFileList = [File("")].obs; RxList attachmentPathNameList = [""].obs; diff --git a/lib/view/Sidemenu/contactUs/cancel_ticket_bottom_sheet.dart b/lib/view/Sidemenu/contactUs/cancel_ticket_bottom_sheet.dart index 7cf690c..33e3bd7 100644 --- a/lib/view/Sidemenu/contactUs/cancel_ticket_bottom_sheet.dart +++ b/lib/view/Sidemenu/contactUs/cancel_ticket_bottom_sheet.dart @@ -1,17 +1,22 @@ +import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_svg/svg.dart'; import 'package:gap/gap.dart'; -import 'package:get/get.dart'; +import 'package:get/get.dart' hide FormData; import 'package:traderscircuit/Utils/text.dart'; +import 'package:traderscircuit/controller/contact_us_controller.dart'; +import 'package:traderscircuit/view_model/ContactUsApi/contact_us_api.dart'; import '../../../Utils/Common/commonBotton.dart'; -import 'ticket_confirmed_bottom_sheet.dart'; +import '../../../model/ContactUsModel/ticket_details_model.dart'; class CancelTicketBottomSheet { bottomSheet( BuildContext context, + int id, ) { + ContactUsController contactUsController = Get.put(ContactUsController()); return showModalBottomSheet( useSafeArea: true, isScrollControlled: true, @@ -65,7 +70,42 @@ class CancelTicketBottomSheet { child: kycBtn( text: "Yes", onTap: () { - Get.back(); + ContactUsApi() + .updateTicketStatusApi(FormData.fromMap({ + "ticket_xid": id, + "status": 2, + })) + .then((value) { + Get.back(); + contactUsController.isDetailsLoading.value = + true; + contactUsController + .contactUsDetailsChatContent + .clear(); + ContactUsApi() + .getContactUsDetailsData(id.toString()) + .then((value) { + contactUsController.ticketDetailsModel = + TicketDetailsModel.fromJson(value.data); + for (var a in contactUsController + .ticketDetailsModel! + .data![0] + .ticketResponses!) { + contactUsController + .contactUsDetailsChatContent + .add({ + "initial_name": "TS", + "date": contactUsController + .formatedDateTimeMethod( + a.createdAt!), + "content": a.response, + }); + } + contactUsController.isTicketClosed = true; + contactUsController.isDetailsLoading.value = + false; + }); + }); }, bgClr: const Color(0xFF6C0000), borderClr: const Color(0xFF9A0000), diff --git a/lib/view/Sidemenu/contactUs/contact_us_details.dart b/lib/view/Sidemenu/contactUs/contact_us_details.dart index 5905ed1..03b25b7 100644 --- a/lib/view/Sidemenu/contactUs/contact_us_details.dart +++ b/lib/view/Sidemenu/contactUs/contact_us_details.dart @@ -29,21 +29,23 @@ class _ContactUsDetailsScreenState extends State { ContactUsController contactUsController = Get.put(ContactUsController()); TextEditingController queriesTextController = TextEditingController(); String id = Get.arguments["id"]; - RxBool isLoading = true.obs; - TicketDetailsModel? ticketDetailsModel; @override void initState() { + contactUsController.isDetailsLoading.value = true; + contactUsController.isTicketClosed = false; contactUsController.contactUsDetailsChatContent.clear(); ContactUsApi().getContactUsDetailsData(id).then((value) { - ticketDetailsModel = TicketDetailsModel.fromJson(value.data); - for (var a in ticketDetailsModel!.data![0].ticketResponses!) { + contactUsController.ticketDetailsModel = + TicketDetailsModel.fromJson(value.data); + for (var a in contactUsController + .ticketDetailsModel!.data![0].ticketResponses!) { contactUsController.contactUsDetailsChatContent.add({ "initial_name": "TS", "date": contactUsController.formatedDateTimeMethod(a.createdAt!), "content": a.response, }); } - isLoading.value = false; + contactUsController.isDetailsLoading.value = false; }); super.initState(); @@ -53,150 +55,130 @@ class _ContactUsDetailsScreenState extends State { Widget build(BuildContext context) { final GlobalKey queriesForm = GlobalKey(); return Obx( - () => Form( - key: queriesForm, - child: Scaffold( - appBar: CommonAppbar( - height: 75, - titleTxt: "", - customActionWidget: text16W400(""), - ), - backgroundColor: Colors.black, - extendBody: true, - body: Stack( - children: [ - const CommonBlurLeft(), - const CommonBlurRight(), - isLoading.value - ? const Center( - child: - CircularProgressIndicator(color: Color(0xFF9A0000)), - ) - : Stack(children: [ - SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 18, vertical: 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - //physics: const NeverScrollableScrollPhysics(), - children: [ - text25W600("Contact Us"), - const Gap(20), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - text22W600( - "#${ticketDetailsModel!.data![0].uniqueTicketId}"), - const Gap(10), - text16W500( - ticketDetailsModel!.data![0].status == - 1 - ? "OPEN" - : ticketDetailsModel! - .data![0].status == - 2 - ? "CLOSED" - : "RESOLVED", - clr: ticketDetailsModel! - .data![0].status == - 1 - ? const Color(0xFFFFAD31) - : ticketDetailsModel! - .data![0].status == - 2 - ? const Color(0xFF95CCFF) - : const Color(0xFF34C759), - ), - ], - ), - text16W400(contactUsController - .formatedDateTimeMethod( - ticketDetailsModel! - .data![0].createdAt!)), - ], - ), - const Gap(15), - const Divider( - thickness: 1, - color: Color(0xFF242424), - ), - const Gap(20), - text16W600(ticketDetailsModel! - .data![0].ticketCategory!.name!), - const Gap(10), - text16W400( - ticketDetailsModel!.data![0].description!), - ListView.builder( - shrinkWrap: true, - itemCount: ticketDetailsModel! - .data![0].ticketFiles!.length, - itemBuilder: (ctx, index) { - return InkWell( - onTap: () { - Get.to(const ImagePreviewScreen(), - arguments: { - "image": ticketDetailsModel! - .data![0] - .ticketFiles![index] - .file, - }); - }, - child: Container( - width: 1.sw, - height: 42.h, - margin: const EdgeInsets.symmetric( - vertical: 6, + () => WillPopScope( + onWillPop: () async { + contactUsController.isTicketClosed + ? Get.back(result: true) + : Get.back(); + return false; + }, + child: Form( + key: queriesForm, + child: Scaffold( + appBar: CommonAppbar( + height: 75, + titleTxt: "", + customActionWidget: text16W400(""), + ), + backgroundColor: Colors.black, + extendBody: true, + body: Stack( + children: [ + const CommonBlurLeft(), + const CommonBlurRight(), + contactUsController.isDetailsLoading.value + ? const Center( + child: + CircularProgressIndicator(color: Color(0xFF9A0000)), + ) + : Stack(children: [ + SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 18, vertical: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + //physics: const NeverScrollableScrollPhysics(), + children: [ + text25W600("Contact Us"), + const Gap(20), + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + text22W600( + "#${contactUsController.ticketDetailsModel!.data![0].uniqueTicketId}"), + const Gap(10), + text16W500( + contactUsController + .ticketDetailsModel! + .data![0] + .status == + 1 + ? "OPEN" + : contactUsController + .ticketDetailsModel! + .data![0] + .status == + 2 + ? "CLOSED" + : "RESOLVED", + clr: contactUsController + .ticketDetailsModel! + .data![0] + .status == + 1 + ? const Color(0xFFFFAD31) + : contactUsController + .ticketDetailsModel! + .data![0] + .status == + 2 + ? const Color(0xFF95CCFF) + : const Color(0xFF34C759), ), - decoration: BoxDecoration( - color: const Color(0xFF0C0C0C), - borderRadius: - BorderRadius.circular(4), - border: Border.all( - width: 1, - color: - const Color(0xFF3A3A3A))), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - const Gap(6), - SvgPicture.asset( - "assets/images/svg/attachment_pin.svg"), - const Gap(6), - text12W400( - "Attachment ${index + 1}"), - ], - ), - ], - ), - ), - ); - }), - contactUsController - .attachmentPathNameDetailsList.isEmpty - ? const SizedBox() - : const Gap(15), - contactUsController - .attachmentPathNameDetailsList.isEmpty - ? const SizedBox() - : ListView.builder( - physics: - const NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: contactUsController - .attachmentPathNameDetailsList - .length, - itemBuilder: (ctx, index) { - return Container( + ], + ), + text16W400(contactUsController + .formatedDateTimeMethod( + contactUsController + .ticketDetailsModel! + .data![0] + .createdAt!)), + ], + ), + const Gap(15), + const Divider( + thickness: 1, + color: Color(0xFF242424), + ), + const Gap(20), + text16W600(contactUsController + .ticketDetailsModel! + .data![0] + .ticketCategory! + .name!), + const Gap(10), + text16W400(contactUsController + .ticketDetailsModel! + .data![0] + .description!), + ListView.builder( + shrinkWrap: true, + itemCount: contactUsController + .ticketDetailsModel! + .data![0] + .ticketFiles! + .length, + itemBuilder: (ctx, index) { + return InkWell( + onTap: () { + Get.to(const ImagePreviewScreen(), + arguments: { + "image": contactUsController + .ticketDetailsModel! + .data![0] + .ticketFiles![index] + .file, + }); + }, + child: Container( width: 1.sw, height: 42.h, margin: const EdgeInsets.symmetric( @@ -221,314 +203,393 @@ class _ContactUsDetailsScreenState extends State { SvgPicture.asset( "assets/images/svg/attachment_pin.svg"), const Gap(6), - Container( - width: 0.7.sw, - child: FittedBox( - child: text12W400( - contactUsController - .attachmentPathNameDetailsList[ - index]), - ), - ), + text12W400( + "Attachment ${index + 1}"), ], ), - GestureDetector( - onTap: () { - contactUsController - .attachmentPathNameDetailsList - .removeAt(index); - contactUsController - .attachmentFileDetailsList - .removeAt(index); - }, - child: Container( - margin: - const EdgeInsets.only( - right: 20), - child: SvgPicture.asset( - "assets/images/svg/cross_cancel.svg", - color: const Color( - 0xFF818181), - width: 10, - height: 10, - ), - )), ], ), - ); - }), - contactUsController - .contactUsDetailsChatContent.isEmpty - ? const SizedBox() - : const Gap(18), - ListView.builder( - physics: - const NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: contactUsController - .contactUsDetailsChatContent - .length + - 1, - itemBuilder: (ctx, index) { - return index == - contactUsController - .contactUsDetailsChatContent - .length - ? Container( - margin: EdgeInsets.only(top: 20), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.end, - mainAxisSize: MainAxisSize.min, - children: [ - Stack( - children: [ - CustomTextFormField3( - texttype: TextInputType - .multiline, - hintText: - "Enter some text...", - textEditingController: - queriesTextController, - maxlines: 8, - validator: (value) { - if (value.isEmpty) { - return 'Enter your Content'; - } else if (value - .toString() - .length < - 30) { - return 'Content should be minimum 30 characters'; - } - return null; - }, - inputFormatters: [ - LengthLimitingTextInputFormatter( - 200), - ], - ), - Positioned( - bottom: 15, - left: 37, - right: 37, - child: SizedBox( - width: 200.w, - child: kycBtn( - text: - "Close Ticket", - onTap: () { - CancelTicketBottomSheet() - .bottomSheet( - context); - }, - bgClr: const Color( - 0xFF111313), - borderClr: - const Color( - 0xFF990000), - ), - ), - ) - ], - ), - // contactUsController - // .attachmentPathNameDetailsList - // .length >= - // 3 - // ? const SizedBox() - // : const Gap(10), - // contactUsController - // .attachmentPathNameDetailsList - // .length >= - // 3 - // ? const SizedBox() - // : InkWell( - // onTap: () async { - // var result = - // await FilePickerMethod() - // .pickFile(); - // if (result != - // null) { - // contactUsController - // .attachmentPathNameDetailsList - // .clear(); - - // for (var a - // in result) { - // contactUsController - // .attachmentFileDetailsList - // .add(a); - // } - - // for (var a - // in contactUsController - // .attachmentFileDetailsList) { - // contactUsController - // .attachmentPathNameDetailsList - // .add(FilePickerMethod().extractFileName( - // a?.path ?? - // '')); - // } - // } - // }, - // child: Row( - // mainAxisAlignment: - // MainAxisAlignment - // .end, - // children: [ - // SvgPicture.asset( - // "assets/images/svg/attachment_pin.svg"), - // const Gap(6), - // text12W400( - // "Add Attachment (Max 32MB / Optional)"), - // ], - // ), - // ), - const Gap(20), - Padding( - padding: const EdgeInsets - .symmetric( - // horizontal: 10, - vertical: 20), - child: SizedBox( - width: Get.width, - child: kycBtn( - text: "Submit", - onTap: () { - if (queriesTextController - .text.isEmpty) { - utils.showToast( - "Text is required"); - } else { - ContactUsApi() - .addTicketMessageApi( - FormData - .fromMap({ - "description": - queriesTextController - .text, - "ticket_xid": - ticketDetailsModel! - .data![0] - .id - })) - .then((value) { - Map - responseData = - Map.from( - value - .data); - utils.showToast( - responseData[ - "message"]); - contactUsController - .contactUsDetailsChatContent - .add({ - "initial_name": - "TS", - "date": contactUsController - .formatedDateTimeMethod( - responseData["data"] - [ - "created_at"]), - "content": responseData[ - "data"][ - "response"], - }); - queriesTextController - .clear(); - }); - } - }, - bgClr: const Color( - 0xFF6C0000), - borderClr: const Color( - 0xFF990000), - ), - ), - ), - ], - ), - ) - : Container( + ), + ); + }), + contactUsController + .attachmentPathNameDetailsList.isEmpty + ? const SizedBox() + : const Gap(15), + contactUsController + .attachmentPathNameDetailsList.isEmpty + ? const SizedBox() + : ListView.builder( + physics: + const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: contactUsController + .attachmentPathNameDetailsList + .length, + itemBuilder: (ctx, index) { + return Container( width: 1.sw, + height: 42.h, margin: const EdgeInsets.symmetric( - vertical: 5, + vertical: 6, ), decoration: BoxDecoration( color: const Color(0xFF0C0C0C), borderRadius: - BorderRadius.circular(8), - gradient: LinearGradient( - begin: const Alignment( - 0.98, -0.21), - end: const Alignment( - -0.98, 0.21), - colors: [ - Colors.white.withOpacity( - 0.03999999910593033), - Colors.white.withOpacity( - 0.05999999865889549) - ], - ), + BorderRadius.circular(4), border: Border.all( width: 1, color: const Color( 0xFF3A3A3A))), - child: Padding( - padding: - const EdgeInsets.all(12.0), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - mainAxisSize: - MainAxisSize.min, - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: [ - CircleAvatar( - radius: 18, - backgroundColor: - Colors.white, - child: Center( - child: text16W600( - contactUsController - .contactUsDetailsChatContent[ - index][ - "initial_name"], - clr: const Color( - 0xFF535353)), - ), + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + children: [ + Row( + children: [ + const Gap(6), + SvgPicture.asset( + "assets/images/svg/attachment_pin.svg"), + const Gap(6), + Container( + width: 0.7.sw, + child: FittedBox( + child: text12W400( + contactUsController + .attachmentPathNameDetailsList[ + index]), ), - text14W500( - contactUsController - .contactUsDetailsChatContent[ - index]["date"], + ), + ], + ), + GestureDetector( + onTap: () { + contactUsController + .attachmentPathNameDetailsList + .removeAt(index); + contactUsController + .attachmentFileDetailsList + .removeAt(index); + }, + child: Container( + margin: const EdgeInsets + .only(right: 20), + child: SvgPicture.asset( + "assets/images/svg/cross_cancel.svg", + color: const Color( + 0xFF818181), + width: 10, + height: 10, + ), + )), + ], + ), + ); + }), + contactUsController + .contactUsDetailsChatContent.isEmpty + ? const SizedBox() + : const Gap(18), + ListView.builder( + physics: + const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: contactUsController + .contactUsDetailsChatContent + .length + + 1, + itemBuilder: (ctx, index) { + return index == + contactUsController + .contactUsDetailsChatContent + .length + ? (contactUsController + .ticketDetailsModel! + .data![0] + .status == + 2 || + contactUsController + .ticketDetailsModel! + .data![0] + .status == + 3) + ? SizedBox() + : Container( + margin: EdgeInsets.only( + top: 20), + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .end, + mainAxisSize: + MainAxisSize.min, + children: [ + Stack( + children: [ + CustomTextFormField3( + texttype: + TextInputType + .multiline, + hintText: + "Enter some text...", + textEditingController: + queriesTextController, + maxlines: 8, + validator: + (value) { + if (value + .isEmpty) { + return 'Enter your Content'; + } else if (value + .toString() + .length < + 30) { + return 'Content should be minimum 30 characters'; + } + return null; + }, + inputFormatters: [ + LengthLimitingTextInputFormatter( + 200), + ], + ), + Positioned( + bottom: 15, + left: 37, + right: 37, + child: SizedBox( + width: 200.w, + child: kycBtn( + text: + "Close Ticket", + onTap: () { + CancelTicketBottomSheet() + .bottomSheet( + context, + contactUsController + .ticketDetailsModel! + .data![ + 0] + .id!, + ); + }, + bgClr: const Color( + 0xFF111313), + borderClr: + const Color( + 0xFF990000), + ), + ), + ) + ], + ), + // contactUsController + // .attachmentPathNameDetailsList + // .length >= + // 3 + // ? const SizedBox() + // : const Gap(10), + // contactUsController + // .attachmentPathNameDetailsList + // .length >= + // 3 + // ? const SizedBox() + // : InkWell( + // onTap: () async { + // var result = + // await FilePickerMethod() + // .pickFile(); + // if (result != + // null) { + // contactUsController + // .attachmentPathNameDetailsList + // .clear(); + + // for (var a + // in result) { + // contactUsController + // .attachmentFileDetailsList + // .add(a); + // } + + // for (var a + // in contactUsController + // .attachmentFileDetailsList) { + // contactUsController + // .attachmentPathNameDetailsList + // .add(FilePickerMethod().extractFileName( + // a?.path ?? + // '')); + // } + // } + // }, + // child: Row( + // mainAxisAlignment: + // MainAxisAlignment + // .end, + // children: [ + // SvgPicture.asset( + // "assets/images/svg/attachment_pin.svg"), + // const Gap(6), + // text12W400( + // "Add Attachment (Max 32MB / Optional)"), + // ], + // ), + // ), + const Gap(20), + Padding( + padding: const EdgeInsets + .symmetric( + // horizontal: 10, + vertical: 20), + child: SizedBox( + width: Get.width, + child: kycBtn( + text: "Submit", + onTap: () { + if (queriesTextController + .text + .isEmpty) { + utils.showToast( + "Text is required"); + } else { + ContactUsApi() + .addTicketMessageApi( + FormData + .fromMap({ + "description": + queriesTextController + .text, + "ticket_xid": + contactUsController + .ticketDetailsModel! + .data![0] + .id + })) + .then( + (value) { + Map + responseData = + Map.from(value.data); + utils.showToast( + responseData[ + "message"]); + contactUsController + .contactUsDetailsChatContent + .add({ + "initial_name": + "TS", + "date": contactUsController.formatedDateTimeMethod( + responseData["data"] + [ + "created_at"]), + "content": + responseData["data"] + [ + "response"], + }); + queriesTextController + .clear(); + }); + } + }, + bgClr: const Color( + 0xFF6C0000), + borderClr: + const Color( + 0xFF990000), + ), + ), ), ], ), - const Gap(18), - text16W400( - contactUsController - .contactUsDetailsChatContent[ - index]["content"], - ) - ], + ) + : Container( + width: 1.sw, + margin: + const EdgeInsets.symmetric( + vertical: 5, ), - )); - }), - ]), - ), - ) - ]), - ], + decoration: BoxDecoration( + color: + const Color(0xFF0C0C0C), + borderRadius: + BorderRadius.circular( + 8), + gradient: LinearGradient( + begin: const Alignment( + 0.98, -0.21), + end: const Alignment( + -0.98, 0.21), + colors: [ + Colors.white.withOpacity( + 0.03999999910593033), + Colors.white.withOpacity( + 0.05999999865889549) + ], + ), + border: Border.all( + width: 1, + color: const Color( + 0xFF3A3A3A))), + child: Padding( + padding: const EdgeInsets.all( + 12.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + mainAxisSize: + MainAxisSize.min, + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + children: [ + CircleAvatar( + radius: 18, + backgroundColor: + Colors.white, + child: Center( + child: text16W600( + contactUsController + .contactUsDetailsChatContent[ + index] + [ + "initial_name"], + clr: const Color( + 0xFF535353)), + ), + ), + text14W500( + contactUsController + .contactUsDetailsChatContent[ + index]["date"], + ), + ], + ), + const Gap(18), + text16W400( + contactUsController + .contactUsDetailsChatContent[ + index]["content"], + ) + ], + ), + )); + }), + ]), + ), + ) + ]), + ], + ), ), ), ), diff --git a/lib/view/Sidemenu/contactUs/contact_us_main.dart b/lib/view/Sidemenu/contactUs/contact_us_main.dart index ce6bd2b..365c3a7 100644 --- a/lib/view/Sidemenu/contactUs/contact_us_main.dart +++ b/lib/view/Sidemenu/contactUs/contact_us_main.dart @@ -1,5 +1,3 @@ -import 'dart:developer'; - import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:gap/gap.dart'; @@ -12,6 +10,7 @@ import 'package:traderscircuit/view_model/ContactUsApi/contact_us_api.dart'; import '../../../Utils/Common/CommonAppbar.dart'; import '../../../Utils/Common/commonBotton.dart'; import '../../../Utils/text.dart'; +import '../../../view_model/ProfileAPI/GetProfileApi.dart'; import '../../onBoarding/splashScreen1.dart'; import 'create_ticket_bottom_sheet.dart'; @@ -26,7 +25,6 @@ class _ContactUsMainScreenState extends State { ContactUsController contactUsController = Get.put(ContactUsController()); RxBool isEmpty = false.obs; - @override void initState() { contactUsController.isLoading.value == true; @@ -40,8 +38,25 @@ class _ContactUsMainScreenState extends State { if (responseData["message"] == "Data not found.") { isEmpty.value = true; } else { + contactUsController.allC.value = 0; + contactUsController.openC.value = 0; + contactUsController.closeC.value = 0; + contactUsController.resolvedC.value = 0; + contactUsController.contactModel = ContactUsModel.fromJson(value.data); + for (var a in contactUsController.contactModel.data!) { + if (a.status == 1) { + contactUsController.openC.value += 1; + contactUsController.allC.value += 1; + } else if (a.status == 2) { + contactUsController.closeC.value += 1; + contactUsController.allC.value += 1; + } else if (a.status == 3) { + contactUsController.resolvedC.value += 1; + contactUsController.allC.value += 1; + } + } } contactUsController.isLoading.value = false; }); @@ -87,7 +102,7 @@ class _ContactUsMainScreenState extends State { padding: const EdgeInsets.symmetric( horizontal: 16, vertical: 16), child: contactUsController.isLoading.value - ? Center( + ? const Center( child: CircularProgressIndicator( color: Colors.redAccent, )) @@ -98,8 +113,9 @@ class _ContactUsMainScreenState extends State { children: [ text25W600("Contact Us"), const Gap(20), - text16W400("Hi Afrid"), - text16W400("We are here to help you Us"), + text16W400( + "Hi ${ProfileObj!.data!.userName}"), + text16W400("We are here to help you"), const Gap(12), TabBar( tabAlignment: TabAlignment.start, @@ -122,10 +138,16 @@ class _ContactUsMainScreenState extends State { tabs: [ Tab( text: - "All Tickets (${contactUsController.contactModel.data!.length.toString()})"), - Tab(text: "Open Tickets (2)"), - Tab(text: "Closed (1)"), - Tab(text: "Resolved (1)"), + "All Tickets (${contactUsController.allC.value})"), + Tab( + text: + "Open Tickets (${contactUsController.openC.value})"), + Tab( + text: + "Closed (${contactUsController.closeC.value})"), + Tab( + text: + "Resolved (${contactUsController.resolvedC.value})"), ], ), SizedBox( @@ -139,22 +161,43 @@ class _ContactUsMainScreenState extends State { index, "ALL"); }), ListView.builder( - itemCount: dataL.length, + itemCount: contactUsController + .contactModel.data!.length, itemBuilder: (ctx, index) { - return ticketCardWidget( - index, "OPEN"); + return contactUsController + .contactModel + .data![index] + .status == + 1 + ? ticketCardWidget( + index, "OPEN") + : const SizedBox(); }), ListView.builder( - itemCount: dataL.length, + itemCount: contactUsController + .contactModel.data!.length, itemBuilder: (ctx, index) { - return ticketCardWidget( - index, "CLOSED"); + return contactUsController + .contactModel + .data![index] + .status == + 2 + ? ticketCardWidget( + index, "CLOSED") + : const SizedBox(); }), ListView.builder( - itemCount: dataL.length, + itemCount: contactUsController + .contactModel.data!.length, itemBuilder: (ctx, index) { - return ticketCardWidget( - index, "RESOLVED"); + return contactUsController + .contactModel + .data![index] + .status == + 3 + ? ticketCardWidget( + index, "RESOLVED") + : const SizedBox(); }), ]), ) @@ -170,271 +213,169 @@ class _ContactUsMainScreenState extends State { Widget ticketCardWidget(index, type) { ContactUsController contactUsController = Get.put(ContactUsController()); - return contactUsController.contactModel.data!.elementAt(index).status != 0 - ? InkWell( - onTap: () { - contactUsController.attachmentFileDetailsList.clear(); - contactUsController.attachmentPathNameDetailsList.clear(); + return InkWell( + onTap: () async { + contactUsController.attachmentFileDetailsList.clear(); + contactUsController.attachmentPathNameDetailsList.clear(); - Get.toNamed(RouteName.contactUsMainDetails, arguments: { - "id": contactUsController.contactModel.data! - .elementAt(index) - .id - .toString() - }); - }, - child: Container( - width: Get.width, - height: 195, - margin: EdgeInsets.only(bottom: 18, top: index == 0 ? 15 : 0), - decoration: ShapeDecoration( - gradient: LinearGradient( - begin: const Alignment(0.98, -0.21), - end: const Alignment(-0.98, 0.21), - colors: [ - Colors.white.withOpacity(0.03999999910593033), - Colors.white.withOpacity(0.05999999865889549) - ], - ), - shape: RoundedRectangleBorder( - side: const BorderSide(width: 1, color: Color(0xFF393939)), - borderRadius: BorderRadius.circular(8), - ), - ), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 15, - horizontal: 10, - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - text16W600(contactUsController.contactModel.data! - .elementAt(index) - .uniqueTicketId - .toString()), - Row( - children: [ - text16W500( - contactUsController.contactModel.data! - .elementAt(index) - .status == - 1 - ? "Open" - : contactUsController.contactModel.data! - .elementAt(index) - .status == - 2 - ? "Closed" - : "Resolved", - clr: contactUsController.contactModel.data! - .elementAt(index) - .status == - 1 - ? const Color(0xFFFFAD31) - : contactUsController.contactModel.data! - .elementAt(index) - .status == - 2 - ? const Color(0xFF95CCFF) - : const Color(0xFF34C759)), - const Gap(8), - CircleAvatar( - radius: 10, - backgroundColor: contactUsController - .contactModel.data! + var result = await Get.toNamed(RouteName.contactUsMainDetails, + arguments: { + "id": contactUsController.contactModel.data! + .elementAt(index) + .id + .toString() + }); + + if (result != null && result) { + contactUsController.isLoading.value = true; + ContactUsApi().getContactUsData().then((value) { + contactUsController.allC.value = 0; + contactUsController.openC.value = 0; + contactUsController.closeC.value = 0; + contactUsController.resolvedC.value = 0; + + contactUsController.contactModel = + ContactUsModel.fromJson(value.data); + for (var a in contactUsController.contactModel.data!) { + if (a.status == 1) { + contactUsController.openC.value += 1; + contactUsController.allC.value += 1; + } else if (a.status == 2) { + contactUsController.closeC.value += 1; + contactUsController.allC.value += 1; + } else if (a.status == 3) { + contactUsController.resolvedC.value += 1; + contactUsController.allC.value += 1; + } + } + + contactUsController.isLoading.value = false; + }); + } + }, + child: Container( + width: Get.width, + height: 195, + margin: EdgeInsets.only(bottom: 18, top: index == 0 ? 15 : 0), + decoration: ShapeDecoration( + gradient: LinearGradient( + begin: const Alignment(0.98, -0.21), + end: const Alignment(-0.98, 0.21), + colors: [ + Colors.white.withOpacity(0.03999999910593033), + Colors.white.withOpacity(0.05999999865889549) + ], + ), + shape: RoundedRectangleBorder( + side: const BorderSide(width: 1, color: Color(0xFF393939)), + borderRadius: BorderRadius.circular(8), + ), + ), + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 15, + horizontal: 10, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + text16W600(contactUsController.contactModel.data! + .elementAt(index) + .uniqueTicketId + .toString()), + Row( + children: [ + text16W500( + contactUsController.contactModel.data! + .elementAt(index) + .status == + 1 + ? "Open" + : contactUsController.contactModel.data! .elementAt(index) .status == - 1 - ? const Color(0xFFFFAD31) - : contactUsController.contactModel.data! - .elementAt(index) - .status == - 2 - ? const Color(0xFF95CCFF) - : const Color(0xFF34C759), - child: const Center( - child: Icon( - Icons.check_rounded, - size: 15, - color: Colors.white, - ), - ), - ) - ], + 2 + ? "Closed" + : "Resolved", + clr: contactUsController.contactModel.data! + .elementAt(index) + .status == + 1 + ? const Color(0xFFFFAD31) + : contactUsController.contactModel.data! + .elementAt(index) + .status == + 2 + ? const Color(0xFF95CCFF) + : const Color(0xFF34C759)), + const Gap(8), + CircleAvatar( + radius: 10, + backgroundColor: contactUsController.contactModel.data! + .elementAt(index) + .status == + 1 + ? const Color(0xFFFFAD31) + : contactUsController.contactModel.data! + .elementAt(index) + .status == + 2 + ? const Color(0xFF95CCFF) + : const Color(0xFF34C759), + child: const Center( + child: Icon( + Icons.check_rounded, + size: 15, + color: Colors.white, + ), ), - ], - ), - const Gap(10), - text16W600(contactUsController.formatedDateTimeMethod( - contactUsController.contactModel.data! - .elementAt(index) - .createdAt - .toString())), - const Gap(5), - text16W400(contactUsController.contactModel.data! - .elementAt(index) - .ticketCategory! - .name - .toString()), - const Gap(22), - Container( - padding: const EdgeInsets.symmetric( - horizontal: 12, - ), - width: Get.width, - height: 50, - decoration: ShapeDecoration( - color: Colors.black.withOpacity(0.03999999910593033), - shape: RoundedRectangleBorder( - side: const BorderSide( - width: 1, color: Color(0xFF393939)), - borderRadius: BorderRadius.circular(8), - ), - ), - child: Center( - child: text16W400( - contactUsController.contactModel.data! - .elementAt(index) - .description - .toString(), - clr: const Color(0xFF9E9E9E), - textOver: TextOverflow.ellipsis), - ), - ) - ], - ), + ) + ], + ), + ], ), - ), - ) - : contactUsController.contactModel.data!.elementAt(index).status != 1 && - type != "ALL" - ? InkWell( - onTap: () { - contactUsController.attachmentFileDetailsList.clear(); - contactUsController.attachmentPathNameDetailsList.clear(); - Get.toNamed(RouteName.contactUsMainDetails); - }, - child: Container( - width: Get.width, - height: 190, - margin: EdgeInsets.only(bottom: 18, top: index == 0 ? 15 : 0), - decoration: ShapeDecoration( - gradient: LinearGradient( - begin: const Alignment(0.98, -0.21), - end: const Alignment(-0.98, 0.21), - colors: [ - Colors.white.withOpacity(0.03999999910593033), - Colors.white.withOpacity(0.05999999865889549) - ], - ), - shape: RoundedRectangleBorder( - side: const BorderSide(width: 1, color: Color(0xFF393939)), - borderRadius: BorderRadius.circular(8), - ), - ), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 15, - horizontal: 10, - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - text16W600(contactUsController.contactModel.data! - .elementAt(index) - .ticketCategoryXid - .toString()), - Row( - children: [ - text16W500(dataL[index]["type"], - clr: dataL[index]["type"] == "OPEN" - ? const Color(0xFFFFAD31) - : dataL[index]["type"] == "CLOSED" - ? const Color(0xFF95CCFF) - : const Color(0xFF34C759)), - const Gap(8), - CircleAvatar( - radius: 10, - backgroundColor: dataL[index]["type"] == "OPEN" - ? const Color(0xFFFFAD31) - : dataL[index]["type"] == "CLOSED" - ? const Color(0xFF95CCFF) - : const Color(0xFF34C759), - child: const Center( - child: Icon( - Icons.check_rounded, - size: 15, - color: Colors.white, - ), - ), - ) - ], - ), - ], - ), - const Gap(10), - text16W600(dataL[index]["date"]), - const Gap(5), - text16W400(dataL[index]["category"]), - const Gap(22), - Container( - padding: const EdgeInsets.symmetric( - horizontal: 12, - ), - width: Get.width, - height: 50, - decoration: ShapeDecoration( - color: Colors.black.withOpacity(0.03999999910593033), - shape: RoundedRectangleBorder( - side: const BorderSide( - width: 1, color: Color(0xFF393939)), - borderRadius: BorderRadius.circular(8), - ), - ), - child: Center( - child: text16W400(dataL[index]["desc"], - clr: const Color(0xFF9E9E9E), - textOver: TextOverflow.ellipsis), - ), - ) - ], - ), + const Gap(10), + text16W600(contactUsController.formatedDateTimeMethod( + contactUsController.contactModel.data! + .elementAt(index) + .createdAt + .toString())), + const Gap(5), + text16W400(contactUsController.contactModel.data! + .elementAt(index) + .ticketCategory! + .name + .toString()), + const Gap(22), + Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + ), + width: Get.width, + height: 50, + decoration: ShapeDecoration( + color: Colors.black.withOpacity(0.03999999910593033), + shape: RoundedRectangleBorder( + side: const BorderSide(width: 1, color: Color(0xFF393939)), + borderRadius: BorderRadius.circular(8), ), ), + child: Center( + child: text16W400( + contactUsController.contactModel.data! + .elementAt(index) + .description + .toString(), + clr: const Color(0xFF9E9E9E), + textOver: TextOverflow.ellipsis), + ), ) - : SizedBox(); + ], + ), + ), + ), + ); } - -List dataL = [ - { - "id": "#13569412", - "date": "16 Feb 2024, 11 : 35PM", - "category": "Account Management", - "desc": - "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500. Lorem Ipsum has been the industry's standard dummy text ever since the 1500", - "type": "OPEN" - }, - { - "id": "#13569412", - "date": "16 Feb 2024, 11 : 35PM", - "category": "Technical Support", - "desc": - "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500. Lorem Ipsum has been the industry's standard dummy text ever since the 1500", - "type": "CLOSED" - }, - { - "id": "#13569412", - "date": "16 Feb 2024, 11 : 35PM", - "category": "Feedback and Suggestions", - "desc": - "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500. Lorem Ipsum has been the industry's standard dummy text ever since the 1500", - "type": "RESOLVED" - } -]; diff --git a/lib/view/Sidemenu/contactUs/create_ticket_bottom_sheet.dart b/lib/view/Sidemenu/contactUs/create_ticket_bottom_sheet.dart index dbe75c7..072a8a1 100644 --- a/lib/view/Sidemenu/contactUs/create_ticket_bottom_sheet.dart +++ b/lib/view/Sidemenu/contactUs/create_ticket_bottom_sheet.dart @@ -76,11 +76,6 @@ class CreateTicketBottomSheet { } } - log({ - "description": descriptionController.text, - "ticket_category_xid": ticketid, - "files[]": ticketlist, - }.toString()); Utils.loader(); FormData formdata = FormData.fromMap({ "description": descriptionController.text, @@ -90,16 +85,35 @@ class CreateTicketBottomSheet { final resp = await ContactUsApi().addTicketApi(formdata); if (resp.status == ResponseStatus.SUCCESS) { + Map responseData = + Map.from(resp.data); + int id = responseData["data"]["unique_ticket_id"]; Get.back(); contactUsController.isLoading.value = true; + contactUsController.allC.value = 0; + contactUsController.openC.value = 0; + contactUsController.closeC.value = 0; + contactUsController.resolvedC.value = 0; + contactUsController.selectedValue.value = ""; ContactUsApi().getContactUsData().then((value) { contactUsController.contactModel = ContactUsModel.fromJson(value.data); - + for (var a in contactUsController.contactModel.data!) { + if (a.status == 1) { + contactUsController.openC.value += 1; + contactUsController.allC.value += 1; + } else if (a.status == 2) { + contactUsController.closeC.value += 1; + contactUsController.allC.value += 1; + } else if (a.status == 3) { + contactUsController.resolvedC.value += 1; + contactUsController.allC.value += 1; + } + } contactUsController.isLoading.value = false; }); print("success"); - TicketConfirmedBottomSheet().bottomSheet(context); + TicketConfirmedBottomSheet().bottomSheet(context, id); } else if (resp.status == ResponseStatus.PRIVATE) { Get.back(); String? message = resp.data['message']; @@ -130,178 +144,182 @@ class CreateTicketBottomSheet { ), builder: (BuildContext context) { return Obx( - () => Container( - padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 20), - child: Wrap( - children: [ - Form( - key: _addTicketform, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.end, - mainAxisAlignment: MainAxisAlignment.end, - children: [ - GestureDetector( - onTap: () { - Get.back(); - }, - child: SvgPicture.asset( - "assets/images/svg/cross_cancel.svg")), - ], - ), - const Gap(16), - text18W600("Raise a Ticket"), - const Gap(20), - CustomDropDownWidget( - header: "Choose your query", - listData: namesList, - title: "", - type: "ticket", - ), - const Gap(14), - Stack( - children: [ - CustomTextFormField3( - texttype: TextInputType.multiline, - hintText: "Description (min 30 characters)", - textEditingController: descriptionController, - maxlines: 8, - validator: (value) { - if (value.isEmpty) { - return 'Enter your description'; - } else if (value.toString().length < 30) { - return 'Description should be minimum 30 characters'; - } - return null; - }, - inputFormatters: [ - LengthLimitingTextInputFormatter(150), - ], - ), - contactUsController.attachmentPathNameList.isEmpty - ? const SizedBox() - : Positioned( - bottom: 8, - left: 9, - right: 9, - child: SizedBox( - width: 1.sw, - height: 37.h, - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemCount: contactUsController - .attachmentPathNameList.length, - itemBuilder: (ctx, index) { - return Container( - width: 210.w, - height: 37.h, - margin: - const EdgeInsets.only(right: 5), - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(8), - border: Border.all( - width: 1, - color: const Color( - 0xFF3A3A3A))), - child: Row( - mainAxisAlignment: - MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.center, - children: [ - const Gap(6), - SvgPicture.asset( - "assets/images/svg/attachment_pin.svg"), - const Gap(6), - SizedBox( - width: 120, - child: FittedBox( - child: text12W400( - contactUsController - .attachmentPathNameList[ - index]))), - const Gap(15), - GestureDetector( - onTap: () { - contactUsController - .attachmentPathNameList - .removeAt(index); - contactUsController - .attachmentFileList - .removeAt(index); - }, - child: SvgPicture.asset( - "assets/images/svg/cross_cancel.svg", - color: const Color( - 0xFF818181), - width: 8, - height: 8, - )), - ], - ), - ); - }), - )) - ], - ), - contactUsController.attachmentPathNameList.length >= 3 - ? const SizedBox() - : const Gap(10), - contactUsController.attachmentPathNameList.length >= 3 - ? const SizedBox() - : InkWell( - onTap: () async { - var result = - await FilePickerMethod().pickFile(); - if (result != null) { - contactUsController.attachmentPathNameList - .clear(); - - for (var a in result) { - contactUsController.attachmentFileList - .add(a); - } - - for (var a in contactUsController - .attachmentFileList) { - contactUsController.attachmentPathNameList - .add(FilePickerMethod() - .extractFileName(a?.path ?? '')); - } - } - }, - child: Row( - children: [ - SvgPicture.asset( - "assets/images/svg/attachment_pin.svg"), - const Gap(5), - text12W400( - "Add Attachment (Max 3 files of 2MB each / Optional)"), - ], - ), - ), - const Gap(20), - SizedBox( - width: Get.width, - child: kycBtn( - text: "Create Ticket", - onTap: () { - Get.back(); - // TicketConfirmedBottomSheet().bottomSheet(context); - _addTicket(); - }, - bgClr: const Color(0xFF6C0000), - borderClr: const Color(0xFF990000), + () => Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom), + child: Container( + padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 20), + child: Wrap( + children: [ + Form( + key: _addTicketform, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + GestureDetector( + onTap: () { + Get.back(); + }, + child: SvgPicture.asset( + "assets/images/svg/cross_cancel.svg")), + ], ), - ), - const Gap(30), - ], - ), - ) - ], + const Gap(16), + text18W600("Raise a Ticket"), + const Gap(20), + CustomDropDownWidget( + header: "Choose your query", + listData: namesList, + title: "", + type: "ticket", + ), + const Gap(14), + Stack( + children: [ + CustomTextFormField3( + texttype: TextInputType.multiline, + hintText: "Description (min 30 characters)", + textEditingController: descriptionController, + maxlines: 8, + validator: (value) { + if (value.isEmpty) { + return 'Enter your description'; + } else if (value.toString().length < 30) { + return 'Description should be minimum 30 characters'; + } + return null; + }, + inputFormatters: [ + LengthLimitingTextInputFormatter(150), + ], + ), + contactUsController.attachmentPathNameList.isEmpty + ? const SizedBox() + : Positioned( + bottom: 8, + left: 9, + right: 9, + child: SizedBox( + width: 1.sw, + height: 37.h, + child: ListView.builder( + scrollDirection: Axis.horizontal, + itemCount: contactUsController + .attachmentPathNameList.length, + itemBuilder: (ctx, index) { + return Container( + width: 210.w, + height: 37.h, + margin: const EdgeInsets.only( + right: 5), + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(8), + border: Border.all( + width: 1, + color: const Color( + 0xFF3A3A3A))), + child: Row( + mainAxisAlignment: + MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + const Gap(6), + SvgPicture.asset( + "assets/images/svg/attachment_pin.svg"), + const Gap(6), + SizedBox( + width: 120, + child: FittedBox( + child: text12W400( + contactUsController + .attachmentPathNameList[ + index]))), + const Gap(15), + GestureDetector( + onTap: () { + contactUsController + .attachmentPathNameList + .removeAt(index); + contactUsController + .attachmentFileList + .removeAt(index); + }, + child: SvgPicture.asset( + "assets/images/svg/cross_cancel.svg", + color: const Color( + 0xFF818181), + width: 8, + height: 8, + )), + ], + ), + ); + }), + )) + ], + ), + contactUsController.attachmentPathNameList.length >= 3 + ? const SizedBox() + : const Gap(10), + contactUsController.attachmentPathNameList.length >= 3 + ? const SizedBox() + : InkWell( + onTap: () async { + var result = + await FilePickerMethod().pickFile(); + if (result != null) { + contactUsController.attachmentPathNameList + .clear(); + + for (var a in result) { + contactUsController.attachmentFileList + .add(a); + } + + for (var a in contactUsController + .attachmentFileList) { + contactUsController.attachmentPathNameList + .add(FilePickerMethod() + .extractFileName(a?.path ?? '')); + } + } + }, + child: Row( + children: [ + SvgPicture.asset( + "assets/images/svg/attachment_pin.svg"), + const Gap(5), + text12W400( + "Add Attachment (Max 3 files of 2MB each / Optional)"), + ], + ), + ), + const Gap(20), + SizedBox( + width: Get.width, + child: kycBtn( + text: "Create Ticket", + onTap: () { + Get.back(); + // TicketConfirmedBottomSheet().bottomSheet(context); + _addTicket(); + }, + bgClr: const Color(0xFF6C0000), + borderClr: const Color(0xFF990000), + ), + ), + const Gap(30), + ], + ), + ) + ], + ), ), ), ); diff --git a/lib/view/Sidemenu/contactUs/ticket_confirmed_bottom_sheet.dart b/lib/view/Sidemenu/contactUs/ticket_confirmed_bottom_sheet.dart index b419b62..bfcd579 100644 --- a/lib/view/Sidemenu/contactUs/ticket_confirmed_bottom_sheet.dart +++ b/lib/view/Sidemenu/contactUs/ticket_confirmed_bottom_sheet.dart @@ -11,6 +11,7 @@ import '../../../Utils/Common/commonBotton.dart'; class TicketConfirmedBottomSheet { bottomSheet( BuildContext context, + int id, ) { return showModalBottomSheet( useSafeArea: true, @@ -52,7 +53,7 @@ class TicketConfirmedBottomSheet { height: 140, ), const Gap(10), - text18W600("#18663765"), + text18W600("#$id"), const Gap(8), text18W400( "Your ticket has been created successfully. our support team will get back to you in 24-48 business hours.", diff --git a/lib/view/Sidemenu/myProfile/my_profile_screen.dart b/lib/view/Sidemenu/myProfile/my_profile_screen.dart index b52c893..2022b0b 100644 --- a/lib/view/Sidemenu/myProfile/my_profile_screen.dart +++ b/lib/view/Sidemenu/myProfile/my_profile_screen.dart @@ -44,7 +44,6 @@ class _MyProfileScreenState extends State { @override void initState() { - // TODO: implement initState myfuture = GetProfile().GetProfileAPI().then((value) { profileModel = ProfileModel.fromJson(value.data); fullNameController.text = ProfileObj!.data!.userName ?? "User"; @@ -113,7 +112,7 @@ class _MyProfileScreenState extends State { } else { if (editProfileImage.profilePicPath.value.isEmpty) { imageFile = await Helper.networkImageToMultipartFile( - "${ProfileObj!.data!.profilePhoto ?? ""}", + ProfileObj!.data!.profilePhoto ?? "", ); } else { imageFile = await MultipartFile.fromFile( @@ -280,33 +279,38 @@ class _MyProfileScreenState extends State { )), ), ), - Positioned( - right: 0, - bottom: 0, - child: GestureDetector( - onTap: () { - ImageUploadBottomSheet().showModal( - context, - false, - (result) { - print("File path is $result"); - editProfileImage.profilePicPath - .value = result; - }, - ); - }, - child: CircleAvatar( - radius: 20.r, - backgroundColor: - const Color(0xFF5A5A5A), - child: Icon( - Icons.camera_alt_outlined, - size: 20.sp, - color: Colors.white, + !isEdit.value + ? SizedBox() + : Positioned( + right: 0, + bottom: 0, + child: GestureDetector( + onTap: () { + ImageUploadBottomSheet() + .showModal( + context, + false, + (result) { + print( + "File path is $result"); + editProfileImage + .profilePicPath + .value = result; + }, + ); + }, + child: CircleAvatar( + radius: 20.r, + backgroundColor: + const Color(0xFF5A5A5A), + child: Icon( + Icons.camera_alt_outlined, + size: 20.sp, + color: Colors.white, + ), + ), + ), ), - ), - ), - ), ], ), ), diff --git a/lib/view/login/VerifyOtp.dart b/lib/view/login/VerifyOtp.dart index 6582545..978cbe5 100644 --- a/lib/view/login/VerifyOtp.dart +++ b/lib/view/login/VerifyOtp.dart @@ -71,15 +71,16 @@ class _VerifyOTPState extends State { // ProfileApi().GetProfileApi().then( // (value) { - isSecuredAccess == 0 - ? Get.toNamed(RouteName.secureaccess) - : isProfileUpdated == 0 - ? Get.toNamed(RouteName.adddetails) - : isKycUpdated == 0 - ? Get.toNamed(RouteName.kyc) - : isriskProfileUpdated == 0 - ? Get.toNamed(RouteName.updateriskprofile) - : Get.toNamed(RouteName.mainscreen); + // isSecuredAccess == 0 + // ? Get.toNamed(RouteName.secureaccess) + // : + isProfileUpdated == 0 + ? Get.toNamed(RouteName.adddetails) + : isKycUpdated == 0 + ? Get.toNamed(RouteName.kyc) + : isriskProfileUpdated == 0 + ? Get.toNamed(RouteName.updateriskprofile) + : Get.toNamed(RouteName.mainscreen); // Get.toNamed(RouteName.mainscreen); // }, diff --git a/lib/view_model/ContactUsApi/contact_us_api.dart b/lib/view_model/ContactUsApi/contact_us_api.dart index acb6c85..73f9452 100644 --- a/lib/view_model/ContactUsApi/contact_us_api.dart +++ b/lib/view_model/ContactUsApi/contact_us_api.dart @@ -29,7 +29,7 @@ class ContactUsApi { data, ApiUrls.addTicket, ); - + log(response.toString()); if (response.status == ResponseStatus.SUCCESS) { Map responseData = Map.from(response.data); @@ -97,4 +97,23 @@ class ContactUsApi { } return response; } + + Future> updateTicketStatusApi(data) async { + final response = await NetworkApiServices().postApi( + data, + ApiUrls.updateTicketStatusApi, + ); + + if (response.status == ResponseStatus.SUCCESS) { + Map responseData = + Map.from(response.data); + if (responseData['status'] == "success") { + print("token is $response"); + } else { + return ResponseData( + responseData['message'], ResponseStatus.FAILED); + } + } + return response; + } } diff --git a/pubspec.lock b/pubspec.lock index 0a94cf1..8e1ebfe 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -109,10 +109,10 @@ packages: dependency: transitive description: name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 url: "https://pub.dev" source: hosted - version: "1.18.0" + version: "1.17.2" connectivity_plus: dependency: "direct main" description: @@ -676,10 +676,10 @@ packages: dependency: transitive description: name: meta - sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.9.1" mime: dependency: transitive description: @@ -961,18 +961,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 url: "https://pub.dev" source: hosted - version: "1.11.1" + version: "1.11.0" stream_channel: dependency: transitive description: name: stream_channel - sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.1" string_scanner: dependency: transitive description: @@ -1057,10 +1057,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.6.0" typed_data: dependency: transitive description: @@ -1266,10 +1266,10 @@ packages: dependency: transitive description: name: web - sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 url: "https://pub.dev" source: hosted - version: "0.3.0" + version: "0.1.4-beta" win32: dependency: transitive description: @@ -1295,5 +1295,5 @@ packages: source: hosted version: "6.3.0" sdks: - dart: ">=3.2.0-194.0.dev <4.0.0" + dart: ">=3.1.0 <4.0.0" flutter: ">=3.13.0"