Mowadhafi home & details page done
parent
dd146179ec
commit
cf523566cd
@ -0,0 +1,50 @@
|
|||||||
|
import 'package:mohem_flutter_app/api/api_client.dart';
|
||||||
|
import 'package:mohem_flutter_app/app_state/app_state.dart';
|
||||||
|
import 'package:mohem_flutter_app/classes/consts.dart';
|
||||||
|
import 'package:mohem_flutter_app/models/generic_response_model.dart';
|
||||||
|
import 'package:mohem_flutter_app/models/mowadhafhi/get_ticket_details.dart';
|
||||||
|
import 'package:mohem_flutter_app/models/mowadhafhi/get_ticket_transactions.dart';
|
||||||
|
|
||||||
|
import '../../models/mowadhafhi/get_tickets_list.dart';
|
||||||
|
|
||||||
|
class MowadhafhiApiClient {
|
||||||
|
static final MowadhafhiApiClient _instance = MowadhafhiApiClient._internal();
|
||||||
|
|
||||||
|
MowadhafhiApiClient._internal();
|
||||||
|
|
||||||
|
factory MowadhafhiApiClient() => _instance;
|
||||||
|
|
||||||
|
Future<List<GetTicketsByEmployeeList>> getTicketsByEmployee() async {
|
||||||
|
String url = "${ApiConsts.cocRest}Mohemm_ITG_GetTicketsByEmployee";
|
||||||
|
Map<String, dynamic> postParams = {"EmployeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER, "ItgPageSize": 10, "ItgPageNo": 1};
|
||||||
|
|
||||||
|
postParams.addAll(AppState().postParamsJson);
|
||||||
|
return await ApiClient().postJsonForObject((json) {
|
||||||
|
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
|
||||||
|
return responseData.getTicketsByEmployeeList ?? [];
|
||||||
|
}, url, postParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<List<GetTicketDetailsByEmployee>> getTicketDetailsByEmployee(String? itgTicketID) async {
|
||||||
|
String url = "${ApiConsts.cocRest}Mohemm_ITG_GetTicketDetails";
|
||||||
|
Map<String, dynamic> postParams = {"EmployeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER, "ItgTicketId": itgTicketID};
|
||||||
|
|
||||||
|
postParams.addAll(AppState().postParamsJson);
|
||||||
|
return await ApiClient().postJsonForObject((json) {
|
||||||
|
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
|
||||||
|
return responseData.getTicketDetailsByEmployee ?? [];
|
||||||
|
}, url, postParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<List<GetTicketTransactions>> getTicketTransactions(String? itgTicketID) async {
|
||||||
|
String url = "${ApiConsts.cocRest}Mohemm_ITG_GetTicketTransaction";
|
||||||
|
Map<String, dynamic> postParams = {"EmployeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER, "ItgTicketId": itgTicketID};
|
||||||
|
|
||||||
|
postParams.addAll(AppState().postParamsJson);
|
||||||
|
return await ApiClient().postJsonForObject((json) {
|
||||||
|
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
|
||||||
|
return responseData.getTicketTransactions ?? [];
|
||||||
|
}, url, postParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,80 @@
|
|||||||
|
class GetTicketDetailsByEmployee {
|
||||||
|
String? closedBy;
|
||||||
|
String? created;
|
||||||
|
int? departmentId;
|
||||||
|
String? departmentName;
|
||||||
|
String? description;
|
||||||
|
String? positionTitle;
|
||||||
|
int? projectId;
|
||||||
|
String? projectName;
|
||||||
|
int? sectionId;
|
||||||
|
String? sectionName;
|
||||||
|
String? ticketId;
|
||||||
|
String? ticketReferenceNo;
|
||||||
|
String? ticketStatusInternalName;
|
||||||
|
String? ticketStatusName;
|
||||||
|
int? ticketTypeId;
|
||||||
|
int? topicId;
|
||||||
|
String? topicName;
|
||||||
|
|
||||||
|
GetTicketDetailsByEmployee(
|
||||||
|
{this.closedBy,
|
||||||
|
this.created,
|
||||||
|
this.departmentId,
|
||||||
|
this.departmentName,
|
||||||
|
this.description,
|
||||||
|
this.positionTitle,
|
||||||
|
this.projectId,
|
||||||
|
this.projectName,
|
||||||
|
this.sectionId,
|
||||||
|
this.sectionName,
|
||||||
|
this.ticketId,
|
||||||
|
this.ticketReferenceNo,
|
||||||
|
this.ticketStatusInternalName,
|
||||||
|
this.ticketStatusName,
|
||||||
|
this.ticketTypeId,
|
||||||
|
this.topicId,
|
||||||
|
this.topicName});
|
||||||
|
|
||||||
|
GetTicketDetailsByEmployee.fromJson(Map<String, dynamic> json) {
|
||||||
|
closedBy = json['closedBy'];
|
||||||
|
created = json['created'];
|
||||||
|
departmentId = json['departmentId'];
|
||||||
|
departmentName = json['departmentName'];
|
||||||
|
description = json['description'];
|
||||||
|
positionTitle = json['positionTitle'];
|
||||||
|
projectId = json['projectId'];
|
||||||
|
projectName = json['projectName'];
|
||||||
|
sectionId = json['sectionId'];
|
||||||
|
sectionName = json['sectionName'];
|
||||||
|
ticketId = json['ticketId'];
|
||||||
|
ticketReferenceNo = json['ticketReferenceNo'];
|
||||||
|
ticketStatusInternalName = json['ticketStatusInternalName'];
|
||||||
|
ticketStatusName = json['ticketStatusName'];
|
||||||
|
ticketTypeId = json['ticketTypeId'];
|
||||||
|
topicId = json['topicId'];
|
||||||
|
topicName = json['topicName'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['closedBy'] = this.closedBy;
|
||||||
|
data['created'] = this.created;
|
||||||
|
data['departmentId'] = this.departmentId;
|
||||||
|
data['departmentName'] = this.departmentName;
|
||||||
|
data['description'] = this.description;
|
||||||
|
data['positionTitle'] = this.positionTitle;
|
||||||
|
data['projectId'] = this.projectId;
|
||||||
|
data['projectName'] = this.projectName;
|
||||||
|
data['sectionId'] = this.sectionId;
|
||||||
|
data['sectionName'] = this.sectionName;
|
||||||
|
data['ticketId'] = this.ticketId;
|
||||||
|
data['ticketReferenceNo'] = this.ticketReferenceNo;
|
||||||
|
data['ticketStatusInternalName'] = this.ticketStatusInternalName;
|
||||||
|
data['ticketStatusName'] = this.ticketStatusName;
|
||||||
|
data['ticketTypeId'] = this.ticketTypeId;
|
||||||
|
data['topicId'] = this.topicId;
|
||||||
|
data['topicName'] = this.topicName;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
class GetTicketTransactions {
|
||||||
|
String? actionBy;
|
||||||
|
String? actionDate;
|
||||||
|
String? comments;
|
||||||
|
String? statusDisplayText;
|
||||||
|
String? statusName;
|
||||||
|
String? ticketId;
|
||||||
|
int? ticketTransactionId;
|
||||||
|
|
||||||
|
GetTicketTransactions(
|
||||||
|
{this.actionBy,
|
||||||
|
this.actionDate,
|
||||||
|
this.comments,
|
||||||
|
this.statusDisplayText,
|
||||||
|
this.statusName,
|
||||||
|
this.ticketId,
|
||||||
|
this.ticketTransactionId});
|
||||||
|
|
||||||
|
GetTicketTransactions.fromJson(Map<String, dynamic> json) {
|
||||||
|
actionBy = json['actionBy'];
|
||||||
|
actionDate = json['actionDate'];
|
||||||
|
comments = json['comments'];
|
||||||
|
statusDisplayText = json['statusDisplayText'];
|
||||||
|
statusName = json['statusName'];
|
||||||
|
ticketId = json['ticketId'];
|
||||||
|
ticketTransactionId = json['ticketTransactionId'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['actionBy'] = this.actionBy;
|
||||||
|
data['actionDate'] = this.actionDate;
|
||||||
|
data['comments'] = this.comments;
|
||||||
|
data['statusDisplayText'] = this.statusDisplayText;
|
||||||
|
data['statusName'] = this.statusName;
|
||||||
|
data['ticketId'] = this.ticketId;
|
||||||
|
data['ticketTransactionId'] = this.ticketTransactionId;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,184 @@
|
|||||||
|
class GetTicketsByEmployeeList {
|
||||||
|
dynamic agentRating;
|
||||||
|
dynamic assignedSpecialist;
|
||||||
|
String? assignedSpecialistName;
|
||||||
|
String? assignedToSpecialistAt;
|
||||||
|
int? channelId;
|
||||||
|
String? channelName;
|
||||||
|
String? closedBy;
|
||||||
|
String? closedDate;
|
||||||
|
String? created;
|
||||||
|
int? departmentId;
|
||||||
|
String? departmentName;
|
||||||
|
String? description;
|
||||||
|
String? employeeEmail;
|
||||||
|
String? employeeName;
|
||||||
|
int? employeeNumber;
|
||||||
|
String? firstName;
|
||||||
|
dynamic isActive;
|
||||||
|
bool? isClosedDirectly;
|
||||||
|
dynamic isEscalated;
|
||||||
|
bool? isExceedTAT;
|
||||||
|
String? lastName;
|
||||||
|
String? mobileNumber;
|
||||||
|
dynamic pageNo;
|
||||||
|
dynamic pageSize;
|
||||||
|
String? positionTitle;
|
||||||
|
int? projectId;
|
||||||
|
String? projectManager;
|
||||||
|
String? projectName;
|
||||||
|
String? providedSolution;
|
||||||
|
int? sectionId;
|
||||||
|
String? sectionName;
|
||||||
|
dynamic serviceRating;
|
||||||
|
String? specialistDeadline;
|
||||||
|
String? ticketId;
|
||||||
|
String? ticketReferenceNo;
|
||||||
|
int? ticketStatusId;
|
||||||
|
String? ticketStatusInternalName;
|
||||||
|
String? ticketStatusName;
|
||||||
|
int? ticketTypeId;
|
||||||
|
String? ticketTypeName;
|
||||||
|
int? topicId;
|
||||||
|
String? topicName;
|
||||||
|
int? totalItemsCount;
|
||||||
|
|
||||||
|
GetTicketsByEmployeeList(
|
||||||
|
{this.agentRating,
|
||||||
|
this.assignedSpecialist,
|
||||||
|
this.assignedSpecialistName,
|
||||||
|
this.assignedToSpecialistAt,
|
||||||
|
this.channelId,
|
||||||
|
this.channelName,
|
||||||
|
this.closedBy,
|
||||||
|
this.closedDate,
|
||||||
|
this.created,
|
||||||
|
this.departmentId,
|
||||||
|
this.departmentName,
|
||||||
|
this.description,
|
||||||
|
this.employeeEmail,
|
||||||
|
this.employeeName,
|
||||||
|
this.employeeNumber,
|
||||||
|
this.firstName,
|
||||||
|
this.isActive,
|
||||||
|
this.isClosedDirectly,
|
||||||
|
this.isEscalated,
|
||||||
|
this.isExceedTAT,
|
||||||
|
this.lastName,
|
||||||
|
this.mobileNumber,
|
||||||
|
this.pageNo,
|
||||||
|
this.pageSize,
|
||||||
|
this.positionTitle,
|
||||||
|
this.projectId,
|
||||||
|
this.projectManager,
|
||||||
|
this.projectName,
|
||||||
|
this.providedSolution,
|
||||||
|
this.sectionId,
|
||||||
|
this.sectionName,
|
||||||
|
this.serviceRating,
|
||||||
|
this.specialistDeadline,
|
||||||
|
this.ticketId,
|
||||||
|
this.ticketReferenceNo,
|
||||||
|
this.ticketStatusId,
|
||||||
|
this.ticketStatusInternalName,
|
||||||
|
this.ticketStatusName,
|
||||||
|
this.ticketTypeId,
|
||||||
|
this.ticketTypeName,
|
||||||
|
this.topicId,
|
||||||
|
this.topicName,
|
||||||
|
this.totalItemsCount});
|
||||||
|
|
||||||
|
GetTicketsByEmployeeList.fromJson(Map<String, dynamic> json) {
|
||||||
|
agentRating = json['agentRating'];
|
||||||
|
assignedSpecialist = json['assignedSpecialist'];
|
||||||
|
assignedSpecialistName = json['assignedSpecialistName'];
|
||||||
|
assignedToSpecialistAt = json['assignedToSpecialistAt'];
|
||||||
|
channelId = json['channelId'];
|
||||||
|
channelName = json['channelName'];
|
||||||
|
closedBy = json['closedBy'];
|
||||||
|
closedDate = json['closedDate'];
|
||||||
|
created = json['created'];
|
||||||
|
departmentId = json['departmentId'];
|
||||||
|
departmentName = json['departmentName'];
|
||||||
|
description = json['description'];
|
||||||
|
employeeEmail = json['employeeEmail'];
|
||||||
|
employeeName = json['employeeName'];
|
||||||
|
employeeNumber = json['employeeNumber'];
|
||||||
|
firstName = json['firstName'];
|
||||||
|
isActive = json['isActive'];
|
||||||
|
isClosedDirectly = json['isClosedDirectly'];
|
||||||
|
isEscalated = json['isEscalated'];
|
||||||
|
isExceedTAT = json['isExceedTAT'];
|
||||||
|
lastName = json['lastName'];
|
||||||
|
mobileNumber = json['mobileNumber'];
|
||||||
|
pageNo = json['pageNo'];
|
||||||
|
pageSize = json['pageSize'];
|
||||||
|
positionTitle = json['positionTitle'];
|
||||||
|
projectId = json['projectId'];
|
||||||
|
projectManager = json['projectManager'];
|
||||||
|
projectName = json['projectName'];
|
||||||
|
providedSolution = json['providedSolution'];
|
||||||
|
sectionId = json['sectionId'];
|
||||||
|
sectionName = json['sectionName'];
|
||||||
|
serviceRating = json['serviceRating'];
|
||||||
|
specialistDeadline = json['specialistDeadline'];
|
||||||
|
ticketId = json['ticketId'];
|
||||||
|
ticketReferenceNo = json['ticketReferenceNo'];
|
||||||
|
ticketStatusId = json['ticketStatusId'];
|
||||||
|
ticketStatusInternalName = json['ticketStatusInternalName'];
|
||||||
|
ticketStatusName = json['ticketStatusName'];
|
||||||
|
ticketTypeId = json['ticketTypeId'];
|
||||||
|
ticketTypeName = json['ticketTypeName'];
|
||||||
|
topicId = json['topicId'];
|
||||||
|
topicName = json['topicName'];
|
||||||
|
totalItemsCount = json['totalItemsCount'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['agentRating'] = agentRating;
|
||||||
|
data['assignedSpecialist'] = assignedSpecialist;
|
||||||
|
data['assignedSpecialistName'] = assignedSpecialistName;
|
||||||
|
data['assignedToSpecialistAt'] = assignedToSpecialistAt;
|
||||||
|
data['channelId'] = channelId;
|
||||||
|
data['channelName'] = channelName;
|
||||||
|
data['closedBy'] = closedBy;
|
||||||
|
data['closedDate'] = closedDate;
|
||||||
|
data['created'] = created;
|
||||||
|
data['departmentId'] = departmentId;
|
||||||
|
data['departmentName'] = departmentName;
|
||||||
|
data['description'] = description;
|
||||||
|
data['employeeEmail'] = employeeEmail;
|
||||||
|
data['employeeName'] = employeeName;
|
||||||
|
data['employeeNumber'] = employeeNumber;
|
||||||
|
data['firstName'] = firstName;
|
||||||
|
data['isActive'] = isActive;
|
||||||
|
data['isClosedDirectly'] = isClosedDirectly;
|
||||||
|
data['isEscalated'] = isEscalated;
|
||||||
|
data['isExceedTAT'] = isExceedTAT;
|
||||||
|
data['lastName'] = lastName;
|
||||||
|
data['mobileNumber'] = mobileNumber;
|
||||||
|
data['pageNo'] = pageNo;
|
||||||
|
data['pageSize'] = pageSize;
|
||||||
|
data['positionTitle'] = positionTitle;
|
||||||
|
data['projectId'] = projectId;
|
||||||
|
data['projectManager'] = projectManager;
|
||||||
|
data['projectName'] = projectName;
|
||||||
|
data['providedSolution'] = providedSolution;
|
||||||
|
data['sectionId'] = sectionId;
|
||||||
|
data['sectionName'] = sectionName;
|
||||||
|
data['serviceRating'] = serviceRating;
|
||||||
|
data['specialistDeadline'] = specialistDeadline;
|
||||||
|
data['ticketId'] = ticketId;
|
||||||
|
data['ticketReferenceNo'] = ticketReferenceNo;
|
||||||
|
data['ticketStatusId'] = ticketStatusId;
|
||||||
|
data['ticketStatusInternalName'] = ticketStatusInternalName;
|
||||||
|
data['ticketStatusName'] = ticketStatusName;
|
||||||
|
data['ticketTypeId'] = ticketTypeId;
|
||||||
|
data['ticketTypeName'] = ticketTypeName;
|
||||||
|
data['topicId'] = topicId;
|
||||||
|
data['topicName'] = topicName;
|
||||||
|
data['totalItemsCount'] = totalItemsCount;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,124 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_svg/svg.dart';
|
||||||
|
import 'package:mohem_flutter_app/api/mowadhafhi/mowadhafhi_api_client.dart';
|
||||||
|
import 'package:mohem_flutter_app/classes/colors.dart';
|
||||||
|
import 'package:mohem_flutter_app/classes/utils.dart';
|
||||||
|
import 'package:mohem_flutter_app/config/routes.dart';
|
||||||
|
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
|
||||||
|
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
|
||||||
|
import 'package:mohem_flutter_app/models/mowadhafhi/get_tickets_list.dart';
|
||||||
|
|
||||||
|
import '../../../widgets/app_bar_widget.dart';
|
||||||
|
|
||||||
|
class MowadhafhiHome extends StatefulWidget {
|
||||||
|
const MowadhafhiHome({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_MowadhafhiHomeState createState() => _MowadhafhiHomeState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MowadhafhiHomeState extends State<MowadhafhiHome> {
|
||||||
|
List<GetTicketsByEmployeeList> getTicketsByEmployeeList = [];
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
getOpenTickets();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
appBar: AppBarWidget(
|
||||||
|
context,
|
||||||
|
title: "Mowadhafhi Request",
|
||||||
|
),
|
||||||
|
body: Container(
|
||||||
|
margin: const EdgeInsets.only(top: 10.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: ListView.separated(
|
||||||
|
physics: const BouncingScrollPhysics(),
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
return InkWell(
|
||||||
|
onTap: () {
|
||||||
|
openRequestDetails(getTicketsByEmployeeList[index].ticketId!);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
width: double.infinity,
|
||||||
|
// height: 100.0,
|
||||||
|
padding: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10),
|
||||||
|
margin: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: const Color(0xff000000).withOpacity(.05),
|
||||||
|
blurRadius: 26,
|
||||||
|
offset: const Offset(0, -3),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
getTicketsByEmployeeList[index].ticketTypeName!.toText14(color: MyColors.grey57Color),
|
||||||
|
getTicketsByEmployeeList[index].created!.split(" ")[0].toText12(color: MyColors.grey70Color),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.only(top: 10.0),
|
||||||
|
child: getTicketsByEmployeeList[index].description!.toText12(color: MyColors.grey57Color),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.only(top: 10.0),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
getTicketsByEmployeeList[index].ticketStatusInternalName!.toText14(color: MyColors.gradiantEndColor),
|
||||||
|
SvgPicture.asset(
|
||||||
|
"assets/images/arrow_next.svg",
|
||||||
|
color: MyColors.darkIconColor,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
separatorBuilder: (BuildContext context, int index) => 12.height,
|
||||||
|
itemCount: getTicketsByEmployeeList.length ?? 0))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void openRequestDetails(String itgTicketID) async {
|
||||||
|
await Navigator.pushNamed(context, AppRoutes.mowadhafhiDetails, arguments: itgTicketID);
|
||||||
|
}
|
||||||
|
|
||||||
|
void getOpenTickets() async {
|
||||||
|
try {
|
||||||
|
Utils.showLoading(context);
|
||||||
|
getTicketsByEmployeeList = await MowadhafhiApiClient().getTicketsByEmployee();
|
||||||
|
Utils.hideLoading(context);
|
||||||
|
setState(() {});
|
||||||
|
} catch (ex) {
|
||||||
|
Utils.hideLoading(context);
|
||||||
|
Utils.handleException(ex, context, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,213 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:mohem_flutter_app/api/mowadhafhi/mowadhafhi_api_client.dart';
|
||||||
|
import 'package:mohem_flutter_app/classes/colors.dart';
|
||||||
|
import 'package:mohem_flutter_app/classes/utils.dart';
|
||||||
|
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
|
||||||
|
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
|
||||||
|
import 'package:mohem_flutter_app/models/mowadhafhi/get_ticket_details.dart';
|
||||||
|
import 'package:mohem_flutter_app/models/mowadhafhi/get_ticket_transactions.dart';
|
||||||
|
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
||||||
|
|
||||||
|
class MowadhafhiRequestDetails extends StatefulWidget {
|
||||||
|
const MowadhafhiRequestDetails({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_RequestDetailsState createState() => _RequestDetailsState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _RequestDetailsState extends State<MowadhafhiRequestDetails> {
|
||||||
|
String? itgTicketID;
|
||||||
|
List<GetTicketDetailsByEmployee> getTicketsByEmployeeList = [];
|
||||||
|
List<GetTicketTransactions> getTicketTransactionsList = [];
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
// TODO: implement initState
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
getRequestID() {
|
||||||
|
if (itgTicketID == null) {
|
||||||
|
itgTicketID = ModalRoute.of(context)?.settings.arguments as String;
|
||||||
|
debugPrint(itgTicketID);
|
||||||
|
getTicketDetails();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
getRequestID();
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
appBar: AppBarWidget(
|
||||||
|
context,
|
||||||
|
title: "Mowadhafhi Request",
|
||||||
|
),
|
||||||
|
body: SingleChildScrollView(
|
||||||
|
child: getTicketsByEmployeeList.length != 0
|
||||||
|
? Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: double.infinity,
|
||||||
|
padding: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12),
|
||||||
|
margin: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: const Color(0xff000000).withOpacity(.05),
|
||||||
|
blurRadius: 26,
|
||||||
|
offset: const Offset(0, -3),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
getTicketsByEmployeeList![0].ticketStatusName!.toText14(color: MyColors.gradiantEndColor),
|
||||||
|
getTicketsByEmployeeList![0].created!.split(" ")[0].toText12(color: MyColors.grey70Color),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
8.height,
|
||||||
|
"Ticket Reference: ".toText12(color: MyColors.grey98Color),
|
||||||
|
getTicketsByEmployeeList![0].ticketReferenceNo!.toText14(color: MyColors.grey57Color),
|
||||||
|
8.height,
|
||||||
|
"Section: ".toText12(color: MyColors.grey98Color),
|
||||||
|
getTicketsByEmployeeList![0].sectionName!.toText14(color: MyColors.grey57Color),
|
||||||
|
8.height,
|
||||||
|
"Topic: ".toText12(color: MyColors.grey98Color),
|
||||||
|
getTicketsByEmployeeList![0].topicName!.toText14(color: MyColors.grey57Color),
|
||||||
|
8.height,
|
||||||
|
"Description: ".toText12(color: MyColors.grey98Color),
|
||||||
|
getTicketsByEmployeeList![0].description!.toText14(color: MyColors.grey57Color),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: double.infinity,
|
||||||
|
padding: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12),
|
||||||
|
margin: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: const Color(0xff000000).withOpacity(.05),
|
||||||
|
blurRadius: 26,
|
||||||
|
offset: const Offset(0, -3),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
ListView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: const ScrollPhysics(),
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
return Stack(
|
||||||
|
children: <Widget>[
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 50.0),
|
||||||
|
child: Card(
|
||||||
|
elevation: 0.0,
|
||||||
|
margin: const EdgeInsets.fromLTRB(0.0, 20.0, 20.0, 10.0),
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.all(12.0),
|
||||||
|
width: double.infinity,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
"Action By: ".toText14(color: MyColors.grey57Color),
|
||||||
|
getTicketTransactionsList![index].actionBy!.toText14(color: MyColors.grey57Color),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
getTicketTransactionsList![index].comments!.toText14(color: MyColors.grey98Color),
|
||||||
|
12.height,
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
getTicketTransactionsList![0].actionDate!.split(" ")[0].toText12(color: MyColors.grey70Color),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
top: 0.0,
|
||||||
|
bottom: 0.0,
|
||||||
|
left: 28.0,
|
||||||
|
child: Container(
|
||||||
|
height: double.infinity,
|
||||||
|
width: 3.0,
|
||||||
|
color: MyColors.lightTextColor.withOpacity(0.5),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
top: 0.0,
|
||||||
|
left: 15.0,
|
||||||
|
child: Container(
|
||||||
|
height: 30.0,
|
||||||
|
width: 30.0,
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
child: Container(
|
||||||
|
margin: const EdgeInsets.all(5.0),
|
||||||
|
height: 30.0,
|
||||||
|
width: 30.0,
|
||||||
|
decoration: const BoxDecoration(shape: BoxShape.circle, color: MyColors.gradiantEndColor),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
itemCount: getTicketTransactionsList.length ?? 0,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void getTicketDetails() async {
|
||||||
|
try {
|
||||||
|
Utils.showLoading(context);
|
||||||
|
getTicketsByEmployeeList = await MowadhafhiApiClient().getTicketDetailsByEmployee(itgTicketID);
|
||||||
|
Utils.hideLoading(context);
|
||||||
|
setState(() {});
|
||||||
|
getTicketTransactions();
|
||||||
|
} catch (ex) {
|
||||||
|
Utils.hideLoading(context);
|
||||||
|
Utils.handleException(ex, context, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void getTicketTransactions() async {
|
||||||
|
try {
|
||||||
|
Utils.showLoading(context);
|
||||||
|
getTicketTransactionsList = await MowadhafhiApiClient().getTicketTransactions(itgTicketID);
|
||||||
|
debugPrint(getTicketTransactionsList![0].actionDate);
|
||||||
|
Utils.hideLoading(context);
|
||||||
|
setState(() {});
|
||||||
|
} catch (ex) {
|
||||||
|
Utils.hideLoading(context);
|
||||||
|
Utils.handleException(ex, context, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue