@@ -1,216 +1,3 @@
|
||||
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(
|
||||
|
||||
@@ -116,16 +116,16 @@ class CreateTicketBottomSheet {
|
||||
TicketConfirmedBottomSheet().bottomSheet(context, id);
|
||||
} else if (resp.status == ResponseStatus.PRIVATE) {
|
||||
Get.back();
|
||||
String? message = resp.data['message'];
|
||||
Utils.showToast("$message");
|
||||
List? message = resp.data['message'];
|
||||
Utils.showToast("${message!.first}");
|
||||
} else if (resp.status == ResponseStatus.ERROR) {
|
||||
Get.back();
|
||||
String? message = resp.data['message'];
|
||||
Utils.showToast("$message");
|
||||
List? message = resp.data['message'];
|
||||
Utils.showToast("${message!.first}");
|
||||
} else {
|
||||
Get.back();
|
||||
String? message = resp.data['message'];
|
||||
Utils.showToast("$message");
|
||||
List? message = resp.data['message'];
|
||||
Utils.showToast("${message!.first}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class ContactUsApi {
|
||||
Future<ResponseData<dynamic>> getContactUsData() async {
|
||||
final response =
|
||||
await NetworkApiServices().getApi(ApiUrls.getcontactus, isAuth: true);
|
||||
log(response.data.toString());
|
||||
// log(response.data.toString());
|
||||
if (response.status == ResponseStatus.SUCCESS) {
|
||||
Map<String, dynamic> responseData =
|
||||
Map<String, dynamic>.from(response.data);
|
||||
|
||||
Reference in New Issue
Block a user