@@ -1,6 +1,7 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.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';
|
||||
@@ -29,11 +30,38 @@ class ContactUsController extends GetxController {
|
||||
|
||||
RxString selectedValue = "".obs;
|
||||
|
||||
|
||||
RxInt allC = 0.obs;
|
||||
RxInt openC = 0.obs;
|
||||
RxInt closeC = 0.obs;
|
||||
RxInt resolvedC = 0.obs;
|
||||
|
||||
//formated date
|
||||
String formatedDateTimeMethod(String originalDateTimeString) {
|
||||
DateTime dateTime = DateTime.parse(originalDateTimeString);
|
||||
|
||||
return DateFormat("dd MMM yyyy, hh:mm a").format(dateTime.toLocal());
|
||||
}
|
||||
|
||||
RxList<dynamic> contactUsDetailsChatContent = [
|
||||
{
|
||||
"initial_name": "SM",
|
||||
"date": "16 Feb 2024, 11 : 35PM",
|
||||
"content": """ Dear Customer,
|
||||
Thank you for contacting Traders Circuit
|
||||
|
||||
Your Service reference no is 18663765
|
||||
|
||||
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.
|
||||
|
||||
String formatedDateTimeMethod(String originalDateTimeString) {
|
||||
DateTime dateTime = DateTime.parse(originalDateTimeString);
|
||||
|
||||
|
||||
return DateFormat("dd MMM yyyy, hh:mm a").format(dateTime.toLocal());
|
||||
}
|
||||
|
||||
RxList<dynamic> contactUsDetailsChatContent = [].obs;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,216 @@
|
||||
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';
|
||||
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 '../../../view_model/ProfileAPI/GetProfileApi.dart';
|
||||
import '../../onBoarding/splashScreen1.dart';
|
||||
import 'create_ticket_bottom_sheet.dart';
|
||||
|
||||
class ContactUsMainScreen extends StatefulWidget {
|
||||
const ContactUsMainScreen({super.key});
|
||||
|
||||
@override
|
||||
State<ContactUsMainScreen> createState() => _ContactUsMainScreenState();
|
||||
}
|
||||
|
||||
class _ContactUsMainScreenState extends State<ContactUsMainScreen> {
|
||||
ContactUsController contactUsController = Get.put(ContactUsController());
|
||||
|
||||
RxBool isEmpty = false.obs;
|
||||
@override
|
||||
void initState() {
|
||||
contactUsController.isLoading.value == true;
|
||||
ContactUsApi().getContactUsCategoriesData().then((value) {
|
||||
contactUsController.contactCatModel =
|
||||
ContactUsCatModel.fromJson(value.data);
|
||||
|
||||
ContactUsApi().getContactUsData().then((value) {
|
||||
Map<String, dynamic> responseData =
|
||||
Map<String, dynamic>.from(value.data);
|
||||
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;
|
||||
});
|
||||
});
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@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
|
||||
? const Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.redAccent,
|
||||
))
|
||||
: isEmpty.value
|
||||
? Center(child: text18W800("No Data Available"))
|
||||
: ListView(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
children: [
|
||||
text25W600("Contact Us"),
|
||||
const Gap(20),
|
||||
text16W400(
|
||||
"Hi ${ProfileObj!.data!.userName}"),
|
||||
text16W400("We are here to help you"),
|
||||
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.allC.value})"),
|
||||
Tab(
|
||||
text:
|
||||
"Open Tickets (${contactUsController.openC.value})"),
|
||||
Tab(
|
||||
text:
|
||||
"Closed (${contactUsController.closeC.value})"),
|
||||
Tab(
|
||||
text:
|
||||
"Resolved (${contactUsController.resolvedC.value})"),
|
||||
],
|
||||
),
|
||||
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: contactUsController
|
||||
.contactModel.data!.length,
|
||||
itemBuilder: (ctx, index) {
|
||||
return contactUsController
|
||||
.contactModel
|
||||
.data![index]
|
||||
.status ==
|
||||
1
|
||||
? ticketCardWidget(
|
||||
index, "OPEN")
|
||||
: const SizedBox();
|
||||
}),
|
||||
ListView.builder(
|
||||
itemCount: contactUsController
|
||||
.contactModel.data!.length,
|
||||
itemBuilder: (ctx, index) {
|
||||
return contactUsController
|
||||
.contactModel
|
||||
.data![index]
|
||||
.status ==
|
||||
2
|
||||
? ticketCardWidget(
|
||||
index, "CLOSED")
|
||||
: const SizedBox();
|
||||
}),
|
||||
ListView.builder(
|
||||
itemCount: contactUsController
|
||||
.contactModel.data!.length,
|
||||
itemBuilder: (ctx, index) {
|
||||
return contactUsController
|
||||
.contactModel
|
||||
.data![index]
|
||||
.status ==
|
||||
3
|
||||
? ticketCardWidget(
|
||||
index, "RESOLVED")
|
||||
: const SizedBox();
|
||||
}),
|
||||
]),
|
||||
)
|
||||
],
|
||||
)),
|
||||
]),
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Widget ticketCardWidget(index, type) {
|
||||
ContactUsController contactUsController = Get.put(ContactUsController());
|
||||
return InkWell(
|
||||
|
||||
33
pubspec.lock
33
pubspec.lock
@@ -553,13 +553,13 @@ packages:
|
||||
source: hosted
|
||||
version: "1.5.4"
|
||||
intl:
|
||||
dependency: transitive
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: intl
|
||||
sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
|
||||
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.18.1"
|
||||
version: "0.19.0"
|
||||
js:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -612,10 +612,10 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: local_auth
|
||||
sha256: "27679ed8e0d7daab2357db6bb7076359e083a56b295c0c59723845301da6aed9"
|
||||
sha256: "280421b416b32de31405b0a25c3bd42dfcef2538dfbb20c03019e02a5ed55ed0"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.8"
|
||||
version: "2.2.0"
|
||||
local_auth_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -624,14 +624,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.37"
|
||||
local_auth_ios:
|
||||
local_auth_darwin:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: local_auth_ios
|
||||
sha256: eb283b530029b334698918f1e282d4483737cbca972ff21b9193be3d6de8e2b8
|
||||
name: local_auth_darwin
|
||||
sha256: "33381a15b0de2279523eca694089393bb146baebdce72a404555d03174ebc1e9"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.6"
|
||||
version: "1.2.2"
|
||||
local_auth_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -993,18 +993,18 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: syncfusion_flutter_pdf
|
||||
sha256: e97daea47f9ac4cf25cc8fc11a0475580ad9c592056d9c2bdc809c73e276decf
|
||||
sha256: a42186922a416c2c9634a8f221aee261101babc2d30b1a1e908a7f034e743046
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "21.2.10"
|
||||
version: "21.2.4"
|
||||
syncfusion_flutter_pdfviewer:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: syncfusion_flutter_pdfviewer
|
||||
sha256: fdd2ff565cd42247b8e86e26304329bae924fdfe8ddc1f4a3a264916f6c1ff1f
|
||||
sha256: "2dc016f251c675f8e4923135c485356473b4d89c677670164292159cd1dd4f45"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "21.2.10"
|
||||
version: "21.2.3"
|
||||
syncfusion_pdfviewer_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1295,5 +1295,8 @@ packages:
|
||||
source: hosted
|
||||
version: "6.3.0"
|
||||
sdks:
|
||||
dart: ">=3.1.0 <4.0.0"
|
||||
flutter: ">=3.13.0"
|
||||
|
||||
dart: ">=3.2.3 <4.0.0"
|
||||
flutter: ">=3.16.6"
|
||||
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ dependencies:
|
||||
audio_video_progress_bar: ^2.0.2
|
||||
syncfusion_flutter_pdfviewer:
|
||||
flutter_html: ^3.0.0-beta.2
|
||||
intl: ^0.19.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
Reference in New Issue
Block a user