<commit_before>function calcSuccess(res) {
    console.log(res);
}

function showRequest(formdata) {
    console.dir(formdata);
}

function calculateQuote() {
    var totalProducts = 0;
    var subTotal = 0;

    $('.item-row').each(function () {
        var spinner = $(this).find('.spinner-box');
        var count = parseInt(spinner.val());
        totalProducts += count;
        var minutes = count * parseFloat(spinner.data('mins')).toFixed(2);
        subTotal += minutes;

        $(this).find('.calc_mins').html(minutes);
    });

    var totalTruckLoads = (totalProducts / 22).toFixed(2);
    var totalDriveTime = $('#id_travel_time').val() * 2;
    var grandTotal = subTotal + totalDriveTime;
    var totalHours = (grandTotal / 60).toFixed(2);
    var totalDays = (totalHours / 8).toFixed(2);
    var companyVals = $('#companyvals');
    var straightTimeCost = (parseFloat(companyVals.data('straight-time-rate')) * totalHours).toFixed(2);
    var overTimeCost = (parseFloat(companyVals.data('over-time-rate')) * totalHours).toFixed(2);

    $('#genval_totalproducts').html(totalProducts);
    $('#genval_totaltruckloads').html(totalTruckLoads);
    $('#genval_subtotal').html(subTotal);
    $('#genval_totaldrivetime').html(totalDriveTime);
    $('#genval_grandtotal').html(grandTotal);
    $('#genval_totalhours').html(totalHours);
    $('#genval_totaldays').html(totalDays);
    $('#genval_straighttimecost').html(straightTimeCost);
    $('#genval_overtimecost').html(overTimeCost);
}

// executed after pageload completes
$(function () {
    //enable number spinner input functionality for each input
    $('#id_travel_time').addClass('spinner-box');
    $(".spinner-box").each(function () {
        $(this).TouchSpin({
            min: 0,
            max: 9999,
            step: 1,
            decimals: 0,
            boostat: 5,
            maxboostedstep: 10
        });
    });

    //add click listeners to each category button
    $(".category_btn").each(function () {
        $(this).click(function () {
            $('.navmenu').offcanvas('toggle');
        });
    });

    //click listener for calculate button
    $('#calculate_btn').click(function () {
        calculateQuote();
    });

    $('.quote-submit').click(function () {
        var url = $(this).data('url');
        $('#quote_form').ajaxSubmit({
            url: url,
            beforeSubmit: showRequest,
            success: calcSuccess
        });
        //this prevents normal form submit page navigation
        return false;
    });
});<commit_msg>review button disabled when offline<commit_after>function calcSuccess(res) {
    console.log(res);
}

function showRequest(formdata) {
    console.dir(formdata);
}

function calculateQuote() {
    var totalProducts = 0;
    var subTotal = 0;

    $('.item-row').each(function () {
        var spinner = $(this).find('.spinner-box');
        var count = parseInt(spinner.val());
        totalProducts += count;
        var minutes = count * parseFloat(spinner.data('mins')).toFixed(2);
        subTotal += minutes;

        $(this).find('.calc_mins').html(minutes);
    });

    var totalTruckLoads = (totalProducts / 22).toFixed(2);
    var totalDriveTime = $('#id_travel_time').val() * 2;
    var grandTotal = subTotal + totalDriveTime;
    var totalHours = (grandTotal / 60).toFixed(2);
    var totalDays = (totalHours / 8).toFixed(2);
    var companyVals = $('#companyvals');
    var straightTimeCost = (parseFloat(companyVals.data('straight-time-rate')) * totalHours).toFixed(2);
    var overTimeCost = (parseFloat(companyVals.data('over-time-rate')) * totalHours).toFixed(2);

    $('#genval_totalproducts').html(totalProducts);
    $('#genval_totaltruckloads').html(totalTruckLoads);
    $('#genval_subtotal').html(subTotal);
    $('#genval_totaldrivetime').html(totalDriveTime);
    $('#genval_grandtotal').html(grandTotal);
    $('#genval_totalhours').html(totalHours);
    $('#genval_totaldays').html(totalDays);
    $('#genval_straighttimecost').html(straightTimeCost);
    $('#genval_overtimecost').html(overTimeCost);
}

// executed after pageload completes
$(function () {
    //enable number spinner input functionality for each input
    $('#id_travel_time').addClass('spinner-box');
    $(".spinner-box").each(function () {
        $(this).TouchSpin({
            min: 0,
            max: 9999,
            step: 1,
            decimals: 0,
            boostat: 5,
            maxboostedstep: 10
        });
    });

    //add click listeners to each category button
    $(".category_btn").each(function () {
        $(this).click(function () {
            $('.navmenu').offcanvas('toggle');
        });
    });

    //click listener for calculate button
    $('#calculate_btn').click(function () {
        calculateQuote();
    });

    $('.quote-submit').click(function () {
        var url = $(this).data('url');
        $('#quote_form').ajaxSubmit({
            url: url,
            beforeSubmit: showRequest,
            success: calcSuccess
        });
        //this prevents normal form submit page navigation
        return false;
    });

    var reviewButton = $('#review_btn');
    var reviewEnabled = true;
    setInterval(function () {
        if (reviewEnabled && !navigator.onLine) {
            reviewButton.prop('disabled', true);
            reviewButton.removeClass('btn-default');
            reviewButton.addClass('btn-warning');
            reviewEnabled = false;
        } else if (!reviewEnabled && navigator.onLine) {
            reviewButton.prop('disabled', false);
            reviewButton.removeClass('btn-warning');
            reviewButton.addClass('btn-default');
            reviewEnabled = true;
        }
    }, 2000);
});
{'fraction_non_alphanumeric': 0.16325817164831324, 'fraction_numerical': 0.009089320048942492, 'mean_word_length': 2.8248663101604277, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3516471', 'n_tokens_mistral': 1735, 'n_tokens_neox': 1670, 'n_words': 301}