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/Common/custom_drop_down.dart b/lib/Utils/Common/custom_drop_down.dart index d01cbf5..2493035 100644 --- a/lib/Utils/Common/custom_drop_down.dart +++ b/lib/Utils/Common/custom_drop_down.dart @@ -1,5 +1,3 @@ -import 'dart:math'; - import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:traderscircuit/controller/contact_us_controller.dart'; @@ -8,14 +6,17 @@ import 'package:traderscircuit/controller/risk_profile_controller.dart'; import '../text.dart'; class CustomDropDownWidget extends StatefulWidget { - const CustomDropDownWidget( - {super.key, - required this.header, - required this.title, - required this.listData}); + const CustomDropDownWidget({ + super.key, + required this.header, + required this.title, + required this.listData, + required this.type, + }); final String header; final String title; final List listData; + final String type; @override State createState() => _CustomDropDownWidgetState(); @@ -27,6 +28,9 @@ class _CustomDropDownWidgetState extends State { RiskProfileController riskProfileController = Get.put(RiskProfileController()); + RxBool onDropTap = false.obs; + RxString selectedValue = "".obs; + void updateOrAddData(String key, String value) { bool keyExists = false; for (int i = 0; i < riskProfileController.selectedData.length; i++) { @@ -45,6 +49,22 @@ class _CustomDropDownWidgetState extends State { } } + @override + void initState() { + if (widget.type == "risk") { + for (int i = 0; i < riskProfileController.selectedData.length; i++) { + Map item = riskProfileController.selectedData[i]; + if (item.containsKey(widget.title)) { + selectedValue.value = + riskProfileController.selectedData[i][widget.title]!; + + break; + } + } + super.initState(); + } + } + @override Widget build(BuildContext context) { return Obx( @@ -58,8 +78,7 @@ class _CustomDropDownWidgetState extends State { children: [ InkWell( onTap: () { - contactUsController.onDropTap.value = - !contactUsController.onDropTap.value; + onDropTap.value = !onDropTap.value; }, child: SizedBox( width: 398, @@ -90,7 +109,7 @@ class _CustomDropDownWidgetState extends State { ], ), border: Border( - top: contactUsController.onDropTap.value + top: onDropTap.value ? const BorderSide( width: 0, color: Color(0xFF393939)) : const BorderSide( @@ -115,9 +134,13 @@ class _CustomDropDownWidgetState extends State { left: 14, top: 16, child: Text( - contactUsController.selectedValue.isNotEmpty - ? contactUsController.selectedValue.value - : widget.header, + widget.type == "risk" + ? (selectedValue.isNotEmpty + ? selectedValue.value + : widget.header) + : (contactUsController.selectedValue.isNotEmpty + ? contactUsController.selectedValue.value + : widget.header), style: const TextStyle( color: Color(0xFFADADAD), fontSize: 16, @@ -130,7 +153,7 @@ class _CustomDropDownWidgetState extends State { Positioned( right: 14, top: 16, - child: contactUsController.onDropTap.value + child: onDropTap.value ? const Icon( Icons.keyboard_arrow_up_rounded, color: Colors.white, @@ -143,7 +166,7 @@ class _CustomDropDownWidgetState extends State { ), ), ), - !contactUsController.onDropTap.value + !onDropTap.value ? const SizedBox() : Opacity( opacity: 0.50, @@ -174,10 +197,12 @@ class _CustomDropDownWidgetState extends State { itemBuilder: (context, index) { return InkWell( onTap: () { - contactUsController.selectedValue.value = - widget.listData[index]; - contactUsController.onDropTap.value = - !contactUsController.onDropTap.value; + widget.type == "risk" + ? (selectedValue.value = + widget.listData[index]) + : (contactUsController.selectedValue.value = + widget.listData[index]); + onDropTap.value = !onDropTap.value; updateOrAddData( widget.title, widget.listData[index]); }, diff --git a/lib/Utils/api_urls.dart b/lib/Utils/api_urls.dart index 8a97cda..d7ad28e 100644 --- a/lib/Utils/api_urls.dart +++ b/lib/Utils/api_urls.dart @@ -58,4 +58,8 @@ class ApiUrls { static String contactuscategory = "${base}get-ticket-categories"; static String addTicket = "${base}store-ticket"; static String getcontactus = "${base}get-ticket-data"; + 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 new file mode 100644 index 0000000..c231427 --- /dev/null +++ b/lib/Utils/image_preview_screen.dart @@ -0,0 +1,56 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/material.dart'; +import 'package:gap/gap.dart'; +import 'package:get/get.dart'; +import 'package:traderscircuit/Utils/text.dart'; + +import '../view/onBoarding/splashScreen1.dart'; +import 'Common/CommonAppBar.dart'; + +class ImagePreviewScreen extends StatefulWidget { + const ImagePreviewScreen({super.key}); + + @override + State createState() => _ImagePreviewScreenState(); +} + +class _ImagePreviewScreenState extends State { + String image = Get.arguments["image"]; + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: CommonAppbar( + height: 75, + titleTxt: "", + customActionWidget: text16W400(""), + ), + backgroundColor: Colors.black, + extendBody: true, + body: Stack(children: [ + const CommonBlurLeft(), + const CommonBlurRight(), + Stack(children: [ + SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 18, vertical: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + text25W600("Image Preview"), + const Gap(20), + CachedNetworkImage( + imageUrl: image, + placeholder: (context, url) { + 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 34559a5..652ad10 100644 --- a/lib/controller/contact_us_controller.dart +++ b/lib/controller/contact_us_controller.dart @@ -3,9 +3,19 @@ import 'dart:io'; import 'package:get/get.dart'; 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; @@ -17,31 +27,13 @@ class ContactUsController extends GetxController { ContactUsCatModel contactCatModel = ContactUsCatModel(); ContactUsModel contactModel = ContactUsModel(); - RxBool onDropTap = false.obs; RxString selectedValue = "".obs; - RxList contactUsDetailsChatContent = [ - { - "initial_name": "SM", - "date": "16 Feb 2024, 11 : 35PM", - "content": """ Dear Customer, -Thank you for contacting Traders Circuit + String formatedDateTimeMethod(String originalDateTimeString) { + DateTime dateTime = DateTime.parse(originalDateTimeString); -Your Service reference no is 18663765 + return DateFormat("dd MMM yyyy, hh:mm a").format(dateTime.toLocal()); + } -when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to - -using 'Content here, content here', making it look like readable English. - -Regards, -Centralised Service Desk - -Traders Circuit""", - }, - { - "initial_name": "AM", - "date": "16 Feb 2024, 11 : 35PM", - "content": "Thank You.......", - } - ].obs; + RxList contactUsDetailsChatContent = [].obs; } diff --git a/lib/model/ContactUsModel/ticket_details_model.dart b/lib/model/ContactUsModel/ticket_details_model.dart new file mode 100644 index 0000000..346ad5a --- /dev/null +++ b/lib/model/ContactUsModel/ticket_details_model.dart @@ -0,0 +1,210 @@ +class TicketDetailsModel { + String? status; + int? statusCode; + String? message; + List? data; + + TicketDetailsModel({this.status, this.statusCode, this.message, this.data}); + + TicketDetailsModel.fromJson(Map json) { + status = json['status']; + statusCode = json['status_code']; + message = json['message']; + if (json['data'] != null) { + data = []; + json['data'].forEach((v) { + data!.add(Data.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = {}; + data['status'] = status; + data['status_code'] = statusCode; + data['message'] = message; + if (this.data != null) { + data['data'] = this.data!.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class Data { + int? id; + String? uniqueTicketId; + int? iamPrincipalXid; + int? ticketCategoryXid; + String? description; + int? status; + int? isActive; + String? createdAt; + TicketCategory? ticketCategory; + List? ticketFiles; + List? ticketResponses; + + Data( + {this.id, + this.uniqueTicketId, + this.iamPrincipalXid, + this.ticketCategoryXid, + this.description, + this.status, + this.isActive, + this.createdAt, + this.ticketCategory, + this.ticketFiles, + this.ticketResponses}); + + Data.fromJson(Map json) { + id = json['id']; + uniqueTicketId = json['unique_ticket_id']; + iamPrincipalXid = json['iam_principal_xid']; + ticketCategoryXid = json['ticket_category_xid']; + description = json['description']; + status = json['status']; + isActive = json['is_active']; + createdAt = json['created_at']; + ticketCategory = json['ticket_category'] != null + ? TicketCategory.fromJson(json['ticket_category']) + : null; + if (json['ticket_files'] != null) { + ticketFiles = []; + json['ticket_files'].forEach((v) { + ticketFiles!.add(TicketFiles.fromJson(v)); + }); + } + if (json['ticket_responses'] != null) { + ticketResponses = []; + json['ticket_responses'].forEach((v) { + ticketResponses!.add(TicketResponses.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = {}; + data['id'] = id; + data['unique_ticket_id'] = uniqueTicketId; + data['iam_principal_xid'] = iamPrincipalXid; + data['ticket_category_xid'] = ticketCategoryXid; + data['description'] = description; + data['status'] = status; + data['is_active'] = isActive; + data['created_at'] = createdAt; + if (ticketCategory != null) { + data['ticket_category'] = ticketCategory!.toJson(); + } + if (ticketFiles != null) { + data['ticket_files'] = ticketFiles!.map((v) => v.toJson()).toList(); + } + if (ticketResponses != null) { + data['ticket_responses'] = + ticketResponses!.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class TicketResponses { + int? id; + int? iamPrincipalXid; + int? ticketXid; + int? isAdminResponse; + String? response; + String? createdAt; + String? updatedAt; + + TicketResponses( + {this.id, + this.iamPrincipalXid, + this.ticketXid, + this.isAdminResponse, + this.response, + this.createdAt, + this.updatedAt}); + + TicketResponses.fromJson(Map json) { + id = json['id']; + iamPrincipalXid = json['iam_principal_xid']; + ticketXid = json['ticket_xid']; + isAdminResponse = json['is_admin_response']; + response = json['response']; + createdAt = json['created_at']; + updatedAt = json['updated_at']; + } + + Map toJson() { + final Map data = {}; + data['id'] = id; + data['iam_principal_xid'] = iamPrincipalXid; + data['ticket_xid'] = ticketXid; + data['is_admin_response'] = isAdminResponse; + data['response'] = response; + data['created_at'] = createdAt; + data['updated_at'] = updatedAt; + return data; + } +} + +class TicketCategory { + int? id; + String? name; + int? isActive; + String? createdAt; + + TicketCategory({this.id, this.name, this.isActive, this.createdAt}); + + TicketCategory.fromJson(Map json) { + id = json['id']; + name = json['name']; + isActive = json['is_active']; + createdAt = json['created_at']; + } + + Map toJson() { + final Map data = {}; + data['id'] = id; + data['name'] = name; + data['is_active'] = isActive; + data['created_at'] = createdAt; + return data; + } +} + +class TicketFiles { + int? id; + int? iamPrincipalXid; + int? ticketXid; + String? file; + int? isActive; + String? createdAt; + + TicketFiles( + {this.id, + this.iamPrincipalXid, + this.ticketXid, + this.file, + this.isActive, + this.createdAt}); + + TicketFiles.fromJson(Map json) { + id = json['id']; + iamPrincipalXid = json['iam_principal_xid']; + ticketXid = json['ticket_xid']; + file = json['file']; + isActive = json['is_active']; + createdAt = json['created_at']; + } + + Map toJson() { + final Map data = {}; + data['id'] = id; + data['iam_principal_xid'] = iamPrincipalXid; + data['ticket_xid'] = ticketXid; + data['file'] = file; + data['is_active'] = isActive; + data['created_at'] = createdAt; + return data; + } +} diff --git a/lib/view/Sidemenu/Sidemenu.dart b/lib/view/Sidemenu/Sidemenu.dart index 0d11845..bf91a5c 100644 --- a/lib/view/Sidemenu/Sidemenu.dart +++ b/lib/view/Sidemenu/Sidemenu.dart @@ -120,7 +120,7 @@ class _SideMenuState extends State { height: 80.h, decoration: ShapeDecoration( image: DecorationImage( - image: NetworkImage(ProfileObj!.data == null + image: NetworkImage(ProfileObj == null ? "" : ProfileObj!.data!.profilePhoto ?? ""), fit: BoxFit.fill, 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 641d7a6..03b25b7 100644 --- a/lib/view/Sidemenu/contactUs/contact_us_details.dart +++ b/lib/view/Sidemenu/contactUs/contact_us_details.dart @@ -1,14 +1,18 @@ +import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.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/dialogs.dart'; +import 'package:traderscircuit/Utils/image_preview_screen.dart'; import 'package:traderscircuit/controller/contact_us_controller.dart'; +import 'package:traderscircuit/model/ContactUsModel/ticket_details_model.dart'; +import 'package:traderscircuit/view_model/ContactUsApi/contact_us_api.dart'; import '../../../Utils/Common/CommonAppbar.dart'; import '../../../Utils/Common/CustomTextFormField.dart'; -import '../../../Utils/Common/FilePicker.dart'; import '../../../Utils/Common/commonBotton.dart'; import '../../../Utils/text.dart'; import '../../onBoarding/splashScreen1.dart'; @@ -24,366 +28,568 @@ class ContactUsDetailsScreen extends StatefulWidget { class _ContactUsDetailsScreenState extends State { ContactUsController contactUsController = Get.put(ContactUsController()); TextEditingController queriesTextController = TextEditingController(); + String id = Get.arguments["id"]; + @override + void initState() { + contactUsController.isDetailsLoading.value = true; + contactUsController.isTicketClosed = false; + contactUsController.contactUsDetailsChatContent.clear(); + ContactUsApi().getContactUsDetailsData(id).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.isDetailsLoading.value = false; + }); + + super.initState(); + } + @override 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(), - 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( + () => 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: [ - text22W600("#18663765"), - const Gap(10), - text16W500( - "RESOLVED", - clr: const Color(0xFF34C759), - ), - ], - ), - text16W400("16 Feb 2024, 11 : 35 PM"), - ], - ), - const Gap(15), - const Divider( - thickness: 1, - color: Color(0xFF242424), - ), - const Gap(20), - text16W600("Ticket Category"), - const Gap(10), - text16W400( - "It is a long established fact that a reader It is a long established fact that a reader It is a long established fact that a reader"), - 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: 6, - ), - decoration: BoxDecoration( - color: const Color(0xFF0C0C0C), - borderRadius: - BorderRadius.circular(4), - border: Border.all( - width: 1, - color: const Color(0xFF3A3A3A))), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + text25W600("Contact Us"), + const Gap(20), + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, 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]), - ), - ), - ], + 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), ), - 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( + 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( + vertical: 6, + ), + 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: [ - 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), + Row( + children: [ + const Gap(6), + SvgPicture.asset( + "assets/images/svg/attachment_pin.svg"), + const Gap(6), + text12W400( + "Attachment ${index + 1}"), ], ), - 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: + ), + ); + }), + 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( - // horizontal: 10, - vertical: 20), - child: SizedBox( - width: Get.width, - child: kycBtn( - text: "Submit", - onTap: () { - final isValid = queriesForm - .currentState - ?.validate(); - - if (isValid!) { - contactUsController - .contactUsDetailsChatContent - .add({ - "initial_name": "AM", - "date": - "16 Feb 2024, 11 : 35PM", - "content": - queriesTextController - .text, - }); - queriesTextController - .clear(); - } - }, - bgClr: - const Color(0xFF6C0000), - borderClr: - const Color(0xFF990000), - ), + vertical: 6, ), - ), - ], - ), - ) - : 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( + 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: [ - CircleAvatar( - radius: 18, - backgroundColor: - Colors.white, - child: Center( - child: text16W600( - contactUsController - .contactUsDetailsChatContent[ - index] - ["initial_name"], - clr: const Color( - 0xFF535353)), - ), - ), - text14W500( - contactUsController - .contactUsDetailsChatContent[ - index]["date"], + 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]), + ), + ), + ], ), + 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, + ), + )), ], ), - const Gap(18), - text16W400( + ); + }), + 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[ - index]["content"], - ) - ], - ), - )); - }), - ]), - ), - ) - ]), - ], + .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), + ), + ), + ), + ], + ), + ) + : 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 9e82b70..80066f9 100644 --- a/lib/view/Sidemenu/contactUs/contact_us_main.dart +++ b/lib/view/Sidemenu/contactUs/contact_us_main.dart @@ -1,798 +1,168 @@ -import 'dart:developer'; -import 'dart:ffi'; - -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:gap/gap.dart'; -import 'package:get/get.dart'; -import 'package:traderscircuit/controller/contact_us_controller.dart'; -import 'package:traderscircuit/model/ContactUsModel/contact_us_cat_model.dart'; -import 'package:traderscircuit/model/ContactUsModel/contact_us_model.dart' - as ContactModel; -import 'package:traderscircuit/model/ContactUsModel/contact_us_model.dart'; -import 'package:traderscircuit/resources/routes/route_name.dart'; -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 '../../onBoarding/splashScreen1.dart'; -import 'create_ticket_bottom_sheet.dart'; - -class ContactUsMainScreen extends StatefulWidget { - const ContactUsMainScreen({super.key}); - - @override - State createState() => _ContactUsMainScreenState(); -} - -Map> status1Map = {}; -Map> status2Map = {}; -Map> status3Map = {}; - -class _ContactUsMainScreenState extends State { - ContactUsController contactUsController = Get.put(ContactUsController()); - - @override - void initState() { - contactUsController.isLoading.value == true; - ContactUsApi().getContactUsCategoriesData().then((value) { - contactUsController.contactCatModel = - ContactUsCatModel.fromJson(value.data); - - ContactUsApi().getContactUsData().then((value) { - contactUsController.contactModel = ContactUsModel.fromJson(value.data); - contactUsController.isLoading.value = false; - log(contactUsController.isLoading.value.toString()); - status1Map.clear(); - status2Map.clear(); - status3Map.clear(); - // Iterate over the data and categorize them based on their status - for (var item in contactUsController.contactModel!.data!) { - if (item.status == 1) { - status1Map.putIfAbsent(item.status!, () => []).add(item); - } else if (item.status == 2) { - status2Map.putIfAbsent(item.status!, () => []).add(item); - } else if (item.status == 3) { - status3Map.putIfAbsent(item.status!, () => []).add(item); - } - } - }); - }); - super.initState(); - } - - @override - void dispose() { - status1Map.clear(); - status2Map.clear(); - status3Map.clear(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return Obx(() => DefaultTabController( - length: 4, - child: Scaffold( - appBar: CommonAppbar( - height: 75, - titleTxt: "", - customActionWidget: text16W400(""), - ), - backgroundColor: Colors.black, - extendBody: true, - bottomNavigationBar: Padding( - padding: const EdgeInsets.symmetric(horizontal: 17, vertical: 40), - child: SizedBox( - width: Get.width, - child: kycBtn( - text: "Create Ticket", - onTap: () { - contactUsController.attachmentFileList.clear(); - contactUsController.attachmentPathNameList.clear(); - CreateTicketBottomSheet().bottomSheet(context); - }, - bgClr: const Color(0xFF6C0000), - borderClr: const Color(0xFF990000), - ), - ), - ), - body: Stack( - children: [ - const CommonBlurLeft(), - const CommonBlurRight(), - Stack(children: [ - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 16, vertical: 16), - child: contactUsController.isLoading.value - ? Center( - child: CircularProgressIndicator( - color: Colors.redAccent, - )) - : contactUsController.contactModel.data!.isEmpty - ? Text("No Data Available") - : ListView( - physics: const NeverScrollableScrollPhysics(), - children: [ - text25W600("Contact Us"), - const Gap(20), - text16W400("Hi Afrid"), - text16W400("We are here to help you Us"), - const Gap(12), - TabBar( - tabAlignment: TabAlignment.start, - labelStyle: TextStyle( - fontSize: 18.sp, - fontWeight: FontWeight.w400, - fontFamily: "hiragino", - ), - isScrollable: true, - labelColor: Colors.white, - unselectedLabelColor: - const Color(0xFF464646), - indicatorColor: const Color(0xFF6C0000), - indicatorSize: TabBarIndicatorSize.tab, - unselectedLabelStyle: TextStyle( - fontSize: 18.sp, - fontWeight: FontWeight.w500, - fontFamily: "hiragino", - ), - tabs: [ - Tab( - text: - "All Tickets (${contactUsController.contactModel.data!.length.toString()})"), - Tab( - text: - "Open Tickets (${status1Map.values.expand((list) => list).length.toString()})"), - Tab( - text: - "Closed (${status2Map.values.expand((list) => list).length.toString()})"), - Tab( - text: - "Resolved (${status3Map.values.expand((list) => list).length.toString()})"), - ], - ), - SizedBox( - height: 0.5.sh, - child: TabBarView(children: [ - ListView.builder( - itemCount: contactUsController - .contactModel.data!.length, - itemBuilder: (ctx, index) { - return ticketCardWidget( - index, "ALL"); - }), - ListView.builder( - itemCount: status1Map.values - .expand((list) => list) - .length, - itemBuilder: (ctx, index) { - return ticketCardWidget( - index, "OPEN"); - }), - ListView.builder( - itemCount: status2Map.values - .expand((list) => list) - .length, - itemBuilder: (ctx, index) { - return ticketCardWidget( - index, "CLOSED"); - }), - ListView.builder( - itemCount: status3Map.values - .expand((list) => list) - .length, - itemBuilder: (ctx, index) { - return ticketCardWidget( - index, "RESOLVED"); - }), - ]), - ) - ], - )), - ]), - ], - ), - ), - )); - } -} - Widget ticketCardWidget(index, type) { ContactUsController contactUsController = Get.put(ContactUsController()); - return contactUsController.contactModel.data!.elementAt(index).status != 0 && - 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) - .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! + return InkWell( + onTap: () async { + contactUsController.attachmentFileDetailsList.clear(); + contactUsController.attachmentPathNameDetailsList.clear(); + + 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, - ), - ), - ) - ], - ), - ], - ), - const Gap(10), - text16W600(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), - ), - ) - ], - ), - ), - ), - ) - : type == "OPEN" - ? 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(status1Map.values - .expand((list) => list) - .elementAt(index) - .ticketCategoryXid - .toString()), - Row( - children: [ - text16W500( - status1Map.values - .expand((list) => list) - .elementAt(index) - .status - .toString() == - "1" - ? "OPEN" - : "Open", - clr: status1Map.values - .expand((list) => list) - .elementAt(index) - .status - .toString() == - "1" - ? const Color(0xFFFFAD31) - : status1Map.values - .expand((list) => list) - .elementAt(index) - .status - .toString() == - "2" - ? const Color(0xFF95CCFF) - : const Color(0xFF34C759)), - const Gap(8), - CircleAvatar( - radius: 10, - backgroundColor: status1Map.values - .expand((list) => list) - .elementAt(index) - .status - .toString() == - "1" - ? const Color(0xFFFFAD31) - : status1Map.values - .expand((list) => list) - .elementAt(index) - .status - .toString() == - "2" - ? const Color(0xFF95CCFF) - : const Color(0xFF34C759), - child: const Center( - child: Icon( - Icons.check_rounded, - size: 15, - color: Colors.white, - ), - ), - ) - ], - ), - ], - ), - const Gap(10), - text16W600(status1Map.values - .expand((list) => list) - .elementAt(index) - .createdAt - .toString()), - const Gap(5), - text16W400(status1Map.values - .expand((list) => list) - .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( - status1Map.values - .expand((list) => list) + 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) - .description - .toString(), - clr: const Color(0xFF9E9E9E), - textOver: TextOverflow.ellipsis), - ), - ) - ], - ), - ), - ), - ) - : type == "CLOSED" - ? 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(status2Map.values - .expand((list) => list) - .elementAt(index) - .ticketCategoryXid - .toString()), - Row( - children: [ - text16W500( - status2Map.values - .expand((list) => list) - .elementAt(index) - .status - .toString() == - "2" - ? "CLOSED" - : "Closed", - clr: status2Map.values - .expand((list) => list) - .elementAt(index) - .status - .toString() == - "1" - ? const Color(0xFFFFAD31) - : status2Map.values - .expand((list) => list) - .elementAt(index) - .status - .toString() == - "2" - ? const Color(0xFF95CCFF) - : const Color(0xFF34C759)), - const Gap(8), - CircleAvatar( - radius: 10, - backgroundColor: status2Map.values - .expand((list) => list) - .elementAt(index) - .status - .toString() == - "1" - ? const Color(0xFFFFAD31) - : status2Map.values - .expand((list) => list) - .elementAt(index) - .status - .toString() == - "2" - ? const Color(0xFF95CCFF) - : const Color(0xFF34C759), - child: const Center( - child: Icon( - Icons.check_rounded, - size: 15, - color: Colors.white, - ), - ), - ) - ], - ), - ], - ), - const Gap(10), - text16W600(status2Map.values - .expand((list) => list) - .elementAt(index) - .createdAt - .toString()), - const Gap(5), - text16W400(status2Map.values - .expand((list) => list) - .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( - status2Map.values - .expand((list) => list) + .status == + 1 + ? const Color(0xFFFFAD31) + : contactUsController.contactModel.data! .elementAt(index) - .description - .toString(), - clr: const Color(0xFF9E9E9E), - textOver: TextOverflow.ellipsis), - ), - ) - ], - ), - ), - ), - ) - : type == "RESOLVED" - ? 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(status3Map.values - .expand((list) => list) - .elementAt(index) - .ticketCategoryXid - .toString()), - Row( - children: [ - text16W500( - status3Map.values - .expand((list) => list) - .elementAt(index) - .status - .toString() == - "3" - ? "RESOLVED" - : "Resolved", - clr: status3Map.values - .expand((list) => list) - .elementAt(index) - .status - .toString() == - "1" - ? const Color(0xFFFFAD31) - : status3Map.values - .expand( - (list) => list) - .elementAt(index) - .status - .toString() == - "2" - ? const Color(0xFF95CCFF) - : const Color(0xFF34C759)), - const Gap(8), - CircleAvatar( - radius: 10, - backgroundColor: status3Map.values - .expand((list) => list) - .elementAt(index) - .status - .toString() == - "1" - ? const Color(0xFFFFAD31) - : status3Map.values - .expand((list) => list) - .elementAt(index) - .status - .toString() == - "2" - ? const Color(0xFF95CCFF) - : const Color(0xFF34C759), - child: const Center( - child: Icon( - Icons.check_rounded, - size: 15, - color: Colors.white, - ), - ), - ) - ], - ), - ], - ), - const Gap(10), - text16W600(status3Map.values - .expand((list) => list) - .elementAt(index) - .createdAt - .toString()), - const Gap(5), - text16W400(status3Map.values - .expand((list) => list) - .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( - status3Map.values - .expand((list) => list) - .elementAt(index) - .description - .toString(), - clr: const Color(0xFF9E9E9E), - textOver: TextOverflow.ellipsis), - ), - ) - ], - ), + .status == + 2 + ? const Color(0xFF95CCFF) + : const Color(0xFF34C759), + child: const Center( + child: Icon( + Icons.check_rounded, + size: 15, + color: Colors.white, ), ), ) - : SizedBox(); + ], + ), + ], + ), + 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), + ), + ) + ], + ), + ), + ), + ); } - -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 6d73381..0797b6f 100644 --- a/lib/view/Sidemenu/contactUs/create_ticket_bottom_sheet.dart +++ b/lib/view/Sidemenu/contactUs/create_ticket_bottom_sheet.dart @@ -1,3 +1,5 @@ +import 'dart:developer'; + import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -8,7 +10,6 @@ import 'package:get/get.dart' hide MultipartFile, FormData; import 'package:traderscircuit/Utils/base_manager.dart'; import 'package:traderscircuit/Utils/text.dart'; import 'package:traderscircuit/Utils/utils.dart'; -import 'package:traderscircuit/resources/routes/route_name.dart'; import 'package:traderscircuit/view_model/ContactUsApi/contact_us_api.dart'; import '../../../Utils/Common/CustomTextFormField.dart'; @@ -16,6 +17,7 @@ import '../../../Utils/Common/FilePicker.dart'; import '../../../Utils/Common/commonBotton.dart'; import '../../../Utils/Common/custom_drop_down.dart'; import '../../../controller/contact_us_controller.dart'; +import '../../../model/ContactUsModel/contact_us_model.dart'; import 'ticket_confirmed_bottom_sheet.dart'; import 'package:path/path.dart' as path; @@ -65,6 +67,15 @@ class CreateTicketBottomSheet { final isValid = _addTicketform.currentState?.validate(); if (isValid!) { + for (var item in contactUsController.contactCatModel.data!) { + log(item.name!); + log(contactUsController.selectedValue.toString()); + if (item.name == contactUsController.selectedValue.toString()) { + ticketid = item.id; + break; // Stop loop once match is found + } + } + Utils.loader(); FormData formdata = FormData.fromMap({ "description": descriptionController.text, @@ -74,9 +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(); List? message = resp.data['message']; @@ -107,177 +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: "", - ), - 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/UpdateRiskProfile.dart b/lib/view/login/UpdateRiskProfile.dart index e06be40..5a84500 100644 --- a/lib/view/login/UpdateRiskProfile.dart +++ b/lib/view/login/UpdateRiskProfile.dart @@ -202,6 +202,7 @@ class _UpdateRiskProfileState extends State { header: headerText, listData: dropHeader[index][tilte]!, title: tilte, + type: "risk", ), SizedBox( height: 35.h, 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 7e2ba2c..d5a9474 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); @@ -59,4 +59,61 @@ class ContactUsApi { } return response; } + + Future> getContactUsDetailsData( + String id, + ) async { + final response = await NetworkApiServices() + .getApi(ApiUrls.getcontactusDetails + id, isAuth: true); + log(response.data.toString()); + if (response.status == ResponseStatus.SUCCESS) { + Map responseData = + Map.from(response.data); + if (responseData['status'] == "success") { + return response; + } else { + return ResponseData( + responseData['message'], ResponseStatus.FAILED); + } + } + return response; + } + + Future> addTicketMessageApi(data) async { + final response = await NetworkApiServices().postApi( + data, + ApiUrls.sendMessage, + ); + + 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; + } + + 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"