Skip to content

Commit

Permalink
feat(core): Add attribute staatus_badge to ticket model
Browse files Browse the repository at this point in the history
ref:  #345 #346
  • Loading branch information
jon-nfc committed Oct 12, 2024
1 parent 3472a25 commit c0c7cdc
Showing 1 changed file with 31 additions and 6 deletions.
37 changes: 31 additions & 6 deletions app/core/models/ticket/ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,15 +690,17 @@ def linked_items(self) -> list(dict()):

linked_items: list = []

from core.models.ticket.ticket_linked_items import TicketLinkedItem
if self.pk:

items = TicketLinkedItem.objects.filter(
ticket = self
)
from core.models.ticket.ticket_linked_items import TicketLinkedItem

items = TicketLinkedItem.objects.filter(
ticket = self
)

if len(items) > 0:
if len(items) > 0:

linked_items = items
linked_items = items

return linked_items

Expand Down Expand Up @@ -871,6 +873,29 @@ def save(self, force_insert=False, force_update=False, using=None, update_fields
signals.m2m_changed.connect(self.action_comment_ticket_teams, Ticket.subscribed_teams.through)



@property
def status_badge(self):

from core.classes.badge import Badge

text:str = 'Add'

if self.status:

text:str = str(self.get_status_display())
style:str = text.replace('(', '')
style = style.replace(')', '')
style = style.replace(' ', '_')

return Badge(
icon_name = f'ticket_status_{style.lower()}',
icon_style = f'ticket-status-icon ticket-status-icon-{style.lower()}',
text = text,
text_style = f'ticket-status-text badge-text-ticket_status-{style.lower()}',
)


def ticketassigned(self, instance) -> bool:
""" Check if the ticket has any assigned user(s)/team(s)"""

Expand Down

0 comments on commit c0c7cdc

Please sign in to comment.