$(document).ready(function () {
    ticketnumberCreator();
})

function ticketnumberCreator() {
    var numberOfTickets = $('#printedTicketsNumber').val();
    var addedRedClass = numberOfTickets > 1 ? 'badge marginleftonlyshort marginleftonlyshortred' : 'badge marginleftonlyshort';
    var exclamation = numberOfTickets > 1 ? ' <span class="fa fa-exclamation" style="color:red;"></span>' : '';
    ticketValue = '<span class="' + addedRedClass + '">' + numberOfTickets + '</span>' + exclamation;
    $('#tickets').append(ticketValue);
}

function myFunction(ticket_id) {
    var x = document.getElementById("hidden_" + ticket_id);
    var arrow = document.getElementById("arrow_" + ticket_id);
    var display = x.style.display;
    if (display == 'none') {
        x.style.display = "table-row";
        arrow.classList.remove("fa-chevron-down");
        arrow.classList.add("fa-chevron-up");
    } else {
        x.style.display = "none";
        arrow.classList.remove("fa-chevron-up");
        arrow.classList.add("fa-chevron-down");
    }
}