Skip to content

Commit

Permalink
Merge pull request #255 from takenet/fix/620348-ticket-card-fix
Browse files Browse the repository at this point in the history
fix: check the status in ticket card
  • Loading branch information
githubdoandre authored Apr 5, 2024
2 parents 4aaa051 + a99666e commit d35e8be
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 33 deletions.
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

0 comments on commit d35e8be

Please sign in to comment.