Repository URL to install this package:
|
Version:
2.23.0 ▾
|
#Load Resolutions List table into modal body
$(document).on "click", "#btn-manage-resolutions, .btn-manage-resolutions", (e) ->
e.preventDefault()
$this = $(this)
unless $(this).hasClass('prevent')
$(this).addClass('prevent')
$.ajax
url: ($ @).attr("href"),
method: "get",
success: (data) ->
$("#modal-holder").html(data)
$("#modal-manage-resolutions").modal('show')
svgFill()
###
# .off('focusout.ClientSideValidations')
# Disable the validation on focus due to unwanted behaviour; focusing out of an empty field will lead to a validation error
###
setTimeout "$('.form-manage-resolutions').enableClientSideValidations().find('input').off('focusout.ClientSideValidations')", 300
$this.removeClass('prevent')
rowCount()
@rowCount = ->
row_count = $("#resolution-list-table tr").length
removeButton = $("#resolution-list-table tr").find('.btn-remove-text')
$("#resolutions-row-count").text(row_count)
resolutionButton = $('#btn-manage-resolutions')
newQueueButton = $('.btn-new-queue')
dummyCard = $('.tab-card-list').find('.dummy-card')
cards = $('.tab-card-list').find('.card:not(.dummy-card)').length
removeButton.removeClass('prevent')
if row_count > 0
newQueueButton.removeClass('disabled prevent')
resolutionButton.html(resolutionButton.attr('data-manage'))
$('.info-text').hide()
if row_count == 1
removeButton.addClass('prevent')
else
newQueueButton.addClass('disabled prevent')
resolutionButton.html(resolutionButton.attr('data-setup'))
dummyCard.hide()
$('.info-text').show()
$('input').focusout
#Resolutions table success call
$(document).on "ajax:success", ".form-manage-resolutions", (e, data) ->
e.preventDefault()
$_this = $ @
if data.status == "success"
$("#resolution-list-table tbody").prepend(data.new_row_html)
$(".form-manage-resolutions")[0].reset()
svgFill()
rowCount()
$("#resolution-list-table tbody tr:first-child").effect("highlight", { color: "#dbf6d3"}, 4000)
$('#ticket_resolution_code').focus()
###
# .off('focusout.ClientSideValidations')
# Disable the validation on focus due to unwanted behaviour; focusing out of an empty field will lead to a validation error
###
$_this.resetClientSideValidations().find('input').off('focusout.ClientSideValidations')
removeButtonSpinner()
$(document).on "ajax:error", ".form-manage-resolutions", (e, data) ->
message = $.parseJSON(data.responseText)
noty {text: message.errors, type: "error"}
# Table rows mouse hover actions
resolutionFlag = "edit-delete"
$(document).on "mouseenter", "#resolution-list-table tbody tr", (e) ->
if resolutionFlag = "edit-delete"
$(this).find(".edit-delete").addClass('show')
$(this).find(".save-cancel").removeClass('show')
$(document).on "mouseleave", "#resolution-list-table tbody tr", (e) ->
if resolutionFlag = "edit-delete"
$(this).find(".edit-delete").removeClass('show')