<commit_before>﻿//Self-Executing Anonymous Function
(function (tour, $, undefined) {
    var closeButton = { name: "Quit Tour", onclick: function () { tour.complete(); } };

    tour.isOriginalRequest = function () {
        return window.location.toString().indexOf("/Request/") !== -1;
    };

    tour.startTour = function (startId) {
        purchasing.preTour(tour.isOriginalRequest());

        guiders.show(startId);
    };

    tour.complete = function () {
        guiders.hideAll();
        purchasing.postTour(tour.isOriginalRequest());
    };

    function resetPage() {
        $("#item-modification-button").trigger('click', { automate: true }); //allow modification if available
        purchasing.setSplitType("None");
        scrollTo(0, 0); //reset at the top of the page
    }

    function loadTourInfo() {
        loadOverviewTour();
        loadLineItemTour();
    }

    function loadLineItemTour() {
        var intro = tour.isOriginalRequest() === true
            ? "Don't panic!  Your current form will be saved and restored whenever you choose to quit the tour"
            : "Once this tour is over your page will reload and any unsaved modifications will be lost. If this is not ok, please click close now";

        guiders.createGuider({
            buttons: [{ name: "Close" }, {
                name: "Let's get started",
                onclick: function () {
                    resetPage(); //We have chosen to enter the tour, so reset the page
                    guiders.next();
                }
            }],
            description: intro + "<br/><br/>Here we're going to look at how to enter line items in depth",
            onHide: function () {
                $("#line-items-section input").val('');
            },
            id: "lineitem-intro",
            next: "lineitem-quantity",
            position: 0,
            overlay: true,
            title: "Line Item Tour"
        });

        guiders.createGuider({
            attachTo: "input[name='items[0].quantity']",
            buttons: [closeButton, { name: "Next"}],
            description: "Today we are going to buy three dozen apples.<br/><br/>First, enter a quantity for the first line item.  This can be any number, including fractional numbers."
                + "<br/><br/>Note how the 'description' and 'unit$' fields turn are <span class='line-item-warning'>red</span> indicating that they need to be filled out for this line item to be valid",
            onShow: function (guider) {
                $(guider.attachTo).val(3).change();
            },
            id: "lineitem-quantity",
            next: "lineitem-unit",
            position: 1,
            overlay: true,
            highlight: '#line-items-section',
            title: "Line Item Tour: Quantity"
        });

        guiders.createGuider({
            attachTo: "select[name='items[0].units']",
            buttons: [closeButton, { name: "Next"}],
            description: "Select a unit: the default is 'Each'. In our case we are going to select 'Dozen'",
            onShow: function (guider) {
                $(guider.attachTo).val("DZ");
            },
            id: "lineitem-unit",
            next: "lineitem-description",
            position: 1,
            overlay: true,
            highlight: '#line-items-section',
            title: "Line Item Tour: Unit"
        });

        guiders.createGuider({
            attachTo: "input[name='items[0].description']",
            buttons: [closeButton, { name: "Next"}],
            description: "Now enter a description of what you want to buy, and optionally enter an associated catalog number",
            onShow: function (guider) {
                $(guider.attachTo).val("Fresh Organic Fuji Apples").change();
            },
            id: "lineitem-description",
            next: "lineitem-price",
            position: 1,
            overlay: true,
            highlight: '#line-items-section',
            title: "Line Item Tour: Description"
        });

        guiders.createGuider({
            attachTo: "input[name='items[0].price']",
            buttons: [closeButton, { name: "Next"}],
            description: "Now enter the unit price (this will be multiplied by quantity to determine the line total).  In our example, each dozen is $5, so we'll enter 5.",
            onShow: function (guider) {
                $(guider.attachTo).val(5).change();
            },
            id: "lineitem-price",
            next: "lineitem-total",
            position: 1,
            overlay: true,
            highlight: '#line-items-section',
            title: "Line Item Tour: Price"
        });

        guiders.createGuider({
            attachTo: ".line-total:first",
            buttons: [closeButton, { name: "Next"}],
            description: "At this point you have filled out the required information for a valid line item.  The total for this line has been calculated automatically, along with the order totals."
                + "<br/><br/>Now we'll go in depth to check out some advanced features.",
            onShow: function (guider) {
                $(guider.attachTo).val(5).change();
            },
            id: "lineitem-total",
            next: "lineitem-calculatorbutton",
            position: 1,
            overlay: true,
            highlight: '#line-items-section',
            title: "Line Item Tour"
        });

        guiders.createGuider({
            attachTo: ".line-total:first",
            buttons: [closeButton, { name: "Next"}],
            description: "If you do not know the unit price for a line item, the price calculator can help you fill out the line item information given only the quantity and total price"
                + "<a class=\"ui-icon ui-icon-calculator\"></a>",
            id: "lineitem-calculatorbutton",
            next: "lineitem-calculatordialog",
            position: 1,
            overlay: true,
            highlight: '.price-calculator:first',
            title: "Price Calculator"
        });

        guiders.createGuider({
            attachTo: "#calculator-quantity",
            buttons: [closeButton, { name: "Next"}],
            description: "Enter the quantity and total price for this order, and the unit price will be calculated automatically"
            + "<br/><br/>Click 'Accept Values' and the quantity & unit $ fields will be filled in for you",
            onShow: function () {
                $(".price-calculator:first").click();
                $("#calculator-quantity").val(3);
                $("#calculator-total").val(15).change();
            },
            onHide: function () {
                $(".ui-dialog-titlebar-close").click();
            },
            id: "lineitem-calculatordialog",
            next: "lineitem-morebutton",
            position: 3,
            overlay: true,
            highlight: '.ui-dialog',
            title: "Price Calculator"
        });

        guiders.createGuider({
            attachTo: ".toggle-line-item-details:first",
            buttons: [closeButton, { name: "Next"}],
            description: "You can include additional optional information about a line item by clicking the 'More' icon"
            + "<a class=\"ui-icon ui-icon-comment\"></a>",
            onHide: function (guider) {
                $(guider.attachTo).click();
            },
            id: "lineitem-morebutton",
            next: "lineitem-commodity",
            position: 1,
            overlay: true,
            highlight: ".toggle-line-item-details:first",
            title: "More Information"
        });
    }

    function loadOverviewTour() {
        var intro = tour.isOriginalRequest() === true
            ? "Don't panic!  Your current form will be saved and restored whenever you choose to quit the tour"
            : "Once this tour is over your page will reload and any unsaved modifications will be lost. If this is not ok, please click close now";

        guiders.createGuider({
            buttons: [{ name: "Close" }, {
                name: "Let's get started",
                onclick: function () {
                    resetPage(); //We have chosen to enter the tour, so reset the page
                    guiders.next();<commit_msg>Line Item Tour no split<commit_after>﻿//Self-Executing Anonymous Function
(function (tour, $, undefined) {
    var closeButton = { name: "Quit Tour", onclick: function () { tour.complete(); } };

    tour.isOriginalRequest = function () {
        return window.location.toString().indexOf("/Request/") !== -1;
    };

    tour.startTour = function (startId) {
        purchasing.preTour(tour.isOriginalRequest());

        guiders.show(startId);
    };

    tour.complete = function () {
        guiders.hideAll();
        purchasing.postTour(tour.isOriginalRequest());
    };

    function resetPage() {
        $("#item-modification-button").trigger('click', { automate: true }); //allow modification if available
        purchasing.setSplitType("None");
        scrollTo(0, 0); //reset at the top of the page
    }

    function loadTourInfo() {
        loadOverviewTour();
        loadLineItemTour();
    }

    function loadLineItemTour() {
        var intro = tour.isOriginalRequest() === true
            ? "Don't panic!  Your current form will be saved and restored whenever you choose to quit the tour"
            : "Once this tour is over your page will reload and any unsaved modifications will be lost. If this is not ok, please click close now";

        guiders.createGuider({
            buttons: [{ name: "Close" }, {
                name: "Let's get started",
                onclick: function () {
                    resetPage(); //We have chosen to enter the tour, so reset the page
                    guiders.next();
                }
            }],
            description: intro + "<br/><br/>Here we're going to look at how to enter line items in depth",
            onHide: function () {
                $("#line-items-section input").val('');
            },
            id: "lineitem-intro",
            next: "lineitem-quantity",
            position: 0,
            overlay: true,
            title: "Line Item Tour"
        });

        guiders.createGuider({
            attachTo: "input[name='items[0].quantity']",
            buttons: [closeButton, { name: "Next"}],
            description: "Today we are going to buy three dozen apples.<br/><br/>First, enter a quantity for the first line item.  This can be any number, including fractional numbers."
                + "<br/><br/>Note how the 'description' and 'unit$' fields turn are <span class='line-item-warning'>red</span> indicating that they need to be filled out for this line item to be valid",
            onShow: function (guider) {
                $(guider.attachTo).val(3).change();
            },
            id: "lineitem-quantity",
            next: "lineitem-unit",
            position: 1,
            overlay: true,
            highlight: '#line-items-section',
            title: "Line Item Tour: Quantity"
        });

        guiders.createGuider({
            attachTo: "select[name='items[0].units']",
            buttons: [closeButton, { name: "Next"}],
            description: "Select a unit: the default is 'Each'. In our case we are going to select 'Dozen'",
            onShow: function (guider) {
                $(guider.attachTo).val("DZ");
            },
            id: "lineitem-unit",
            next: "lineitem-description",
            position: 1,
            overlay: true,
            highlight: '#line-items-section',
            title: "Line Item Tour: Unit"
        });

        guiders.createGuider({
            attachTo: "input[name='items[0].description']",
            buttons: [closeButton, { name: "Next"}],
            description: "Now enter a description of what you want to buy, and optionally enter an associated catalog number",
            onShow: function (guider) {
                $(guider.attachTo).val("Fresh Organic Fuji Apples").change();
            },
            id: "lineitem-description",
            next: "lineitem-price",
            position: 1,
            overlay: true,
            highlight: '#line-items-section',
            title: "Line Item Tour: Description"
        });

        guiders.createGuider({
            attachTo: "input[name='items[0].price']",
            buttons: [closeButton, { name: "Next"}],
            description: "Now enter the unit price (this will be multiplied by quantity to determine the line total).  In our example, each dozen is $5, so we'll enter 5.",
            onShow: function (guider) {
                $(guider.attachTo).val(5).change();
            },
            id: "lineitem-price",
            next: "lineitem-total",
            position: 1,
            overlay: true,
            highlight: '#line-items-section',
            title: "Line Item Tour: Price"
        });

        guiders.createGuider({
            attachTo: ".line-total:first",
            buttons: [closeButton, { name: "Next"}],
            description: "At this point you have filled out the required information for a valid line item.  The total for this line has been calculated automatically, along with the order totals."
                + "<br/><br/>Now we'll go in depth to check out some advanced features.",
            onShow: function (guider) {
                $(guider.attachTo).val(5).change();
            },
            id: "lineitem-total",
            next: "lineitem-calculatorbutton",
            position: 1,
            overlay: true,
            highlight: '#line-items-section',
            title: "Line Item Tour"
        });

        guiders.createGuider({
            attachTo: ".line-total:first",
            buttons: [closeButton, { name: "Next"}],
            description: "If you do not know the unit price for a line item, the price calculator can help you fill out the line item information given only the quantity and total price"
                + "<a class=\"ui-icon ui-icon-calculator\"></a>",
            id: "lineitem-calculatorbutton",
            next: "lineitem-calculatordialog",
            position: 1,
            overlay: true,
            highlight: '.price-calculator:first',
            title: "Price Calculator"
        });

        guiders.createGuider({
            attachTo: "#calculator-quantity",
            buttons: [closeButton, { name: "Next"}],
            description: "Enter the quantity and total price for this order, and the unit price will be calculated automatically"
            + "<br/><br/>Click 'Accept Values' and the quantity & unit $ fields will be filled in for you",
            onShow: function () {
                $(".price-calculator:first").click();
                $("#calculator-quantity").val(3);
                $("#calculator-total").val(15).change();
            },
            onHide: function () {
                $(".ui-dialog-titlebar-close").click();
            },
            id: "lineitem-calculatordialog",
            next: "lineitem-morebutton",
            position: 3,
            overlay: true,
            highlight: '.ui-dialog',
            title: "Price Calculator"
        });

        guiders.createGuider({
            attachTo: ".toggle-line-item-details:first",
            buttons: [closeButton, { name: "Next"}],
            description: "You can include additional optional information about a line item by clicking the 'More' icon"
            + "<a class=\"ui-icon ui-icon-comment\"></a>",
            onHide: function (guider) {
                $(guider.attachTo).click();
            },
            id: "lineitem-morebutton",
            next: "lineitem-commodity",
            position: 1,
            overlay: true,
            highlight: ".toggle-line-item-details:first",
            title: "More Information"
        });

        guiders.createGuider({
            attachTo: "input[name='items[0].commodityCode']",
            buttons: [closeButton, { name: "Next"}],
            description: "Optionally, you may enter a Commodity code. You will be informed if no match is found. If you do not know the commodity code, leave it blank and it will be completed at the purchase stage.",
            onShow: function (guider) {
                $(guider.attachTo).val("13165").change();
            },
            id: "lineitem-commodity",
            next: "lineitem-url",
            position: 1,
            overlay: true,
            highlight: '#line-items-section',
            title: "Line Item Tour: Commodity"
        });

        guiders.createGuider({
            attachTo: "input[name='items[0].url']",
            buttons: [closeButton, { name: "Next"}],
            description: "Optionally, you may enter a URL for your line item.",
            onShow: function (guider) {
                $(guider.attachTo).val("www.mybeststore.com/chairs/1").change();
            },
            id: "lineitem-url",
            next: "lineitem-notes",
            position: 1,
            overlay: true,
            highlight: '#line-items-section',
            title: "Line Item Tour: Item URL"
        });

        guiders.createGuider({
            attachTo: "textarea[name='items[0].notes']",
            buttons: [closeButton, { name: "Next"}],
            description: "Optionally, you may enter notes for your line item. You can make the text area larger or smaller by dragging on the right corner. You may enter multiple lines of text with the enter key. You may press the tab key to move to the next field.",
            onShow: function (guider) {
                $(guider.attachTo).val("Please select the blue chair.").change();
            },
            id: "lineitem-notes",
            next: "lineitem-finish",
            position: 1,
            overlay: true,
            highlight: '#line-items-section',
            title: "Line Item Tour: Item Notes"
        });

        guiders.createGuider({
            buttons: [{ name: "Thanks for the tour, I'll take it from here!", onclick: function () { tour.complete(); } }],
            description: "That's it!  Pretty easy huh?",
            id: "lineitem-finish",
            overlay: true,
            position: 0,
            title: "Line Item Tour"
        });

    }

    function loadOverviewTour() {
        var intro = tour.isOriginalRequest() === true
            ? "Don't panic!  Your current form will be saved and restored whenever you choose to quit the tour"
            : "Once this tour is over your page will reload and any unsaved modifications will be lost. If this is not ok, please click close now";

        guiders.createGuider({
            buttons: [{ name: "Close" }, {
                name: "Let's get started",
                onclick: function () {
                    resetPage(); //We have chosen to enter the tour, so reset the page
                    guiders.next();
{'fraction_non_alphanumeric': 0.12176302716414755, 'fraction_numerical': 0.0032237607018285592, 'mean_word_length': 1.8425717290070602, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, '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': '5197746', 'n_tokens_mistral': 4989, 'n_tokens_neox': 4765, 'n_words': 1554}