Added ability to change the ticket severity level
This commit is contained in:
parent
5d5265ef38
commit
77c8605b49
@ -1,8 +1,34 @@
|
|||||||
$(document).ready ->
|
$(document).ready ->
|
||||||
console.log('Hello, world!')
|
console.log('Hello, world!')
|
||||||
|
|
||||||
|
$('.ticket-severity').on('click', handleSeverityClick)
|
||||||
$('.ticket-status').on('click', handleStatusClick)
|
$('.ticket-status').on('click', handleStatusClick)
|
||||||
|
|
||||||
|
handleSeverityClick = (e, msg = 'Set ticket severity:') ->
|
||||||
|
validSeverity = ['low', 'medium', 'high']
|
||||||
|
newSeverity = prompt(msg, $('.ticket-severity > span').text())
|
||||||
|
newSeverity = newSeverity.toLowerCase()
|
||||||
|
|
||||||
|
if (newSeverity != null) and (newSeverity != '')
|
||||||
|
if (newSeverity in validSeverity)
|
||||||
|
console.log('Setting severity to ' + newSeverity)
|
||||||
|
editLink = $('#ticketEditLink').attr('href') + '/severity'
|
||||||
|
console.log('Sending data to ' + editLink)
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: editLink,
|
||||||
|
data:
|
||||||
|
severity: newSeverity,
|
||||||
|
success: (data) ->
|
||||||
|
newSeverity = newSeverity.charAt(0).toUpperCase() + newSeverity.slice(1)
|
||||||
|
$('.ticket-severity > span').text(newSeverity)
|
||||||
|
console.log('Ticket updated successfully.')
|
||||||
|
})
|
||||||
|
else
|
||||||
|
console.log('Invalid severity entered')
|
||||||
|
handleSeverityClick(e, 'Invalid severity; valid values are low, medium, and high.')
|
||||||
|
|
||||||
|
|
||||||
handleStatusClick = (e, msg = 'Set ticket status:') ->
|
handleStatusClick = (e, msg = 'Set ticket status:') ->
|
||||||
validStatus = ['open', 'closed', 'parked']
|
validStatus = ['open', 'closed', 'parked']
|
||||||
newStatus = prompt(msg, $('.ticket-status > span').text())
|
newStatus = prompt(msg, $('.ticket-status > span').text())
|
||||||
@ -25,4 +51,4 @@ handleStatusClick = (e, msg = 'Set ticket status:') ->
|
|||||||
})
|
})
|
||||||
else
|
else
|
||||||
console.log('Invalid status entered')
|
console.log('Invalid status entered')
|
||||||
handleStatusClick(e, 'Invalid status; valid values are open, closed, and parked')
|
handleStatusClick(e, 'Invalid status; valid values are open, closed, and parked.')
|
||||||
|
@ -141,6 +141,7 @@ input[type="submit"].button-primary
|
|||||||
margin-right: 5px
|
margin-right: 5px
|
||||||
font-size: 2rem
|
font-size: 2rem
|
||||||
|
|
||||||
|
.ticket-severity,
|
||||||
.ticket-status
|
.ticket-status
|
||||||
transition: all 230ms ease-in-out
|
transition: all 230ms ease-in-out
|
||||||
&:hover
|
&:hover
|
||||||
|
@ -29,8 +29,8 @@
|
|||||||
<li><a id="ticketEditLink" href="{{ url_for('ticket.edit', {ticket_id: ticket.id}) }}"><i class="fa-solid fa-pen-to-square"></i>Edit</a></li><li><a href="{{ url_for('ticket.delete', {ticket_id: ticket.id}) }}"><i class="fa-solid fa-trash"></i>Delete</a></li>
|
<li><a id="ticketEditLink" href="{{ url_for('ticket.edit', {ticket_id: ticket.id}) }}"><i class="fa-solid fa-pen-to-square"></i>Edit</a></li><li><a href="{{ url_for('ticket.delete', {ticket_id: ticket.id}) }}"><i class="fa-solid fa-trash"></i>Delete</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li class="ticket-severity">
|
||||||
Severity {{ ticket.severity | capitalize }}
|
Severity: <span>{{ ticket.severity | capitalize }}</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="ticket-status">
|
<li class="ticket-status">
|
||||||
Status: <span>{{ ticket.status | capitalize }}</span>
|
Status: <span>{{ ticket.status | capitalize }}</span>
|
||||||
|
Loading…
Reference in New Issue
Block a user