//==================================================================================================
// AMUSING-PAGE FUNCTIONS:
//--------------------------------------------------------------------------------------------------
// Obtainment of roman number list:
function buttonRomanNumbers_Click() {
    let textRomanNumbersCount = HById.InputElement('textRomanNumbersCount');
    let button = HById.InputElement('buttonRomanNumbers');
    let chkboxDelay = HById.InputElement('checkboxRomanNumbersDelay');
    let thead = HElement.ById('romanNumbersTableHead');
    let tbody = HElement.ById('romanNumbersTableBody');
    let countStr = textRomanNumbersCount.value.trim();
    let withDelay = chkboxDelay.checked;
    let completionHandler = function () {
        button.disabled = false;
        if (!textRomanNumbersCount.disabled) {
            textRomanNumbersCount.focus();
            textRomanNumbersCount.select();
        }
        else
            button.focus();
    };
    thead.innerHTML = tbody.innerHTML = '';
    var count = Number(countStr);
    if (countStr == '')
        count = -1;
    else if (!(count >= 0)) {
        completionHandler();
        IncludeErrorClass(textRomanNumbersCount);
        return;
    }
    ExcludeErrorClass(textRomanNumbersCount);
    button.disabled = true;
    $.ajax({
        url: '/api/roman_numbers?count=' + count + '&withDelay=' + withDelay,
        type: 'GET',
        contentType: 'application/json',
        success: function (rsp) {
            if (rsp.hasError) {
                showAlert(rsp.message);
                completionHandler();
                return;
            }
            if (rsp.response_Success != true) {
                showAlert(rsp.response_Message);
                completionHandler();
                return;
            }
            var items = rsp.response_Items;
            if (!items) {
                alert('roman_numbers: \"response_Items\"-field is null.');
                completionHandler();
                return;
            }
            //alert('roman_numbers: SUCCESS')
            var rows = '';
            $.each(items, function (index, romanNumberInfo) {
                rows +=
                    '<tr>' +
                        '<td class="rightAlignedBoldTD">' + romanNumberInfo.number + '</td>' +
                        '<td>' + romanNumberInfo.inscription + '</td>' +
                        '</tr>\n';
            });
            thead.innerHTML =
                '<tr>' +
                    '<th class="listTH">Number</th>' +
                    '<th class="listTH">Inscription</th>' +
                    '</tr>\n';
            tbody.innerHTML = rows;
            completionHandler();
            //alert('roman_numbers: LOADED')
        },
        error: function (request, status, error) {
            HAjax.ShowApiError(request, status, error);
            completionHandler();
        }
    });
}
//--------------------------------------------------------------------------------------------------
// Month list coloring (with possible line interleaving):
function ColorMonthTable() {
    let checkBoxColorInterleaved = HById.GetInputElement('checkBoxColorInterleaved');
    if (checkBoxColorInterleaved)
        Common.ColorTableInterleaved('monthTable', checkBoxColorInterleaved && checkBoxColorInterleaved.checked ? undefined : '');
}
//==================================================================================================
// GLOBAL VARIABLES AND FUNCTION CALL (PAGE SCRIPT):
//--------------------------------------------------------------------------------------------------
// Call of month list coloring (with possible line interleaving):
ColorMonthTable();
//==================================================================================================
//# sourceMappingURL=Amusing.page.js.map