Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check the status in ticket card #255

Merged
merged 2 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 30 additions & 33 deletions lib/src/widgets/ticket_message/ds_ticket_message.widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class DSTicketMessage extends StatelessWidget {
/// [DSTicketMessageType.closedAttendant] or [DSTicketMessageType.closedCustomer]
final DSTicketMessageType messageType;

final String contentStatus;

final _message = <String>[
'Chatbot {chatbotIdentity} encaminhou a conversa para atendimento',
'Atendente {agentIdentity} encerrou o atendimento',
Expand All @@ -35,43 +37,38 @@ class DSTicketMessage extends StatelessWidget {
this.agentIdentity,
this.chatbotIdentity,
required this.messageType,
}) : assert((messageType == DSTicketMessageType.forwardedTicket)
? (ticketId != null &&
chatbotIdentity != null &&
ticketId.trim().isNotEmpty &&
chatbotIdentity.trim().isNotEmpty)
: true),
assert((messageType == DSTicketMessageType.closedAttendant)
? (agentIdentity != null && agentIdentity.trim().isNotEmpty)
: true);
required this.contentStatus,
});

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(top: 16.0, bottom: 16.0),
child: Column(
children: [
DSBodyText(
_prepareMessage(messageType),
textAlign: TextAlign.center,
overflow: TextOverflow.visible,
fontWeight: FontWeight.w400,
isSelectable: true,
),
if (messageType == DSTicketMessageType.forwardedTicket)
Padding(
padding: const EdgeInsets.only(top: 5.0),
child: DSBodyText(
'Ticket $ticketId',
textAlign: TextAlign.center,
overflow: TextOverflow.visible,
fontWeight: FontWeight.w700,
isSelectable: true,
),
return (contentStatus.toLowerCase() == 'waiting')
? Padding(
padding: const EdgeInsets.only(top: 16.0, bottom: 16.0),
child: Column(
children: [
DSBodyText(
_prepareMessage(messageType),
textAlign: TextAlign.center,
overflow: TextOverflow.visible,
fontWeight: FontWeight.w400,
isSelectable: true,
),
if (messageType == DSTicketMessageType.forwardedTicket)
Padding(
padding: const EdgeInsets.only(top: 5.0),
child: DSBodyText(
'Ticket $ticketId',
textAlign: TextAlign.center,
overflow: TextOverflow.visible,
fontWeight: FontWeight.w700,
isSelectable: true,
),
),
],
),
],
),
);
)
: const SizedBox.shrink();
}

/// Prepare messages with parameters to be displayed
Expand Down
1 change: 1 addition & 0 deletions lib/src/widgets/utils/ds_card.widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ class DSCard extends StatelessWidget {
messageType: DSTicketMessageType.forwardedTicket,
ticketId: content['formattedTicketId'],
chatbotIdentity: content['ownerIdentity'],
contentStatus: content['status'],
);

case DSMessageContentType.input:
Expand Down
Loading