mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-04 15:15:42 +00:00 
			
		
		
		
	lots of linting fixes for JS files
This commit is contained in:
		@@ -15,6 +15,11 @@ rules:
 | 
				
			|||||||
  padded-blocks: off
 | 
					  padded-blocks: off
 | 
				
			||||||
  prefer-const: off
 | 
					  prefer-const: off
 | 
				
			||||||
  max-len: off
 | 
					  max-len: off
 | 
				
			||||||
 | 
					  require-jsdoc: off
 | 
				
			||||||
 | 
					  valid-jsdoc: off
 | 
				
			||||||
 | 
					  no-multiple-empty-lines: off
 | 
				
			||||||
 | 
					  comma-dangle: off
 | 
				
			||||||
 | 
					  prefer-spread: off
 | 
				
			||||||
  indent:
 | 
					  indent:
 | 
				
			||||||
    - error
 | 
					    - error
 | 
				
			||||||
    - 4
 | 
					    - 4
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,12 +15,12 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
function startDate(calendar) {
 | 
					function startDate(calendar) {
 | 
				
			||||||
    // Extract the first displayed date on the calendar
 | 
					    // Extract the first displayed date on the calendar
 | 
				
			||||||
    return calendar.currentData.dateProfile.activeRange.start.toISOString().split("T")[0];
 | 
					    return calendar.currentData.dateProfile.activeRange.start.toISOString().split('T')[0];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function endDate(calendar) {
 | 
					function endDate(calendar) {
 | 
				
			||||||
    // Extract the last display date on the calendar
 | 
					    // Extract the last display date on the calendar
 | 
				
			||||||
    return calendar.currentData.dateProfile.activeRange.end.toISOString().split("T")[0];
 | 
					    return calendar.currentData.dateProfile.activeRange.end.toISOString().split('T')[0];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function clearEvents(calendar) {
 | 
					function clearEvents(calendar) {
 | 
				
			||||||
@@ -30,5 +30,5 @@ function clearEvents(calendar) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    events.forEach(function(event) {
 | 
					    events.forEach(function(event) {
 | 
				
			||||||
        event.remove();
 | 
					        event.remove();
 | 
				
			||||||
    })
 | 
					    });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -29,12 +29,12 @@ function attachClipboard(selector, containerselector, textElement) {
 | 
				
			|||||||
    if (textElement) {
 | 
					    if (textElement) {
 | 
				
			||||||
        text = function() {
 | 
					        text = function() {
 | 
				
			||||||
            return document.getElementById(textElement).textContent;
 | 
					            return document.getElementById(textElement).textContent;
 | 
				
			||||||
        }
 | 
					        };
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        text = function(trigger) {
 | 
					        text = function(trigger) {
 | 
				
			||||||
            var content = trigger.parentElement.parentElement.textContent;
 | 
					            var content = trigger.parentElement.parentElement.textContent;
 | 
				
			||||||
            return content.trim();
 | 
					            return content.trim();
 | 
				
			||||||
        }
 | 
					        };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // create Clipboard
 | 
					    // create Clipboard
 | 
				
			||||||
@@ -51,12 +51,12 @@ function inventreeDocReady() {
 | 
				
			|||||||
     * This will be called for every page that extends "base.html"
 | 
					     * This will be called for every page that extends "base.html"
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    window.addEventListener("dragover",function(e){
 | 
					    window.addEventListener('dragover', function(e) {
 | 
				
			||||||
        e = e || event;
 | 
					        e = e || event;
 | 
				
			||||||
        e.preventDefault();
 | 
					        e.preventDefault();
 | 
				
			||||||
    }, false);
 | 
					    }, false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    window.addEventListener("drop",function(e){
 | 
					    window.addEventListener('drop', function(e) {
 | 
				
			||||||
        e = e || event;
 | 
					        e = e || event;
 | 
				
			||||||
        e.preventDefault();
 | 
					        e.preventDefault();
 | 
				
			||||||
    }, false);
 | 
					    }, false);
 | 
				
			||||||
@@ -93,18 +93,18 @@ function inventreeDocReady() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // Callback to launch the 'Database Stats' window
 | 
					    // Callback to launch the 'Database Stats' window
 | 
				
			||||||
    $('#launch-stats').click(function() {
 | 
					    $('#launch-stats').click(function() {
 | 
				
			||||||
        launchModalForm("/stats/", {
 | 
					        launchModalForm('/stats/', {
 | 
				
			||||||
            no_post: true,
 | 
					            no_post: true,
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Initialize clipboard-buttons
 | 
					    // Initialize clipboard-buttons
 | 
				
			||||||
    attachClipboard('.clip-btn');
 | 
					    attachClipboard('.clip-btn');
 | 
				
			||||||
    attachClipboard('.clip-btn', 'modal-about');  // modals
 | 
					    attachClipboard('.clip-btn', 'modal-about');
 | 
				
			||||||
    attachClipboard('.clip-btn-version', 'modal-about', 'about-copy-text');  // version-text
 | 
					    attachClipboard('.clip-btn-version', 'modal-about', 'about-copy-text');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Add autocomplete to the search-bar
 | 
					    // Add autocomplete to the search-bar
 | 
				
			||||||
    $("#search-bar" ).autocomplete({
 | 
					    $('#search-bar').autocomplete({
 | 
				
			||||||
        source: function(request, response) {
 | 
					        source: function(request, response) {
 | 
				
			||||||
            $.ajax({
 | 
					            $.ajax({
 | 
				
			||||||
                url: '/api/part/',
 | 
					                url: '/api/part/',
 | 
				
			||||||
@@ -147,7 +147,9 @@ function inventreeDocReady() {
 | 
				
			|||||||
            window.location = '/part/' + ui.item.id + '/';
 | 
					            window.location = '/part/' + ui.item.id + '/';
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        minLength: 2,
 | 
					        minLength: 2,
 | 
				
			||||||
        classes: {'ui-autocomplete': 'dropdown-menu search-menu'},
 | 
					        classes: {
 | 
				
			||||||
 | 
					            'ui-autocomplete': 'dropdown-menu search-menu',
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -217,21 +219,27 @@ function enableDragAndDrop(element, url, options) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function inventreeSave(name, value) {
 | 
					/**
 | 
				
			||||||
    /*
 | 
					 | 
				
			||||||
 * Save a key:value pair to local storage
 | 
					 * Save a key:value pair to local storage
 | 
				
			||||||
 | 
					 * @param {String} name - settting key 
 | 
				
			||||||
 | 
					 * @param {String} value - setting value
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					function inventreeSave(name, value) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var key = "inventree-" + name;
 | 
					    var key = `inventree-${name}`;
 | 
				
			||||||
    localStorage.setItem(key, value);
 | 
					    localStorage.setItem(key, value);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function inventreeLoad(name, defaultValue) {
 | 
					 | 
				
			||||||
    /* 
 | 
					 | 
				
			||||||
     * Retrieve a key:value pair from local storage
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var key = "inventree-" + name;
 | 
					/**
 | 
				
			||||||
 | 
					 * Retrieve a key:value pair from local storage
 | 
				
			||||||
 | 
					 * @param {*} name - setting key
 | 
				
			||||||
 | 
					 * @param {*} defaultValue - default value (returned if no matching key:value pair is found)
 | 
				
			||||||
 | 
					 * @returns 
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					function inventreeLoad(name, defaultValue) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    var key = `inventree-${name}`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var value = localStorage.getItem(key);
 | 
					    var value = localStorage.getItem(key);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,11 +16,14 @@
 | 
				
			|||||||
$.urlParam = function(name) {
 | 
					$.urlParam = function(name) {
 | 
				
			||||||
    // eslint-disable-next-line no-useless-escape
 | 
					    // eslint-disable-next-line no-useless-escape
 | 
				
			||||||
    var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
 | 
					    var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    if (results == null) {
 | 
					    if (results == null) {
 | 
				
			||||||
        return null;
 | 
					        return null;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    return decodeURI(results[1]) || 0;
 | 
					    return decodeURI(results[1]) || 0;
 | 
				
			||||||
}
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// using jQuery
 | 
					// using jQuery
 | 
				
			||||||
function getCookie(name) {
 | 
					function getCookie(name) {
 | 
				
			||||||
@@ -42,7 +45,6 @@ function getCookie(name) {
 | 
				
			|||||||
function inventreeGet(url, filters={}, options={}) {
 | 
					function inventreeGet(url, filters={}, options={}) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Middleware token required for data update
 | 
					    // Middleware token required for data update
 | 
				
			||||||
    //var csrftoken = jQuery("[name=csrfmiddlewaretoken]").val();
 | 
					 | 
				
			||||||
    var csrftoken = getCookie('csrftoken');
 | 
					    var csrftoken = getCookie('csrftoken');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return $.ajax({
 | 
					    return $.ajax({
 | 
				
			||||||
@@ -112,7 +114,6 @@ function inventreePut(url, data={}, options={}) {
 | 
				
			|||||||
    var method = options.method || 'PUT';
 | 
					    var method = options.method || 'PUT';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Middleware token required for data update
 | 
					    // Middleware token required for data update
 | 
				
			||||||
    //var csrftoken = jQuery("[name=csrfmiddlewaretoken]").val();
 | 
					 | 
				
			||||||
    var csrftoken = getCookie('csrftoken');
 | 
					    var csrftoken = getCookie('csrftoken');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return $.ajax({
 | 
					    return $.ajax({
 | 
				
			||||||
@@ -168,29 +169,35 @@ function showApiError(xhr) {
 | 
				
			|||||||
    var message = null;
 | 
					    var message = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    switch (xhr.status) {
 | 
					    switch (xhr.status) {
 | 
				
			||||||
    case 0:     // No response
 | 
					    // No response
 | 
				
			||||||
 | 
					    case 0:
 | 
				
			||||||
        title = '{% trans "No Response" %}';
 | 
					        title = '{% trans "No Response" %}';
 | 
				
			||||||
        message = '{% trans "No response from the InvenTree server" %}';
 | 
					        message = '{% trans "No response from the InvenTree server" %}';
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case 400:   // Bad request
 | 
					    // Bad request
 | 
				
			||||||
 | 
					    case 400:
 | 
				
			||||||
        // Note: Normally error code 400 is handled separately,
 | 
					        // Note: Normally error code 400 is handled separately,
 | 
				
			||||||
        //       and should now be shown here!
 | 
					        //       and should now be shown here!
 | 
				
			||||||
        title = '{% trans "Error 400: Bad request" %}';
 | 
					        title = '{% trans "Error 400: Bad request" %}';
 | 
				
			||||||
        message = '{% trans "API request returned error code 400" %}';
 | 
					        message = '{% trans "API request returned error code 400" %}';
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case 401:   // Not authenticated
 | 
					    // Not authenticated
 | 
				
			||||||
 | 
					    case 401:
 | 
				
			||||||
        title = '{% trans "Error 401: Not Authenticated" %}';
 | 
					        title = '{% trans "Error 401: Not Authenticated" %}';
 | 
				
			||||||
        message = '{% trans "Authentication credentials not supplied" %}';
 | 
					        message = '{% trans "Authentication credentials not supplied" %}';
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case 403:   // Permission denied
 | 
					    // Permission denied
 | 
				
			||||||
 | 
					    case 403:
 | 
				
			||||||
        title = '{% trans "Error 403: Permission Denied" %}';
 | 
					        title = '{% trans "Error 403: Permission Denied" %}';
 | 
				
			||||||
        message = '{% trans "You do not have the required permissions to access this function" %}';
 | 
					        message = '{% trans "You do not have the required permissions to access this function" %}';
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case 404:   // Resource not found
 | 
					    // Resource not found
 | 
				
			||||||
 | 
					    case 404:
 | 
				
			||||||
        title = '{% trans "Error 404: Resource Not Found" %}';
 | 
					        title = '{% trans "Error 404: Resource Not Found" %}';
 | 
				
			||||||
        message = '{% trans "The requested resource could not be located on the server" %}';
 | 
					        message = '{% trans "The requested resource could not be located on the server" %}';
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case 408:   // Timeout
 | 
					    // Timeout
 | 
				
			||||||
 | 
					    case 408:
 | 
				
			||||||
        title = '{% trans "Error 408: Timeout" %}';
 | 
					        title = '{% trans "Error 408: Timeout" %}';
 | 
				
			||||||
        message = '{% trans "Connection timeout while requesting data from server" %}';
 | 
					        message = '{% trans "Connection timeout while requesting data from server" %}';
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
@@ -200,7 +207,7 @@ function showApiError(xhr) {
 | 
				
			|||||||
        break;
 | 
					        break;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    message += "<hr>";
 | 
					    message += '<hr>';
 | 
				
			||||||
    message += renderErrorMessage(xhr);
 | 
					    message += renderErrorMessage(xhr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    showAlertDialog(title, message);
 | 
					    showAlertDialog(title, message);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,7 +12,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
function reloadAttachmentTable() {
 | 
					function reloadAttachmentTable() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $('#attachment-table').bootstrapTable("refresh");
 | 
					    $('#attachment-table').bootstrapTable('refresh');
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -24,7 +24,7 @@ function loadAttachmentTable(url, options) {
 | 
				
			|||||||
        url: url,
 | 
					        url: url,
 | 
				
			||||||
        name: options.name || 'attachments',
 | 
					        name: options.name || 'attachments',
 | 
				
			||||||
        formatNoMatches: function() {
 | 
					        formatNoMatches: function() {
 | 
				
			||||||
            return '{% trans "No attachments found" %}'
 | 
					            return '{% trans "No attachments found" %}';
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        sortable: true,
 | 
					        sortable: true,
 | 
				
			||||||
        search: false,
 | 
					        search: false,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -121,7 +121,7 @@ function postBarcodeData(barcode_data, options={}) {
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    )
 | 
					    );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -131,7 +131,7 @@ function showBarcodeMessage(modal, message, style='danger') {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    html += message;
 | 
					    html += message;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    html += "</div>";
 | 
					    html += '</div>';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $(modal + ' #barcode-error-message').html(html);
 | 
					    $(modal + ' #barcode-error-message').html(html);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -278,7 +278,7 @@ function barcodeScanDialog() {
 | 
				
			|||||||
    var modal = '#modal-form';
 | 
					    var modal = '#modal-form';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    barcodeDialog(
 | 
					    barcodeDialog(
 | 
				
			||||||
        "Scan Barcode",
 | 
					        '{% trans "Scan Barcode" %}',
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            onScan: function(response) {
 | 
					            onScan: function(response) {
 | 
				
			||||||
                if ('url' in response) {
 | 
					                if ('url' in response) {
 | 
				
			||||||
@@ -307,7 +307,7 @@ function linkBarcodeDialog(stockitem) {
 | 
				
			|||||||
    var modal = '#modal-form';
 | 
					    var modal = '#modal-form';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    barcodeDialog(
 | 
					    barcodeDialog(
 | 
				
			||||||
        "{% trans 'Link Barcode to Stock Item' %}",
 | 
					        '{% trans "Link Barcode to Stock Item" %}',
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            url: '/api/barcode/link/',
 | 
					            url: '/api/barcode/link/',
 | 
				
			||||||
            data: {
 | 
					            data: {
 | 
				
			||||||
@@ -330,13 +330,13 @@ function unlinkBarcode(stockitem) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    var html = `<b>{% trans "Unlink Barcode" %}</b><br>`;
 | 
					    var html = `<b>{% trans "Unlink Barcode" %}</b><br>`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    html += "{% trans 'This will remove the association between this stock item and the barcode' %}";
 | 
					    html += '{% trans "This will remove the association between this stock item and the barcode" %}';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    showQuestionDialog(
 | 
					    showQuestionDialog(
 | 
				
			||||||
        "{% trans 'Unlink Barcode' %}",
 | 
					        '{% trans "Unlink Barcode" %}',
 | 
				
			||||||
        html,
 | 
					        html,
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            accept_text: "{% trans 'Unlink' %}",
 | 
					            accept_text: '{% trans "Unlink" %}',
 | 
				
			||||||
            accept: function() {
 | 
					            accept: function() {
 | 
				
			||||||
                inventreePut(
 | 
					                inventreePut(
 | 
				
			||||||
                    `/api/stock/${stockitem}/`,
 | 
					                    `/api/stock/${stockitem}/`,
 | 
				
			||||||
@@ -471,7 +471,7 @@ function barcodeCheckIn(location_id) {
 | 
				
			|||||||
                data.items = entries;
 | 
					                data.items = entries;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                inventreePut(
 | 
					                inventreePut(
 | 
				
			||||||
                    "{% url 'api-stock-transfer' %}",
 | 
					                    '{% url "api-stock-transfer" %}',
 | 
				
			||||||
                    data,
 | 
					                    data,
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        method: 'POST',
 | 
					                        method: 'POST',
 | 
				
			||||||
@@ -502,7 +502,7 @@ function barcodeCheckIn(location_id) {
 | 
				
			|||||||
                    });
 | 
					                    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    if (duplicate) {
 | 
					                    if (duplicate) {
 | 
				
			||||||
                        showBarcodeMessage(modal, '{% trans "Stock Item already scanned" %}', "warning");
 | 
					                        showBarcodeMessage(modal, '{% trans "Stock Item already scanned" %}', 'warning');
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        if (stockitem.location == location_id) {
 | 
					                        if (stockitem.location == location_id) {
 | 
				
			||||||
@@ -513,14 +513,14 @@ function barcodeCheckIn(location_id) {
 | 
				
			|||||||
                        // Add this stock item to the list
 | 
					                        // Add this stock item to the list
 | 
				
			||||||
                        items.push(stockitem);
 | 
					                        items.push(stockitem);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        showBarcodeMessage(modal, '{% trans "Added stock item" %}', "success");
 | 
					                        showBarcodeMessage(modal, '{% trans "Added stock item" %}', 'success');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        reloadTable();
 | 
					                        reloadTable();
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
                    // Barcode does not match a stock item
 | 
					                    // Barcode does not match a stock item
 | 
				
			||||||
                    showBarcodeMessage(modal, '{% trans "Barcode does not match Stock Item" %}', "warning");
 | 
					                    showBarcodeMessage(modal, '{% trans "Barcode does not match Stock Item" %}', 'warning');
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -585,7 +585,7 @@ function scanItemsIntoLocation(item_id_list, options={}) {
 | 
				
			|||||||
                    items.push({
 | 
					                    items.push({
 | 
				
			||||||
                        pk: pk,
 | 
					                        pk: pk,
 | 
				
			||||||
                    });
 | 
					                    });
 | 
				
			||||||
                })
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                var data = {
 | 
					                var data = {
 | 
				
			||||||
                    location: stock_location.pk,
 | 
					                    location: stock_location.pk,
 | 
				
			||||||
@@ -611,7 +611,7 @@ function scanItemsIntoLocation(item_id_list, options={}) {
 | 
				
			|||||||
                            }
 | 
					                            }
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                )
 | 
					                );
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            onScan: function(response) {
 | 
					            onScan: function(response) {
 | 
				
			||||||
                updateLocationInfo(null);
 | 
					                updateLocationInfo(null);
 | 
				
			||||||
@@ -627,10 +627,10 @@ function scanItemsIntoLocation(item_id_list, options={}) {
 | 
				
			|||||||
                    showBarcodeMessage(
 | 
					                    showBarcodeMessage(
 | 
				
			||||||
                        modal,
 | 
					                        modal,
 | 
				
			||||||
                        '{% trans "Barcode does not match a valid location" %}',
 | 
					                        '{% trans "Barcode does not match a valid location" %}',
 | 
				
			||||||
                        "warning",
 | 
					                        'warning',
 | 
				
			||||||
                    );
 | 
					                    );
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    )
 | 
					    );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -146,7 +146,7 @@ function loadBomTable(table, options) {
 | 
				
			|||||||
    var params = {
 | 
					    var params = {
 | 
				
			||||||
        part: options.parent_id,
 | 
					        part: options.parent_id,
 | 
				
			||||||
        ordering: 'name',
 | 
					        ordering: 'name',
 | 
				
			||||||
    }
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (options.part_detail) {
 | 
					    if (options.part_detail) {
 | 
				
			||||||
        params.part_detail = true;
 | 
					        params.part_detail = true;
 | 
				
			||||||
@@ -264,8 +264,7 @@ function loadBomTable(table, options) {
 | 
				
			|||||||
        },
 | 
					        },
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cols.push(
 | 
					    cols.push({
 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        field: 'sub_part_detail.stock',
 | 
					        field: 'sub_part_detail.stock',
 | 
				
			||||||
        title: '{% trans "Available" %}',
 | 
					        title: '{% trans "Available" %}',
 | 
				
			||||||
        searchable: false,
 | 
					        searchable: false,
 | 
				
			||||||
@@ -283,24 +282,21 @@ function loadBomTable(table, options) {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    cols.push(
 | 
					    cols.push({
 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        field: 'purchase_price_range',
 | 
					        field: 'purchase_price_range',
 | 
				
			||||||
        title: '{% trans "Purchase Price Range" %}',
 | 
					        title: '{% trans "Purchase Price Range" %}',
 | 
				
			||||||
        searchable: false,
 | 
					        searchable: false,
 | 
				
			||||||
        sortable: true,
 | 
					        sortable: true,
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cols.push(
 | 
					    cols.push({
 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        field: 'purchase_price_avg',
 | 
					        field: 'purchase_price_avg',
 | 
				
			||||||
        title: '{% trans "Purchase Price Average" %}',
 | 
					        title: '{% trans "Purchase Price Average" %}',
 | 
				
			||||||
        searchable: false,
 | 
					        searchable: false,
 | 
				
			||||||
        sortable: true,
 | 
					        sortable: true,
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cols.push(
 | 
					    cols.push({
 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        field: 'price_range',
 | 
					        field: 'price_range',
 | 
				
			||||||
        title: '{% trans "Supplier Cost" %}',
 | 
					        title: '{% trans "Supplier Cost" %}',
 | 
				
			||||||
        sortable: true,
 | 
					        sortable: true,
 | 
				
			||||||
@@ -308,7 +304,7 @@ function loadBomTable(table, options) {
 | 
				
			|||||||
            if (value) {
 | 
					            if (value) {
 | 
				
			||||||
                return value;
 | 
					                return value;
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                return "<span class='warning-msg'>{% trans 'No supplier pricing available' %}</span>";
 | 
					                return `<span class='warning-msg'>{% trans 'No supplier pricing available' %}</span>`;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
@@ -328,7 +324,7 @@ function loadBomTable(table, options) {
 | 
				
			|||||||
        formatter: function(value) {
 | 
					        formatter: function(value) {
 | 
				
			||||||
            return yesNoLabel(value);
 | 
					            return yesNoLabel(value);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    })
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cols.push({
 | 
					    cols.push({
 | 
				
			||||||
        field: 'inherited',
 | 
					        field: 'inherited',
 | 
				
			||||||
@@ -352,8 +348,8 @@ function loadBomTable(table, options) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    cols.push(
 | 
					    cols.push(
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            'field': 'can_build',
 | 
					            field: 'can_build',
 | 
				
			||||||
            'title': '{% trans "Can Build" %}',
 | 
					            title: '{% trans "Can Build" %}',
 | 
				
			||||||
            formatter: function(value, row) {
 | 
					            formatter: function(value, row) {
 | 
				
			||||||
                var can_build = 0;
 | 
					                var can_build = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -380,7 +376,7 @@ function loadBomTable(table, options) {
 | 
				
			|||||||
            },
 | 
					            },
 | 
				
			||||||
            sortable: true,
 | 
					            sortable: true,
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    )
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Part notes
 | 
					    // Part notes
 | 
				
			||||||
    cols.push(
 | 
					    cols.push(
 | 
				
			||||||
@@ -411,7 +407,7 @@ function loadBomTable(table, options) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                    var bDelt = `<button title='{% trans "Delete BOM Item" %}' class='bom-delete-button btn btn-default btn-glyph' type='button' pk='${row.pk}'><span class='fas fa-trash-alt icon-red'></span></button>`;
 | 
					                    var bDelt = `<button title='{% trans "Delete BOM Item" %}' class='bom-delete-button btn btn-default btn-glyph' type='button' pk='${row.pk}'><span class='fas fa-trash-alt icon-red'></span></button>`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    var html = "<div class='btn-group' role='group'>";
 | 
					                    var html = `<div class='btn-group' role='group'>`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    html += bEdit;
 | 
					                    html += bEdit;
 | 
				
			||||||
                    html += bDelt;
 | 
					                    html += bDelt;
 | 
				
			||||||
@@ -422,7 +418,7 @@ function loadBomTable(table, options) {
 | 
				
			|||||||
                        html += bValid;
 | 
					                        html += bValid;
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    html += "</div>";
 | 
					                    html += `</div>`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    return html;
 | 
					                    return html;
 | 
				
			||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
@@ -454,7 +450,7 @@ function loadBomTable(table, options) {
 | 
				
			|||||||
                        response[idx].parentId = bom_pk;
 | 
					                        response[idx].parentId = bom_pk;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        if (response[idx].sub_part_detail.assembly) {
 | 
					                        if (response[idx].sub_part_detail.assembly) {
 | 
				
			||||||
                            requestSubItems(response[idx].pk, response[idx].sub_part)
 | 
					                            requestSubItems(response[idx].pk, response[idx].sub_part);
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -466,7 +462,7 @@ function loadBomTable(table, options) {
 | 
				
			|||||||
                    console.log('Error requesting BOM for part=' + part_pk);
 | 
					                    console.log('Error requesting BOM for part=' + part_pk);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        )
 | 
					        );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    table.inventreeTable({
 | 
					    table.inventreeTable({
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -229,13 +229,13 @@ function loadBuildOrderAllocationTable(table, options={}) {
 | 
				
			|||||||
    options.params['build_detail'] = true;
 | 
					    options.params['build_detail'] = true;
 | 
				
			||||||
    options.params['location_detail'] = true;
 | 
					    options.params['location_detail'] = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var filters = loadTableFilters("buildorderallocation");
 | 
					    var filters = loadTableFilters('buildorderallocation');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (var key in options.params) {
 | 
					    for (var key in options.params) {
 | 
				
			||||||
        filters[key] = options.params[key];
 | 
					        filters[key] = options.params[key];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    setupFilterList("buildorderallocation", $(table));
 | 
					    setupFilterList('buildorderallocation', $(table));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $(table).inventreeTable({
 | 
					    $(table).inventreeTable({
 | 
				
			||||||
        url: '{% url "api-build-item-list" %}',
 | 
					        url: '{% url "api-build-item-list" %}',
 | 
				
			||||||
@@ -246,7 +246,7 @@ function loadBuildOrderAllocationTable(table, options={}) {
 | 
				
			|||||||
        paginationVAlign: 'bottom',
 | 
					        paginationVAlign: 'bottom',
 | 
				
			||||||
        original: options.params,
 | 
					        original: options.params,
 | 
				
			||||||
        formatNoMatches: function() {
 | 
					        formatNoMatches: function() {
 | 
				
			||||||
            return '{% trans "No build order allocations found" %}'
 | 
					            return '{% trans "No build order allocations found" %}';
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        columns: [
 | 
					        columns: [
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
@@ -372,13 +372,13 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) {
 | 
				
			|||||||
        // Register button callbacks once table data are loaded
 | 
					        // Register button callbacks once table data are loaded
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Callback for 'allocate' button
 | 
					        // Callback for 'allocate' button
 | 
				
			||||||
        $(table).find(".button-add").click(function() {
 | 
					        $(table).find('.button-add').click(function() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Primary key of the 'sub_part'
 | 
					            // Primary key of the 'sub_part'
 | 
				
			||||||
            var pk = $(this).attr('pk');
 | 
					            var pk = $(this).attr('pk');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Launch form to allocate new stock against this output
 | 
					            // Launch form to allocate new stock against this output
 | 
				
			||||||
            launchModalForm("{% url 'build-item-create' %}", {
 | 
					            launchModalForm('{% url "build-item-create" %}', {
 | 
				
			||||||
                success: reloadTable,
 | 
					                success: reloadTable,
 | 
				
			||||||
                data: {
 | 
					                data: {
 | 
				
			||||||
                    part: pk,
 | 
					                    part: pk,
 | 
				
			||||||
@@ -418,7 +418,7 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) {
 | 
				
			|||||||
                                        }
 | 
					                                        }
 | 
				
			||||||
                                    }
 | 
					                                    }
 | 
				
			||||||
                                }
 | 
					                                }
 | 
				
			||||||
                            )
 | 
					                            );
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                ]
 | 
					                ]
 | 
				
			||||||
@@ -472,7 +472,7 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // Load table of BOM items
 | 
					    // Load table of BOM items
 | 
				
			||||||
    $(table).inventreeTable({
 | 
					    $(table).inventreeTable({
 | 
				
			||||||
        url: "{% url 'api-bom-list' %}",
 | 
					        url: '{% url "api-bom-list" %}',
 | 
				
			||||||
        queryParams: {
 | 
					        queryParams: {
 | 
				
			||||||
            part: partId,
 | 
					            part: partId,
 | 
				
			||||||
            sub_part_detail: true,
 | 
					            sub_part_detail: true,
 | 
				
			||||||
@@ -492,7 +492,7 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) {
 | 
				
			|||||||
                build: buildId,
 | 
					                build: buildId,
 | 
				
			||||||
                part_detail: true,
 | 
					                part_detail: true,
 | 
				
			||||||
                location_detail: true,
 | 
					                location_detail: true,
 | 
				
			||||||
            }
 | 
					            };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (output) {
 | 
					            if (output) {
 | 
				
			||||||
                params.sub_part_trackable = true;
 | 
					                params.sub_part_trackable = true;
 | 
				
			||||||
@@ -521,7 +521,7 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) {
 | 
				
			|||||||
                            var key = parseInt(part);
 | 
					                            var key = parseInt(part);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                            if (!(key in allocations)) {
 | 
					                            if (!(key in allocations)) {
 | 
				
			||||||
                                allocations[key] = new Array();
 | 
					                                allocations[key] = [];
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                            allocations[key].push(item);
 | 
					                            allocations[key].push(item);
 | 
				
			||||||
@@ -827,7 +827,7 @@ function loadBuildTable(table, options) {
 | 
				
			|||||||
    params['part_detail'] = true;
 | 
					    params['part_detail'] = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!options.disableFilters) {
 | 
					    if (!options.disableFilters) {
 | 
				
			||||||
        filters = loadTableFilters("build");
 | 
					        filters = loadTableFilters('build');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (var key in params) {
 | 
					    for (var key in params) {
 | 
				
			||||||
@@ -838,7 +838,7 @@ function loadBuildTable(table, options) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    var filterTarget = options.filterTarget || null;
 | 
					    var filterTarget = options.filterTarget || null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    setupFilterList("build", table, filterTarget);
 | 
					    setupFilterList('build', table, filterTarget);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $(table).inventreeTable({
 | 
					    $(table).inventreeTable({
 | 
				
			||||||
        method: 'get',
 | 
					        method: 'get',
 | 
				
			||||||
@@ -985,7 +985,7 @@ function updateAllocationTotal(id, count, required) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    $('#allocation-total-'+id).html(count);
 | 
					    $('#allocation-total-'+id).html(count);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var el = $("#allocation-panel-" + id);
 | 
					    var el = $('#allocation-panel-' + id);
 | 
				
			||||||
    el.removeClass('part-allocation-pass part-allocation-underallocated part-allocation-overallocated');
 | 
					    el.removeClass('part-allocation-pass part-allocation-underallocated part-allocation-overallocated');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (count < required) {
 | 
					    if (count < required) {
 | 
				
			||||||
@@ -1027,10 +1027,15 @@ function loadAllocationTable(table, part_id, part, url, required, button) {
 | 
				
			|||||||
                formatter: function(value, row) {
 | 
					                formatter: function(value, row) {
 | 
				
			||||||
                    var html = parseFloat(value);
 | 
					                    var html = parseFloat(value);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    var bEdit = "<button class='btn item-edit-button btn-sm' type='button' title='{% trans "Edit stock allocation" %}' url='/build/item/" + row.pk + "/edit/'><span class='fas fa-edit'></span></button>";
 | 
					                    var bEdit = `<button class='btn item-edit-button btn-sm' type='button' title='{% trans "Edit stock allocation" %}' url='/build/item/${row.pk}/edit/'><span class='fas fa-edit'></span></button>`;
 | 
				
			||||||
                    var bDel = "<button class='btn item-del-button btn-sm' type='button' title='{% trans "Delete stock allocation" %}' url='/build/item/" + row.pk + "/delete/'><span class='fas fa-trash-alt icon-red'></span></button>";
 | 
					                    var bDel = `<button class='btn item-del-button btn-sm' type='button' title='{% trans "Delete stock allocation" %}' url='/build/item/${row.pk}/delete/'><span class='fas fa-trash-alt icon-red'></span></button>`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    html += "<div class='btn-group' style='float: right;'>" + bEdit + bDel + "</div>";
 | 
					                    html += `
 | 
				
			||||||
 | 
					                    <div class='btn-group' style='float: right;'>
 | 
				
			||||||
 | 
					                        ${bEdit}
 | 
				
			||||||
 | 
					                        ${bDel}
 | 
				
			||||||
 | 
					                    </div>
 | 
				
			||||||
 | 
					                    `;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    return html;
 | 
					                    return html;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,6 +24,10 @@
 | 
				
			|||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Construct a set of form fields for creating / editing a ManufacturerPart
 | 
				
			||||||
 | 
					 * @returns 
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
function manufacturerPartFields() {
 | 
					function manufacturerPartFields() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
@@ -40,6 +44,10 @@ function manufacturerPartFields() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Launches a form to create a new ManufacturerPart
 | 
				
			||||||
 | 
					 * @param {object} options 
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
function createManufacturerPart(options={}) {
 | 
					function createManufacturerPart(options={}) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var fields = manufacturerPartFields();
 | 
					    var fields = manufacturerPartFields();
 | 
				
			||||||
@@ -62,7 +70,7 @@ function createManufacturerPart(options={}) {
 | 
				
			|||||||
            
 | 
					            
 | 
				
			||||||
            return company_fields;
 | 
					            return company_fields;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    constructForm('{% url "api-manufacturer-part-list" %}', {
 | 
					    constructForm('{% url "api-manufacturer-part-list" %}', {
 | 
				
			||||||
        fields: fields,
 | 
					        fields: fields,
 | 
				
			||||||
@@ -73,6 +81,11 @@ function createManufacturerPart(options={}) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Launches a form to edit a ManufacturerPart
 | 
				
			||||||
 | 
					 * @param {integer} part - ID of a ManufacturerPart
 | 
				
			||||||
 | 
					 * @param {object} options 
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
function editManufacturerPart(part, options={}) {
 | 
					function editManufacturerPart(part, options={}) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var url = `/api/company/part/manufacturer/${part}/`;
 | 
					    var url = `/api/company/part/manufacturer/${part}/`;
 | 
				
			||||||
@@ -288,13 +301,13 @@ function loadCompanyTable(table, url, options={}) {
 | 
				
			|||||||
    // Query parameters
 | 
					    // Query parameters
 | 
				
			||||||
    var params = options.params || {};
 | 
					    var params = options.params || {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var filters = loadTableFilters("company");
 | 
					    var filters = loadTableFilters('company');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (var key in params) {
 | 
					    for (var key in params) {
 | 
				
			||||||
        filters[key] = params[key];
 | 
					        filters[key] = params[key];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    setupFilterList("company", $(table));
 | 
					    setupFilterList('company', $(table));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var columns = [
 | 
					    var columns = [
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
@@ -426,7 +439,7 @@ function deleteManufacturerParts(selections, options={}) {
 | 
				
			|||||||
                    if (options.onSuccess) {
 | 
					                    if (options.onSuccess) {
 | 
				
			||||||
                        options.onSuccess();
 | 
					                        options.onSuccess();
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                })
 | 
					                });
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
@@ -443,13 +456,13 @@ function loadManufacturerPartTable(table, url, options) {
 | 
				
			|||||||
    var params = options.params || {};
 | 
					    var params = options.params || {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Load filters
 | 
					    // Load filters
 | 
				
			||||||
    var filters = loadTableFilters("manufacturer-part");
 | 
					    var filters = loadTableFilters('manufacturer-part');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (var key in params) {
 | 
					    for (var key in params) {
 | 
				
			||||||
        filters[key] = params[key];
 | 
					        filters[key] = params[key];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    setupFilterList("manufacturer-part", $(table));
 | 
					    setupFilterList('manufacturer-part', $(table));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $(table).inventreeTable({
 | 
					    $(table).inventreeTable({
 | 
				
			||||||
        url: url,
 | 
					        url: url,
 | 
				
			||||||
@@ -505,7 +518,7 @@ function loadManufacturerPartTable(table, url, options) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                        return html;
 | 
					                        return html;
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        return "-";
 | 
					                        return '-';
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
@@ -564,7 +577,8 @@ function loadManufacturerPartTable(table, url, options) {
 | 
				
			|||||||
                        onSuccess: function() {
 | 
					                        onSuccess: function() {
 | 
				
			||||||
                            $(table).bootstrapTable('refresh');
 | 
					                            $(table).bootstrapTable('refresh');
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                });
 | 
					                    }
 | 
				
			||||||
 | 
					                );
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $(table).find('.button-manufacturer-part-delete').click(function() {
 | 
					            $(table).find('.button-manufacturer-part-delete').click(function() {
 | 
				
			||||||
@@ -576,8 +590,9 @@ function loadManufacturerPartTable(table, url, options) {
 | 
				
			|||||||
                        onSuccess: function() {
 | 
					                        onSuccess: function() {
 | 
				
			||||||
                            $(table).bootstrapTable('refresh');
 | 
					                            $(table).bootstrapTable('refresh');
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                );
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
            })
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -591,7 +606,7 @@ function loadManufacturerPartParameterTable(table, url, options) {
 | 
				
			|||||||
    var params = options.params || {};
 | 
					    var params = options.params || {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Load filters
 | 
					    // Load filters
 | 
				
			||||||
    var filters = loadTableFilters("manufacturer-part-parameters");
 | 
					    var filters = loadTableFilters('manufacturer-part-parameters');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Overwrite explicit parameters
 | 
					    // Overwrite explicit parameters
 | 
				
			||||||
    for (var key in params) {
 | 
					    for (var key in params) {
 | 
				
			||||||
@@ -607,7 +622,9 @@ function loadManufacturerPartParameterTable(table, url, options) {
 | 
				
			|||||||
        queryParams: filters,
 | 
					        queryParams: filters,
 | 
				
			||||||
        name: 'manufacturerpartparameters',
 | 
					        name: 'manufacturerpartparameters',
 | 
				
			||||||
        groupBy: false,
 | 
					        groupBy: false,
 | 
				
			||||||
        formatNoMatches: function() { return '{% trans "No parameters found" %}'; },
 | 
					        formatNoMatches: function() {
 | 
				
			||||||
 | 
					            return '{% trans "No parameters found" %}';
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
        columns: [
 | 
					        columns: [
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                checkbox: true,
 | 
					                checkbox: true,
 | 
				
			||||||
@@ -695,13 +712,13 @@ function loadSupplierPartTable(table, url, options) {
 | 
				
			|||||||
    var params = options.params || {};
 | 
					    var params = options.params || {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Load filters
 | 
					    // Load filters
 | 
				
			||||||
    var filters = loadTableFilters("supplier-part");
 | 
					    var filters = loadTableFilters('supplier-part');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (var key in params) {
 | 
					    for (var key in params) {
 | 
				
			||||||
        filters[key] = params[key];
 | 
					        filters[key] = params[key];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    setupFilterList("supplier-part", $(table));
 | 
					    setupFilterList('supplier-part', $(table));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $(table).inventreeTable({
 | 
					    $(table).inventreeTable({
 | 
				
			||||||
        url: url,
 | 
					        url: url,
 | 
				
			||||||
@@ -710,7 +727,9 @@ function loadSupplierPartTable(table, url, options) {
 | 
				
			|||||||
        queryParams: filters,
 | 
					        queryParams: filters,
 | 
				
			||||||
        name: 'supplierparts',
 | 
					        name: 'supplierparts',
 | 
				
			||||||
        groupBy: false,
 | 
					        groupBy: false,
 | 
				
			||||||
        formatNoMatches: function() { return '{% trans "No supplier parts found" %}'; },
 | 
					        formatNoMatches: function() {
 | 
				
			||||||
 | 
					            return '{% trans "No supplier parts found" %}';
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
        columns: [
 | 
					        columns: [
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                checkbox: true,
 | 
					                checkbox: true,
 | 
				
			||||||
@@ -755,7 +774,7 @@ function loadSupplierPartTable(table, url, options) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                        return html;
 | 
					                        return html;
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        return "-";
 | 
					                        return '-';
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
@@ -781,7 +800,7 @@ function loadSupplierPartTable(table, url, options) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                        return html;
 | 
					                        return html;
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        return "-";
 | 
					                        return '-';
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
@@ -795,7 +814,7 @@ function loadSupplierPartTable(table, url, options) {
 | 
				
			|||||||
                    if (value && row.manufacturer_part) {
 | 
					                    if (value && row.manufacturer_part) {
 | 
				
			||||||
                        return renderLink(value, `/manufacturer-part/${row.manufacturer_part}/`);
 | 
					                        return renderLink(value, `/manufacturer-part/${row.manufacturer_part}/`);
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        return "-";
 | 
					                        return '-';
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
@@ -870,7 +889,7 @@ function loadSupplierPartTable(table, url, options) {
 | 
				
			|||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
            })
 | 
					            });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -27,12 +27,12 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
function defaultFilters() {
 | 
					function defaultFilters() {
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
        stock: "cascade=1&in_stock=1",
 | 
					        stock: 'cascade=1&in_stock=1',
 | 
				
			||||||
        build: "",
 | 
					        build: '',
 | 
				
			||||||
        parts: "cascade=1",
 | 
					        parts: 'cascade=1',
 | 
				
			||||||
        company: "",
 | 
					        company: '',
 | 
				
			||||||
        salesorder: "",
 | 
					        salesorder: '',
 | 
				
			||||||
        purchaseorder: "",
 | 
					        purchaseorder: '',
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -45,7 +45,7 @@ function defaultFilters() {
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
function loadTableFilters(tableKey) {
 | 
					function loadTableFilters(tableKey) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var lookup = "table-filters-" + tableKey.toLowerCase();
 | 
					    var lookup = 'table-filters-' + tableKey.toLowerCase();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var defaults = defaultFilters()[tableKey] || '';
 | 
					    var defaults = defaultFilters()[tableKey] || '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -53,7 +53,7 @@ function loadTableFilters(tableKey) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    var filters = {};
 | 
					    var filters = {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    filterstring.split("&").forEach(function(item) {
 | 
					    filterstring.split('&').forEach(function(item) {
 | 
				
			||||||
        item = item.trim();
 | 
					        item = item.trim();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (item.length > 0) {
 | 
					        if (item.length > 0) {
 | 
				
			||||||
@@ -78,7 +78,7 @@ function loadTableFilters(tableKey) {
 | 
				
			|||||||
 * @param {*} filters - object of string:string pairs
 | 
					 * @param {*} filters - object of string:string pairs
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
function saveTableFilters(tableKey, filters) {
 | 
					function saveTableFilters(tableKey, filters) {
 | 
				
			||||||
    var lookup = "table-filters-" + tableKey.toLowerCase();
 | 
					    var lookup = 'table-filters-' + tableKey.toLowerCase();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var strings = [];
 | 
					    var strings = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -201,7 +201,7 @@ function generateAvailableFilterList(tableKey) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    var html = `<select class='form-control filter-input' id='${id}' name='tag'>`;
 | 
					    var html = `<select class='form-control filter-input' id='${id}' name='tag'>`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    html += "<option value=''>{% trans 'Select filter' %}</option>";
 | 
					    html += `<option value=''>{% trans 'Select filter' %}</option>`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (var opt in remaining) {
 | 
					    for (var opt in remaining) {
 | 
				
			||||||
        var title = getFilterTitle(tableKey, opt);
 | 
					        var title = getFilterTitle(tableKey, opt);
 | 
				
			||||||
@@ -306,15 +306,11 @@ function setupFilterList(tableKey, table, target) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            var html = '';
 | 
					            var html = '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            //`<div class='filter-input'>`;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            html += generateAvailableFilterList(tableKey);
 | 
					            html += generateAvailableFilterList(tableKey);
 | 
				
			||||||
            html += generateFilterInput(tableKey);
 | 
					            html += generateFilterInput(tableKey);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            html += `<button title='{% trans "Create filter" %}' class='btn btn-default filter-tag' id='${make}'><span class='fas fa-plus'></span></button>`;
 | 
					            html += `<button title='{% trans "Create filter" %}' class='btn btn-default filter-tag' id='${make}'><span class='fas fa-plus'></span></button>`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            //html += '</div>';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            element.append(html);
 | 
					            element.append(html);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Add a callback for when the filter tag selection is changed
 | 
					            // Add a callback for when the filter tag selection is changed
 | 
				
			||||||
@@ -357,7 +353,7 @@ function setupFilterList(tableKey, table, target) {
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Add callback for deleting each filter
 | 
					    // Add callback for deleting each filter
 | 
				
			||||||
    element.find(".close").click(function() {
 | 
					    element.find('.close').click(function() {
 | 
				
			||||||
        var me = $(this);
 | 
					        var me = $(this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        var filter = me.attr(`filter-tag-${tableKey}`);
 | 
					        var filter = me.attr(`filter-tag-${tableKey}`);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -674,7 +674,7 @@ function submitFormData(fields, options) {
 | 
				
			|||||||
            error: function(xhr) {
 | 
					            error: function(xhr) {
 | 
				
			||||||
                
 | 
					                
 | 
				
			||||||
                switch (xhr.status) {
 | 
					                switch (xhr.status) {
 | 
				
			||||||
                    case 400:   // Bad request
 | 
					                case 400:
 | 
				
			||||||
                    handleFormErrors(xhr.responseJSON, fields, options);
 | 
					                    handleFormErrors(xhr.responseJSON, fields, options);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
                default:
 | 
					                default:
 | 
				
			||||||
@@ -767,7 +767,7 @@ function getFormFieldValue(name, field, options) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    switch (field.type) {
 | 
					    switch (field.type) {
 | 
				
			||||||
    case 'boolean':
 | 
					    case 'boolean':
 | 
				
			||||||
            value = el.is(":checked");
 | 
					        value = el.is(':checked');
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case 'date':
 | 
					    case 'date':
 | 
				
			||||||
    case 'datetime':
 | 
					    case 'datetime':
 | 
				
			||||||
@@ -808,19 +808,19 @@ function handleFormSuccess(response, options) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // Display any messages
 | 
					    // Display any messages
 | 
				
			||||||
    if (response && response.success) {
 | 
					    if (response && response.success) {
 | 
				
			||||||
        showAlertOrCache("alert-success", response.success, cache);
 | 
					        showAlertOrCache('alert-success', response.success, cache);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    if (response && response.info) {
 | 
					    if (response && response.info) {
 | 
				
			||||||
        showAlertOrCache("alert-info", response.info, cache);
 | 
					        showAlertOrCache('alert-info', response.info, cache);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (response && response.warning) {
 | 
					    if (response && response.warning) {
 | 
				
			||||||
        showAlertOrCache("alert-warning", response.warning, cache);
 | 
					        showAlertOrCache('alert-warning', response.warning, cache);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (response && response.danger) {
 | 
					    if (response && response.danger) {
 | 
				
			||||||
        showAlertOrCache("alert-danger", response.danger, cache);
 | 
					        showAlertOrCache('alert-danger', response.danger, cache);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (options.onSuccess) {
 | 
					    if (options.onSuccess) {
 | 
				
			||||||
@@ -1041,9 +1041,9 @@ function initializeGroups(fields, options) {
 | 
				
			|||||||
        var group_options = options.groups[group];
 | 
					        var group_options = options.groups[group];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (group_options.collapsed) {
 | 
					        if (group_options.collapsed) {
 | 
				
			||||||
            $(modal).find(`#form-panel-content-${group}`).collapse("hide");
 | 
					            $(modal).find(`#form-panel-content-${group}`).collapse('hide');
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            $(modal).find(`#form-panel-content-${group}`).collapse("show");
 | 
					            $(modal).find(`#form-panel-content-${group}`).collapse('show');
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (group_options.hidden) {
 | 
					        if (group_options.hidden) {
 | 
				
			||||||
@@ -1130,7 +1130,7 @@ function addSecondaryModal(field, fields, options) {
 | 
				
			|||||||
        if (secondary.fields instanceof Function) {
 | 
					        if (secondary.fields instanceof Function) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Extract form values at time of button press
 | 
					            // Extract form values at time of button press
 | 
				
			||||||
            var data = extractFormData(fields, options)
 | 
					            var data = extractFormData(fields, options);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            secondary.fields = secondary.fields(data);
 | 
					            secondary.fields = secondary.fields(data);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,12 +23,12 @@ function yesNoLabel(value) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function editButton(url, text='{% trans "Edit" %}') {
 | 
					function editButton(url, text='{% trans "Edit" %}') {
 | 
				
			||||||
    return "<button class='btn btn-success edit-button btn-sm' type='button' url='" + url + "'>" + text + "</button>";
 | 
					    return `<button class='btn btn-success edit-button btn-sm' type='button' url='${url}'>${text}</button>`;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function deleteButton(url, text='{% trans "Delete" %}') {
 | 
					function deleteButton(url, text='{% trans "Delete" %}') {
 | 
				
			||||||
    return "<button class='btn btn-danger delete-button btn-sm' type='button' url='" + url + "'>" + text + "</button>";
 | 
					    return `<button class='btn btn-danger delete-button btn-sm' type='button' url='${url}'>${text}</button>`;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -87,7 +87,7 @@ function makeIconButton(icon, cls, pk, title, options={}) {
 | 
				
			|||||||
    var extraProps = '';
 | 
					    var extraProps = '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (options.disabled) {
 | 
					    if (options.disabled) {
 | 
				
			||||||
        extraProps += "disabled='true' ";
 | 
					        extraProps += `disabled='true' `;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    html += `<button pk='${pk}' id='${id}' class='${classes}' title='${title}' ${extraProps}>`;
 | 
					    html += `<button pk='${pk}' id='${id}' class='${classes}' title='${title}' ${extraProps}>`;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -120,7 +120,7 @@ function printStockLocationLabels(locations) {
 | 
				
			|||||||
                );
 | 
					                );
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    )
 | 
					    );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -103,7 +103,7 @@ function createNewModal(options={}) {
 | 
				
			|||||||
        if (event.keyCode == 13) {
 | 
					        if (event.keyCode == 13) {
 | 
				
			||||||
            event.preventDefault();
 | 
					            event.preventDefault();
 | 
				
			||||||
            // Simulate a click on the 'Submit' button
 | 
					            // Simulate a click on the 'Submit' button
 | 
				
			||||||
            $(modal_name).find("#modal-form-submit").click();
 | 
					            $(modal_name).find('#modal-form-submit').click();
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -271,7 +271,7 @@ function reloadFieldOptions(fieldName, options) {
 | 
				
			|||||||
            setFieldOptions(fieldName, opts);
 | 
					            setFieldOptions(fieldName, opts);
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        error: function() {
 | 
					        error: function() {
 | 
				
			||||||
            console.log("Error GETting field options");
 | 
					            console.log('Error GETting field options');
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -290,7 +290,7 @@ function enableField(fieldName, enabled, options={}) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    var field = getFieldByName(modal, fieldName);
 | 
					    var field = getFieldByName(modal, fieldName);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    field.prop("disabled", !enabled);
 | 
					    field.prop('disabled', !enabled);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function clearField(fieldName, options={}) {
 | 
					function clearField(fieldName, options={}) {
 | 
				
			||||||
@@ -361,7 +361,7 @@ function attachToggle(modal) {
 | 
				
			|||||||
     * and also larger toggle style buttons are easier to press!
 | 
					     * and also larger toggle style buttons are easier to press!
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $(modal).find("input[type='checkbox']").each(function() {
 | 
					    $(modal).find(`input[type='checkbox']`).each(function() {
 | 
				
			||||||
        $(this).bootstrapToggle({
 | 
					        $(this).bootstrapToggle({
 | 
				
			||||||
            size: 'small',
 | 
					            size: 'small',
 | 
				
			||||||
            onstyle: 'success',
 | 
					            onstyle: 'success',
 | 
				
			||||||
@@ -394,7 +394,7 @@ function loadingMessageContent() {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // TODO - This can be made a lot better
 | 
					    // TODO - This can be made a lot better
 | 
				
			||||||
    return "<span class='glyphicon glyphicon-refresh glyphicon-refresh-animate'></span> {% trans 'Waiting for server...' %}";
 | 
					    return `<span class='glyphicon glyphicon-refresh glyphicon-refresh-animate'></span> {% trans 'Waiting for server...' %}`;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -416,19 +416,19 @@ function afterForm(response, options) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // Display any messages
 | 
					    // Display any messages
 | 
				
			||||||
    if (response.success) {
 | 
					    if (response.success) {
 | 
				
			||||||
        showAlertOrCache("alert-success", response.success, cache);
 | 
					        showAlertOrCache('alert-success', response.success, cache);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (response.info) {
 | 
					    if (response.info) {
 | 
				
			||||||
        showAlertOrCache("alert-info", response.info, cache);
 | 
					        showAlertOrCache('alert-info', response.info, cache);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    if (response.warning) {
 | 
					    if (response.warning) {
 | 
				
			||||||
        showAlertOrCache("alert-warning", response.warning, cache);
 | 
					        showAlertOrCache('alert-warning', response.warning, cache);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    if (response.danger) {
 | 
					    if (response.danger) {
 | 
				
			||||||
        showAlertOrCache("alert-danger", response.danger, cache);
 | 
					        showAlertOrCache('alert-danger', response.danger, cache);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Was a callback provided?
 | 
					    // Was a callback provided?
 | 
				
			||||||
@@ -612,7 +612,7 @@ function showQuestionDialog(title, content, options={}) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    modalSetContent(modal, content);
 | 
					    modalSetContent(modal, content);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $(modal).on('click', "#modal-form-submit", function() {
 | 
					    $(modal).on('click', '#modal-form-submit', function() {
 | 
				
			||||||
        $(modal).modal('hide');
 | 
					        $(modal).modal('hide');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (options.accept) {
 | 
					        if (options.accept) {
 | 
				
			||||||
@@ -653,7 +653,7 @@ function openModal(options) {
 | 
				
			|||||||
            event.preventDefault();
 | 
					            event.preventDefault();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Simulate a click on the 'Submit' button
 | 
					            // Simulate a click on the 'Submit' button
 | 
				
			||||||
            $(modal).find("#modal-form-submit").click();
 | 
					            $(modal).find('#modal-form-submit').click();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -715,17 +715,17 @@ function insertNewItemButton(modal, options) {
 | 
				
			|||||||
     * Inserts a button at the end of this lael element.
 | 
					     * Inserts a button at the end of this lael element.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var html = "<span style='float: right;'>";
 | 
					    var html = `<span style='float: right;'>`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    html += "<div type='button' class='btn btn-primary btn-secondary'";
 | 
					    html += `<div type='button' class='btn btn-primary btn-secondary'`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (options.title) {
 | 
					    if (options.title) {
 | 
				
			||||||
        html += " title='" + options.title + "'";
 | 
					        html += ` title='${ options.title}'`;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    html += " id='btn-new-" + options.field + "'>" + options.label + "</div>";
 | 
					    html += ` id='btn-new-${options.field}'>${options.label}</div>`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    html += "</span>";
 | 
					    html += '</span>';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $(modal).find('label[for="id_'+ options.field + '"]').append(html);
 | 
					    $(modal).find('label[for="id_'+ options.field + '"]').append(html);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -750,7 +750,7 @@ function attachSecondaryModal(modal, options) {
 | 
				
			|||||||
    var data = options.data || {};
 | 
					    var data = options.data || {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Add a callback to the button
 | 
					    // Add a callback to the button
 | 
				
			||||||
    $(modal).find("#btn-new-" + options.field).on('click', function() {
 | 
					    $(modal).find('#btn-new-' + options.field).on('click', function() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Launch the secondary modal
 | 
					        // Launch the secondary modal
 | 
				
			||||||
        launchModalForm(
 | 
					        launchModalForm(
 | 
				
			||||||
@@ -791,12 +791,14 @@ function attachSecondaries(modal, secondaries) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function insertActionButton(modal, options) {
 | 
					function insertActionButton(modal, options) {
 | 
				
			||||||
    /* Insert a custom submition button */
 | 
					    /* Insert a custom submission button */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var html = "<span style='float: right;'>";
 | 
					    var html = `
 | 
				
			||||||
    html += "<button name='" + options.name + "' type='submit' class='btn btn-default modal-form-button'";
 | 
					    <span style='float: right;'>
 | 
				
			||||||
    html += " value='" + options.name + "'>" + options.title + "</button>";
 | 
					        <button name='${options.name}' type='submit' class='btn btn-default modal-form-button' value='${options.name}'>
 | 
				
			||||||
    html += "</span>";
 | 
					            ${options.title}
 | 
				
			||||||
 | 
					        </button>
 | 
				
			||||||
 | 
					    </span>`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $(modal).find('#modal-footer-buttons').append(html);
 | 
					    $(modal).find('#modal-footer-buttons').append(html);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -1068,8 +1070,8 @@ function launchModalForm(url, options = {}) {
 | 
				
			|||||||
                showAlertDialog('{% trans "Error requesting form data" %}', renderErrorMessage(xhr));
 | 
					                showAlertDialog('{% trans "Error requesting form data" %}', renderErrorMessage(xhr));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            console.log("Modal form error: " + xhr.status);
 | 
					            console.log('Modal form error: ' + xhr.status);
 | 
				
			||||||
            console.log("Message: " + xhr.responseText);
 | 
					            console.log('Message: ' + xhr.responseText);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -170,7 +170,7 @@ function newSupplierPartFromOrderWizard(e) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                        if (response.supplier_detail) {
 | 
					                        if (response.supplier_detail) {
 | 
				
			||||||
                            text += response.supplier_detail.name;
 | 
					                            text += response.supplier_detail.name;
 | 
				
			||||||
                            text += " | ";
 | 
					                            text += ' | ';
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        text += response.SKU;
 | 
					                        text += response.SKU;
 | 
				
			||||||
@@ -180,8 +180,7 @@ function newSupplierPartFromOrderWizard(e) {
 | 
				
			|||||||
                        $('#modal-form').find(dropdown).append(option).trigger('change');
 | 
					                        $('#modal-form').find(dropdown).append(option).trigger('change');
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            )
 | 
					            );
 | 
				
			||||||
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -230,7 +229,7 @@ function newPurchaseOrderFromOrderWizard(e) {
 | 
				
			|||||||
                        $('#modal-form').find(dropdown).append(option).trigger('change');
 | 
					                        $('#modal-form').find(dropdown).append(option).trigger('change');
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            )
 | 
					            );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }); 
 | 
					    }); 
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -275,7 +274,7 @@ function loadPurchaseOrderTable(table, options) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    options.params['supplier_detail'] = true;
 | 
					    options.params['supplier_detail'] = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var filters = loadTableFilters("purchaseorder");
 | 
					    var filters = loadTableFilters('purchaseorder');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (var key in options.params) {
 | 
					    for (var key in options.params) {
 | 
				
			||||||
        filters[key] = options.params[key];
 | 
					        filters[key] = options.params[key];
 | 
				
			||||||
@@ -283,7 +282,7 @@ function loadPurchaseOrderTable(table, options) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    options.url = options.url || '{% url "api-po-list" %}';
 | 
					    options.url = options.url || '{% url "api-po-list" %}';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    setupFilterList("purchaseorder", $(table));
 | 
					    setupFilterList('purchaseorder', $(table));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $(table).inventreeTable({
 | 
					    $(table).inventreeTable({
 | 
				
			||||||
        url: options.url,
 | 
					        url: options.url,
 | 
				
			||||||
@@ -373,7 +372,7 @@ function loadSalesOrderTable(table, options) {
 | 
				
			|||||||
    options.params = options.params || {};
 | 
					    options.params = options.params || {};
 | 
				
			||||||
    options.params['customer_detail'] = true;
 | 
					    options.params['customer_detail'] = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var filters = loadTableFilters("salesorder");
 | 
					    var filters = loadTableFilters('salesorder');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (var key in options.params) {
 | 
					    for (var key in options.params) {
 | 
				
			||||||
        filters[key] = options.params[key];
 | 
					        filters[key] = options.params[key];
 | 
				
			||||||
@@ -381,7 +380,7 @@ function loadSalesOrderTable(table, options) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    options.url = options.url || '{% url "api-so-list" %}';
 | 
					    options.url = options.url || '{% url "api-so-list" %}';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    setupFilterList("salesorder", $(table));
 | 
					    setupFilterList('salesorder', $(table));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $(table).inventreeTable({
 | 
					    $(table).inventreeTable({
 | 
				
			||||||
        url: options.url,
 | 
					        url: options.url,
 | 
				
			||||||
@@ -490,13 +489,13 @@ function loadSalesOrderAllocationTable(table, options={}) {
 | 
				
			|||||||
    options.params['item_detail'] = true;
 | 
					    options.params['item_detail'] = true;
 | 
				
			||||||
    options.params['order_detail'] = true;
 | 
					    options.params['order_detail'] = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var filters = loadTableFilters("salesorderallocation");
 | 
					    var filters = loadTableFilters('salesorderallocation');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (var key in options.params) {
 | 
					    for (var key in options.params) {
 | 
				
			||||||
        filters[key] = options.params[key];
 | 
					        filters[key] = options.params[key];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    setupFilterList("salesorderallocation", $(table));
 | 
					    setupFilterList('salesorderallocation', $(table));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $(table).inventreeTable({
 | 
					    $(table).inventreeTable({
 | 
				
			||||||
        url: '{% url "api-so-allocation-list" %}',
 | 
					        url: '{% url "api-so-allocation-list" %}',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -62,9 +62,9 @@ function partGroups() {
 | 
				
			|||||||
            collapsible: true,
 | 
					            collapsible: true,
 | 
				
			||||||
            hidden: !global_settings.PART_PURCHASEABLE,
 | 
					            hidden: !global_settings.PART_PURCHASEABLE,
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Construct fieldset for part forms
 | 
					// Construct fieldset for part forms
 | 
				
			||||||
function partFields(options={}) {
 | 
					function partFields(options={}) {
 | 
				
			||||||
@@ -143,14 +143,14 @@ function partFields(options={}) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // Pop expiry field
 | 
					    // Pop expiry field
 | 
				
			||||||
    if (!global_settings.STOCK_ENABLE_EXPIRY) {
 | 
					    if (!global_settings.STOCK_ENABLE_EXPIRY) {
 | 
				
			||||||
        delete fields["default_expiry"];
 | 
					        delete fields['default_expiry'];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Additional fields when "creating" a new part
 | 
					    // Additional fields when "creating" a new part
 | 
				
			||||||
    if (options.create) {
 | 
					    if (options.create) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // No supplier parts available yet
 | 
					        // No supplier parts available yet
 | 
				
			||||||
        delete fields["default_supplier"];
 | 
					        delete fields['default_supplier'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (global_settings.PART_CREATE_INITIAL) {
 | 
					        if (global_settings.PART_CREATE_INITIAL) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -446,13 +446,13 @@ function loadPartVariantTable(table, partId, options={}) {
 | 
				
			|||||||
    params.ancestor = partId;
 | 
					    params.ancestor = partId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Load filters
 | 
					    // Load filters
 | 
				
			||||||
    var filters = loadTableFilters("variants");
 | 
					    var filters = loadTableFilters('variants');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (var key in params) {
 | 
					    for (var key in params) {
 | 
				
			||||||
        filters[key] = params[key];
 | 
					        filters[key] = params[key];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    setupFilterList("variants", $(table));
 | 
					    setupFilterList('variants', $(table));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var cols = [
 | 
					    var cols = [
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
@@ -534,7 +534,7 @@ function loadPartVariantTable(table, partId, options={}) {
 | 
				
			|||||||
    ];
 | 
					    ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    table.inventreeTable({
 | 
					    table.inventreeTable({
 | 
				
			||||||
        url: "{% url 'api-part-list' %}",
 | 
					        url: '{% url "api-part-list" %}',
 | 
				
			||||||
        name: 'partvariants',
 | 
					        name: 'partvariants',
 | 
				
			||||||
        showColumns: true,
 | 
					        showColumns: true,
 | 
				
			||||||
        original: params,
 | 
					        original: params,
 | 
				
			||||||
@@ -575,7 +575,7 @@ function loadPartParameterTable(table, url, options) {
 | 
				
			|||||||
    var params = options.params || {};
 | 
					    var params = options.params || {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Load filters
 | 
					    // Load filters
 | 
				
			||||||
    var filters = loadTableFilters("part-parameters");
 | 
					    var filters = loadTableFilters('part-parameters');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (var key in params) {
 | 
					    for (var key in params) {
 | 
				
			||||||
        filters[key] = params[key];
 | 
					        filters[key] = params[key];
 | 
				
			||||||
@@ -682,8 +682,8 @@ function loadParametricPartTable(table, options={}) {
 | 
				
			|||||||
     *  - table_data: Parameters data
 | 
					     *  - table_data: Parameters data
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var table_headers = options.headers
 | 
					    var table_headers = options.headers;
 | 
				
			||||||
    var table_data = options.data
 | 
					    var table_data = options.data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var columns = [];
 | 
					    var columns = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -719,8 +719,6 @@ function loadParametricPartTable(table, options={}) {
 | 
				
			|||||||
                title: header,
 | 
					                title: header,
 | 
				
			||||||
                sortable: true,
 | 
					                sortable: true,
 | 
				
			||||||
                filterControl: 'input',
 | 
					                filterControl: 'input',
 | 
				
			||||||
                /* TODO: Search icons are not displayed */
 | 
					 | 
				
			||||||
                /*clear: 'fa-times icon-red',*/
 | 
					 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -822,14 +820,14 @@ function loadPartTable(table, url, options={}) {
 | 
				
			|||||||
    var col = null;
 | 
					    var col = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!options.disableFilters) {
 | 
					    if (!options.disableFilters) {
 | 
				
			||||||
        filters = loadTableFilters("parts");
 | 
					        filters = loadTableFilters('parts');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (var key in params) {
 | 
					    for (var key in params) {
 | 
				
			||||||
        filters[key] = params[key];
 | 
					        filters[key] = params[key];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    setupFilterList("parts", $(table), options.filterTarget || null);
 | 
					    setupFilterList('parts', $(table), options.filterTarget || null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var columns = [
 | 
					    var columns = [
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
@@ -891,7 +889,7 @@ function loadPartTable(table, url, options={}) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            return display; 
 | 
					            return display; 
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!options.params.ordering) {
 | 
					    if (!options.params.ordering) {
 | 
				
			||||||
        col['sortable'] = true;
 | 
					        col['sortable'] = true;
 | 
				
			||||||
@@ -905,7 +903,7 @@ function loadPartTable(table, url, options={}) {
 | 
				
			|||||||
        formatter: function(value, row) {
 | 
					        formatter: function(value, row) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (row.is_template) {
 | 
					            if (row.is_template) {
 | 
				
			||||||
                value = '<i>' + value + '</i>';
 | 
					                value = `<i>${value}</i>`;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return value;
 | 
					            return value;
 | 
				
			||||||
@@ -918,7 +916,7 @@ function loadPartTable(table, url, options={}) {
 | 
				
			|||||||
        title: '{% trans "Category" %}',
 | 
					        title: '{% trans "Category" %}',
 | 
				
			||||||
        formatter: function(value, row) {
 | 
					        formatter: function(value, row) {
 | 
				
			||||||
            if (row.category) {
 | 
					            if (row.category) {
 | 
				
			||||||
                return renderLink(value.pathstring, "/part/category/" + row.category + "/");
 | 
					                return renderLink(value.pathstring, `/part/category/${row.category}/`);
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                return '{% trans "No category" %}';
 | 
					                return '{% trans "No category" %}';
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -936,30 +934,30 @@ function loadPartTable(table, url, options={}) {
 | 
				
			|||||||
        title: '{% trans "Stock" %}',
 | 
					        title: '{% trans "Stock" %}',
 | 
				
			||||||
        searchable: false,
 | 
					        searchable: false,
 | 
				
			||||||
        formatter: function(value, row) {            
 | 
					        formatter: function(value, row) {            
 | 
				
			||||||
            var link = "stock";
 | 
					            var link = 'stock';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (value) {
 | 
					            if (value) {
 | 
				
			||||||
                // There IS stock available for this part
 | 
					                // There IS stock available for this part
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                // Is stock "low" (below the 'minimum_stock' quantity)?
 | 
					                // Is stock "low" (below the 'minimum_stock' quantity)?
 | 
				
			||||||
                if (row.minimum_stock && row.minimum_stock > value) {
 | 
					                if (row.minimum_stock && row.minimum_stock > value) {
 | 
				
			||||||
                    value += "<span class='label label-right label-warning'>{% trans "Low stock" %}</span>";
 | 
					                    value += `<span class='label label-right label-warning'>{% trans "Low stock" %}</span>`;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            } else if (row.on_order) {
 | 
					            } else if (row.on_order) {
 | 
				
			||||||
                // There is no stock available, but stock is on order
 | 
					                // There is no stock available, but stock is on order
 | 
				
			||||||
                value = "0<span class='label label-right label-primary'>{% trans "On Order" %}: " + row.on_order + "</span>";
 | 
					                value = `0<span class='label label-right label-primary'>{% trans "On Order" %}: ${row.on_order}</span>`;
 | 
				
			||||||
                link = "orders";
 | 
					                link = 'orders';
 | 
				
			||||||
            } else if (row.building) {
 | 
					            } else if (row.building) {
 | 
				
			||||||
                // There is no stock available, but stock is being built
 | 
					                // There is no stock available, but stock is being built
 | 
				
			||||||
                value = "0<span class='label label-right label-info'>{% trans "Building" %}: " + row.building + "</span>";
 | 
					                value = `0<span class='label label-right label-info'>{% trans "Building" %}: ${row.building}</span>`;
 | 
				
			||||||
                link = "builds";
 | 
					                link = 'builds';
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                // There is no stock available
 | 
					                // There is no stock available
 | 
				
			||||||
                value = "0<span class='label label-right label-danger'>{% trans "No Stock" %}</span>";
 | 
					                value = `0<span class='label label-right label-danger'>{% trans "No Stock" %}</span>`;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return renderLink(value, '/part/' + row.pk + "/" + link + "/");
 | 
					            return renderLink(value, `/part/${row.pk}/${link}/`);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1027,8 +1025,8 @@ function loadPartTable(table, url, options={}) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /* Button callbacks for part table buttons */
 | 
					    /* Button callbacks for part table buttons */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $("#multi-part-order").click(function() {
 | 
					    $('#multi-part-order').click(function() {
 | 
				
			||||||
        var selections = $(table).bootstrapTable("getSelections");
 | 
					        var selections = $(table).bootstrapTable('getSelections');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        var parts = [];
 | 
					        var parts = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1036,15 +1034,15 @@ function loadPartTable(table, url, options={}) {
 | 
				
			|||||||
            parts.push(item.pk);
 | 
					            parts.push(item.pk);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        launchModalForm("/order/purchase-order/order-parts/", {
 | 
					        launchModalForm('/order/purchase-order/order-parts/', {
 | 
				
			||||||
            data: {
 | 
					            data: {
 | 
				
			||||||
                parts: parts,
 | 
					                parts: parts,
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $("#multi-part-category").click(function() {
 | 
					    $('#multi-part-category').click(function() {
 | 
				
			||||||
        var selections = $(table).bootstrapTable("getSelections");
 | 
					        var selections = $(table).bootstrapTable('getSelections');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        var parts = [];
 | 
					        var parts = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1052,7 +1050,7 @@ function loadPartTable(table, url, options={}) {
 | 
				
			|||||||
            parts.push(item.pk);
 | 
					            parts.push(item.pk);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        launchModalForm("/part/set-category/", {
 | 
					        launchModalForm('/part/set-category/', {
 | 
				
			||||||
            data: {
 | 
					            data: {
 | 
				
			||||||
                parts: parts,
 | 
					                parts: parts,
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
@@ -1073,7 +1071,7 @@ function loadPartTable(table, url, options={}) {
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $('#multi-part-export').click(function() {
 | 
					    $('#multi-part-export').click(function() {
 | 
				
			||||||
        var selections = $(table).bootstrapTable("getSelections");
 | 
					        var selections = $(table).bootstrapTable('getSelections');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        var parts = '';
 | 
					        var parts = '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1172,7 +1170,7 @@ function loadPartTestTemplateTable(table, options) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    var filterListElement = options.filterList || '#filter-list-parttests';
 | 
					    var filterListElement = options.filterList || '#filter-list-parttests';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var filters = loadTableFilters("parttests");
 | 
					    var filters = loadTableFilters('parttests');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var original = {};
 | 
					    var original = {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1180,7 +1178,7 @@ function loadPartTestTemplateTable(table, options) {
 | 
				
			|||||||
        original[k] = params[k];
 | 
					        original[k] = params[k];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    setupFilterList("parttests", table, filterListElement);
 | 
					    setupFilterList('parttests', table, filterListElement);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Override the default values, or add new ones
 | 
					    // Override the default values, or add new ones
 | 
				
			||||||
    for (var key in params) {
 | 
					    for (var key in params) {
 | 
				
			||||||
@@ -1192,7 +1190,7 @@ function loadPartTestTemplateTable(table, options) {
 | 
				
			|||||||
        formatNoMatches: function() {
 | 
					        formatNoMatches: function() {
 | 
				
			||||||
            return '{% trans "No test templates matching query" %}';
 | 
					            return '{% trans "No test templates matching query" %}';
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        url: "{% url 'api-part-test-template-list' %}",
 | 
					        url: '{% url "api-part-test-template-list" %}',
 | 
				
			||||||
        queryParams: filters,
 | 
					        queryParams: filters,
 | 
				
			||||||
        name: 'testtemplate',
 | 
					        name: 'testtemplate',
 | 
				
			||||||
        original: original,
 | 
					        original: original,
 | 
				
			||||||
@@ -1213,7 +1211,7 @@ function loadPartTestTemplateTable(table, options) {
 | 
				
			|||||||
            },
 | 
					            },
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                field: 'required',
 | 
					                field: 'required',
 | 
				
			||||||
                title: "{% trans 'Required' %}",
 | 
					                title: '{% trans "Required" %}',
 | 
				
			||||||
                sortable: true,
 | 
					                sortable: true,
 | 
				
			||||||
                formatter: function(value) {
 | 
					                formatter: function(value) {
 | 
				
			||||||
                    return yesNoLabel(value);
 | 
					                    return yesNoLabel(value);
 | 
				
			||||||
@@ -1280,11 +1278,11 @@ function loadPriceBreakTable(table, options) {
 | 
				
			|||||||
        onLoadSuccess: function(tableData) {
 | 
					        onLoadSuccess: function(tableData) {
 | 
				
			||||||
            if (linkedGraph) {
 | 
					            if (linkedGraph) {
 | 
				
			||||||
                // sort array
 | 
					                // sort array
 | 
				
			||||||
                tableData = tableData.sort((a,b)=>a.quantity-b.quantity);
 | 
					                tableData = tableData.sort((a, b) => (a.quantity - b.quantity));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                // split up for graph definition
 | 
					                // split up for graph definition
 | 
				
			||||||
                var graphLabels = Array.from(tableData, x => x.quantity);
 | 
					                var graphLabels = Array.from(tableData, (x) => (x.quantity));
 | 
				
			||||||
                var graphData = Array.from(tableData, x => x.price);
 | 
					                var graphData = Array.from(tableData, (x) => (x.price));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                // destroy chart if exists
 | 
					                // destroy chart if exists
 | 
				
			||||||
                if (chart) {
 | 
					                if (chart) {
 | 
				
			||||||
@@ -1301,7 +1299,8 @@ function loadPriceBreakTable(table, options) {
 | 
				
			|||||||
                                borderColor: 'rgb(255, 206, 86)',
 | 
					                                borderColor: 'rgb(255, 206, 86)',
 | 
				
			||||||
                                stepped: true,
 | 
					                                stepped: true,
 | 
				
			||||||
                                fill: true,
 | 
					                                fill: true,
 | 
				
			||||||
                        },]
 | 
					                            },
 | 
				
			||||||
 | 
					                        ],
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -1325,7 +1324,7 @@ function loadPriceBreakTable(table, options) {
 | 
				
			|||||||
                formatter: function(value, row) {
 | 
					                formatter: function(value, row) {
 | 
				
			||||||
                    var html = value;
 | 
					                    var html = value;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
                    html += `<div class='btn-group float-right' role='group'>`
 | 
					                    html += `<div class='btn-group float-right' role='group'>`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    html += makeIconButton('fa-edit icon-blue', `button-${name}-edit`, row.pk, `{% trans "Edit ${human_name}" %}`);
 | 
					                    html += makeIconButton('fa-edit icon-blue', `button-${name}-edit`, row.pk, `{% trans "Edit ${human_name}" %}`);
 | 
				
			||||||
                    html += makeIconButton('fa-trash-alt icon-red', `button-${name}-delete`, row.pk, `{% trans "Delete ${human_name}" %}`);
 | 
					                    html += makeIconButton('fa-trash-alt icon-red', `button-${name}-delete`, row.pk, `{% trans "Delete ${human_name}" %}`);
 | 
				
			||||||
@@ -1376,7 +1375,7 @@ function initPriceBreakSet(table, options) {
 | 
				
			|||||||
    );
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function reloadPriceBreakTable() {
 | 
					    function reloadPriceBreakTable() {
 | 
				
			||||||
        table.bootstrapTable("refresh");
 | 
					        table.bootstrapTable('refresh');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pb_new_btn.click(function() {
 | 
					    pb_new_btn.click(function() {
 | 
				
			||||||
@@ -1464,12 +1463,26 @@ function loadBomChart(context, data) {
 | 
				
			|||||||
        options: {
 | 
					        options: {
 | 
				
			||||||
            responsive: true,
 | 
					            responsive: true,
 | 
				
			||||||
            maintainAspectRatio: false,
 | 
					            maintainAspectRatio: false,
 | 
				
			||||||
            plugins: {legend: {position: 'bottom'},
 | 
					            plugins: {
 | 
				
			||||||
            scales: {xAxes: [{beginAtZero: true, ticks: {autoSkip: false}}]}}
 | 
					                legend: {
 | 
				
			||||||
 | 
					                    position: 'bottom',
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					                scales: {
 | 
				
			||||||
 | 
					                    xAxes: [
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            beginAtZero: true,
 | 
				
			||||||
 | 
					                            ticks: {
 | 
				
			||||||
 | 
					                                autoSkip: false,
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    ]
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function loadSellPricingChart(context, data) {
 | 
					function loadSellPricingChart(context, data) {
 | 
				
			||||||
    return new Chart(context, {
 | 
					    return new Chart(context, {
 | 
				
			||||||
        type: 'line',
 | 
					        type: 'line',
 | 
				
			||||||
@@ -1477,21 +1490,29 @@ function loadSellPricingChart(context, data) {
 | 
				
			|||||||
        options: {
 | 
					        options: {
 | 
				
			||||||
            responsive: true,
 | 
					            responsive: true,
 | 
				
			||||||
            maintainAspectRatio: false,
 | 
					            maintainAspectRatio: false,
 | 
				
			||||||
            plugins: {legend: {position: 'bottom'}},
 | 
					            plugins: {
 | 
				
			||||||
 | 
					                legend: {
 | 
				
			||||||
 | 
					                    position: 'bottom'
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
            scales: {
 | 
					            scales: {
 | 
				
			||||||
                y: {
 | 
					                y: {
 | 
				
			||||||
                    type: 'linear',
 | 
					                    type: 'linear',
 | 
				
			||||||
                    position: 'left',
 | 
					                    position: 'left',
 | 
				
			||||||
                    grid: {display: false},
 | 
					                    grid: {
 | 
				
			||||||
 | 
					                        display: false
 | 
				
			||||||
 | 
					                    },
 | 
				
			||||||
                    title: {
 | 
					                    title: {
 | 
				
			||||||
                        display: true,
 | 
					                        display: true,
 | 
				
			||||||
                        text: '{% trans "Unit Price" %}'
 | 
					                        text: '{% trans "Unit Price" %}',
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
                y1: {
 | 
					                y1: {
 | 
				
			||||||
                    type: 'linear',
 | 
					                    type: 'linear',
 | 
				
			||||||
                    position: 'right',
 | 
					                    position: 'right',
 | 
				
			||||||
                    grid: {display: false},
 | 
					                    grid: {
 | 
				
			||||||
 | 
					                        display: false
 | 
				
			||||||
 | 
					                    },
 | 
				
			||||||
                    titel: {
 | 
					                    titel: {
 | 
				
			||||||
                        display: true,
 | 
					                        display: true,
 | 
				
			||||||
                        text: '{% trans "Quantity" %}',
 | 
					                        text: '{% trans "Quantity" %}',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -208,10 +208,10 @@ function printBuildReports(builds) {
 | 
				
			|||||||
                            window.location.href = href;
 | 
					                            window.location.href = href;
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                )
 | 
					                );
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    )
 | 
					    );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -265,7 +265,7 @@ function printBomReports(parts) {
 | 
				
			|||||||
                );
 | 
					                );
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    )
 | 
					    );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -316,10 +316,10 @@ function printPurchaseOrderReports(orders) {
 | 
				
			|||||||
                            window.location.href = href;
 | 
					                            window.location.href = href;
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                )
 | 
					                );
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    )
 | 
					    );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -370,8 +370,8 @@ function printSalesOrderReports(orders) {
 | 
				
			|||||||
                            window.location.href = href;
 | 
					                            window.location.href = href;
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                )
 | 
					                );
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    )
 | 
					    );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -80,7 +80,7 @@ function stockStatusCodes() {
 | 
				
			|||||||
        {% for code in StockStatus.list %}
 | 
					        {% for code in StockStatus.list %}
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            key: {{ code.key }},
 | 
					            key: {{ code.key }},
 | 
				
			||||||
            text: "{{ code.value }}",
 | 
					            text: '{{ code.value }}',
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        {% endfor %}
 | 
					        {% endfor %}
 | 
				
			||||||
    ];
 | 
					    ];
 | 
				
			||||||
@@ -102,11 +102,23 @@ function exportStock(params={}) {
 | 
				
			|||||||
                type: 'choice',
 | 
					                type: 'choice',
 | 
				
			||||||
                value: 'csv',
 | 
					                value: 'csv',
 | 
				
			||||||
                choices: [
 | 
					                choices: [
 | 
				
			||||||
                    { value: 'csv', display_name: 'CSV' },
 | 
					                    {
 | 
				
			||||||
                    { value: 'tsv', display_name: 'TSV' },
 | 
					                        value: 'csv',
 | 
				
			||||||
                    { value: 'xls', display_name: 'XLS' },
 | 
					                        display_name: 'CSV',
 | 
				
			||||||
                    { value: 'xlsx', display_name: 'XLSX' },
 | 
					                    },
 | 
				
			||||||
                ]
 | 
					                    {
 | 
				
			||||||
 | 
					                        value: 'tsv',
 | 
				
			||||||
 | 
					                        display_name: 'TSV',
 | 
				
			||||||
 | 
					                    },
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        value: 'xls',
 | 
				
			||||||
 | 
					                        display_name: 'XLS',
 | 
				
			||||||
 | 
					                    },
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        value: 'xlsx',
 | 
				
			||||||
 | 
					                        display_name: 'XLSX',
 | 
				
			||||||
 | 
					                    },
 | 
				
			||||||
 | 
					                ],
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            sublocations: {
 | 
					            sublocations: {
 | 
				
			||||||
                label: '{% trans "Include Sublocations" %}',
 | 
					                label: '{% trans "Include Sublocations" %}',
 | 
				
			||||||
@@ -265,7 +277,7 @@ function adjustStock(action, items, options={}) {
 | 
				
			|||||||
                    read_only: readonly,
 | 
					                    read_only: readonly,
 | 
				
			||||||
                    title: readonly ? '{% trans "Quantity cannot be adjusted for serialized stock" %}' : '{% trans "Specify stock quantity" %}',
 | 
					                    title: readonly ? '{% trans "Quantity cannot be adjusted for serialized stock" %}' : '{% trans "Specify stock quantity" %}',
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            )
 | 
					            );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        var buttons = `<div class='btn-group float-right' role='group'>`;
 | 
					        var buttons = `<div class='btn-group float-right' role='group'>`;
 | 
				
			||||||
@@ -352,7 +364,7 @@ function adjustStock(action, items, options={}) {
 | 
				
			|||||||
                        inventreeDelete(
 | 
					                        inventreeDelete(
 | 
				
			||||||
                            `/api/stock/${item.pk}/`,
 | 
					                            `/api/stock/${item.pk}/`,
 | 
				
			||||||
                        )
 | 
					                        )
 | 
				
			||||||
                    )
 | 
					                    );
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                // Wait for *all* the requests to complete
 | 
					                // Wait for *all* the requests to complete
 | 
				
			||||||
@@ -419,7 +431,7 @@ function adjustStock(action, items, options={}) {
 | 
				
			|||||||
                                {
 | 
					                                {
 | 
				
			||||||
                                    modal: modal,
 | 
					                                    modal: modal,
 | 
				
			||||||
                                }
 | 
					                                }
 | 
				
			||||||
                                )
 | 
					                            );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                            break;
 | 
					                            break;
 | 
				
			||||||
                        default:
 | 
					                        default:
 | 
				
			||||||
@@ -503,15 +515,15 @@ function loadStockTestResultsTable(table, options) {
 | 
				
			|||||||
            html += makeIconButton('fa-trash-alt icon-red', 'button-test-delete', pk, '{% trans "Delete test result" %}');
 | 
					            html += makeIconButton('fa-trash-alt icon-red', 'button-test-delete', pk, '{% trans "Delete test result" %}');
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        html += "</div>";
 | 
					        html += '</div>';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return html;
 | 
					        return html;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var parent_node = "parent node";
 | 
					    var parent_node = 'parent node';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    table.inventreeTable({
 | 
					    table.inventreeTable({
 | 
				
			||||||
        url: "{% url 'api-part-test-template-list' %}",
 | 
					        url: '{% url "api-part-test-template-list" %}',
 | 
				
			||||||
        method: 'get',
 | 
					        method: 'get',
 | 
				
			||||||
        name: 'testresult',
 | 
					        name: 'testresult',
 | 
				
			||||||
        treeEnable: true,
 | 
					        treeEnable: true,
 | 
				
			||||||
@@ -530,7 +542,7 @@ function loadStockTestResultsTable(table, options) {
 | 
				
			|||||||
            table.treegrid({
 | 
					            table.treegrid({
 | 
				
			||||||
                treeColumn: 0,
 | 
					                treeColumn: 0,
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
            table.treegrid("collapseAll");
 | 
					            table.treegrid('collapseAll');
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        columns: [
 | 
					        columns: [
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
@@ -596,7 +608,7 @@ function loadStockTestResultsTable(table, options) {
 | 
				
			|||||||
                    stock_item: options.stock_item,
 | 
					                    stock_item: options.stock_item,
 | 
				
			||||||
                    user_detail: true,
 | 
					                    user_detail: true,
 | 
				
			||||||
                    attachment_detail: true,
 | 
					                    attachment_detail: true,
 | 
				
			||||||
                    ordering: "-date",
 | 
					                    ordering: '-date',
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    success: function(data) {
 | 
					                    success: function(data) {
 | 
				
			||||||
@@ -646,13 +658,12 @@ function loadStockTestResultsTable(table, options) {
 | 
				
			|||||||
                        });
 | 
					                        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        // Push data back into the table
 | 
					                        // Push data back into the table
 | 
				
			||||||
                        table.bootstrapTable("load", tableData);
 | 
					                        table.bootstrapTable('load', tableData);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            )
 | 
					            );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -728,11 +739,11 @@ function loadStockTable(table, options) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    var params = options.params || {};
 | 
					    var params = options.params || {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var filterListElement = options.filterList || "#filter-list-stock";
 | 
					    var filterListElement = options.filterList || '#filter-list-stock';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var filters = {};
 | 
					    var filters = {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var filterKey = options.filterKey || options.name || "stock";
 | 
					    var filterKey = options.filterKey || options.name || 'stock';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!options.disableFilters) {
 | 
					    if (!options.disableFilters) {
 | 
				
			||||||
        filters = loadTableFilters(filterKey);
 | 
					        filters = loadTableFilters(filterKey);
 | 
				
			||||||
@@ -1055,7 +1066,7 @@ function loadStockTable(table, options) {
 | 
				
			|||||||
        formatNoMatches: function() {
 | 
					        formatNoMatches: function() {
 | 
				
			||||||
            return '{% trans "No stock items matching query" %}';
 | 
					            return '{% trans "No stock items matching query" %}';
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        url: options.url || "{% url 'api-stock-list' %}",
 | 
					        url: options.url || '{% url "api-stock-list" %}',
 | 
				
			||||||
        queryParams: filters,
 | 
					        queryParams: filters,
 | 
				
			||||||
        sidePagination: 'server',
 | 
					        sidePagination: 'server',
 | 
				
			||||||
        name: 'stock',
 | 
					        name: 'stock',
 | 
				
			||||||
@@ -1122,7 +1133,7 @@ function loadStockTable(table, options) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                stock = +stock.toFixed(5);
 | 
					                stock = +stock.toFixed(5);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                return stock + " (" + items + " items)";
 | 
					                return `${stock} (${items} {% trans "items" %})`;
 | 
				
			||||||
            } else if (field == 'status') {
 | 
					            } else if (field == 'status') {
 | 
				
			||||||
                var statii = [];
 | 
					                var statii = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1244,7 +1255,7 @@ function loadStockTable(table, options) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function stockAdjustment(action) {
 | 
					    function stockAdjustment(action) {
 | 
				
			||||||
        var items = $(table).bootstrapTable("getSelections");
 | 
					        var items = $(table).bootstrapTable('getSelections');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        adjustStock(action, items, {
 | 
					        adjustStock(action, items, {
 | 
				
			||||||
            onSuccess: function() {
 | 
					            onSuccess: function() {
 | 
				
			||||||
@@ -1277,7 +1288,7 @@ function loadStockTable(table, options) {
 | 
				
			|||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        printTestReports(items);
 | 
					        printTestReports(items);
 | 
				
			||||||
    })
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (global_settings.BARCODE_ENABLE) {
 | 
					    if (global_settings.BARCODE_ENABLE) {
 | 
				
			||||||
        $('#multi-item-barcode-scan-into-location').click(function() {        
 | 
					        $('#multi-item-barcode-scan-into-location').click(function() {        
 | 
				
			||||||
@@ -1287,7 +1298,7 @@ function loadStockTable(table, options) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            selections.forEach(function(item) {
 | 
					            selections.forEach(function(item) {
 | 
				
			||||||
                items.push(item.pk);
 | 
					                items.push(item.pk);
 | 
				
			||||||
            })
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            scanItemsIntoLocation(items);
 | 
					            scanItemsIntoLocation(items);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
@@ -1305,12 +1316,12 @@ function loadStockTable(table, options) {
 | 
				
			|||||||
        stockAdjustment('add');
 | 
					        stockAdjustment('add');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $("#multi-item-move").click(function() {
 | 
					    $('#multi-item-move').click(function() {
 | 
				
			||||||
        stockAdjustment('move');
 | 
					        stockAdjustment('move');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $("#multi-item-order").click(function() {
 | 
					    $('#multi-item-order').click(function() {
 | 
				
			||||||
        var selections = $(table).bootstrapTable("getSelections");
 | 
					        var selections = $(table).bootstrapTable('getSelections');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        var stock = [];
 | 
					        var stock = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1318,14 +1329,14 @@ function loadStockTable(table, options) {
 | 
				
			|||||||
            stock.push(item.pk);
 | 
					            stock.push(item.pk);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        launchModalForm("/order/purchase-order/order-parts/", {
 | 
					        launchModalForm('/order/purchase-order/order-parts/', {
 | 
				
			||||||
            data: {
 | 
					            data: {
 | 
				
			||||||
                stock: stock,
 | 
					                stock: stock,
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $("#multi-item-set-status").click(function() {
 | 
					    $('#multi-item-set-status').click(function() {
 | 
				
			||||||
        // Select and set the STATUS field for selected stock items
 | 
					        // Select and set the STATUS field for selected stock items
 | 
				
			||||||
        var selections = $(table).bootstrapTable('getSelections');
 | 
					        var selections = $(table).bootstrapTable('getSelections');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1409,11 +1420,11 @@ function loadStockTable(table, options) {
 | 
				
			|||||||
            $.when.apply($, requests).done(function() {
 | 
					            $.when.apply($, requests).done(function() {
 | 
				
			||||||
                $(table).bootstrapTable('refresh');
 | 
					                $(table).bootstrapTable('refresh');
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        })
 | 
					        });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $("#multi-item-delete").click(function() {
 | 
					    $('#multi-item-delete').click(function() {
 | 
				
			||||||
        var selections = $(table).bootstrapTable("getSelections");
 | 
					        var selections = $(table).bootstrapTable('getSelections');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        var stock = [];
 | 
					        var stock = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1528,10 +1539,10 @@ function loadStockTrackingTable(table, options) {
 | 
				
			|||||||
        field: 'label',
 | 
					        field: 'label',
 | 
				
			||||||
        title: '{% trans "Description" %}',
 | 
					        title: '{% trans "Description" %}',
 | 
				
			||||||
        formatter: function(value, row) {
 | 
					        formatter: function(value, row) {
 | 
				
			||||||
            var html = "<b>" + value + "</b>";
 | 
					            var html = '<b>' + value + '</b>';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (row.notes) {
 | 
					            if (row.notes) {
 | 
				
			||||||
                html += "<br><i>" + row.notes + "</i>";
 | 
					                html += '<br><i>' + row.notes + '</i>';
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return html;
 | 
					            return html;
 | 
				
			||||||
@@ -1763,7 +1774,7 @@ function createNewStockItem(options) {
 | 
				
			|||||||
                reloadFieldOptions(
 | 
					                reloadFieldOptions(
 | 
				
			||||||
                    'supplier_part',
 | 
					                    'supplier_part',
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        url: "{% url 'api-supplier-part-list' %}",
 | 
					                        url: '{% url "api-supplier-part-list" %}',
 | 
				
			||||||
                        params: {
 | 
					                        params: {
 | 
				
			||||||
                            part: value,
 | 
					                            part: value,
 | 
				
			||||||
                            pretty: true,
 | 
					                            pretty: true,
 | 
				
			||||||
@@ -1794,7 +1805,7 @@ function createNewStockItem(options) {
 | 
				
			|||||||
                            } else {
 | 
					                            } else {
 | 
				
			||||||
                                var expiry = moment().add(response.default_expiry, 'days');
 | 
					                                var expiry = moment().add(response.default_expiry, 'days');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                setFieldValue('expiry_date', expiry.format("YYYY-MM-DD"));
 | 
					                                setFieldValue('expiry_date', expiry.format('YYYY-MM-DD'));
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
@@ -1803,7 +1814,7 @@ function createNewStockItem(options) {
 | 
				
			|||||||
        },
 | 
					        },
 | 
				
			||||||
    ];
 | 
					    ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    launchModalForm("{% url 'stock-item-create' %}", options);
 | 
					    launchModalForm('{% url "stock-item-create" %}', options);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1813,7 +1824,7 @@ function loadInstalledInTable(table, options) {
 | 
				
			|||||||
    */
 | 
					    */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    table.inventreeTable({
 | 
					    table.inventreeTable({
 | 
				
			||||||
        url: "{% url 'api-stock-list' %}",
 | 
					        url: '{% url "api-stock-list" %}',
 | 
				
			||||||
        queryParams: {
 | 
					        queryParams: {
 | 
				
			||||||
            installed_in: options.stock_item,
 | 
					            installed_in: options.stock_item,
 | 
				
			||||||
            part_detail: true,
 | 
					            part_detail: true,
 | 
				
			||||||
@@ -1892,7 +1903,7 @@ function loadInstalledInTable(table, options) {
 | 
				
			|||||||
                            table.bootstrapTable('refresh');
 | 
					                            table.bootstrapTable('refresh');
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                )
 | 
					                );
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,7 +27,7 @@ function getAvailableTableFilters(tableKey) {
 | 
				
			|||||||
    tableKey = tableKey.toLowerCase();
 | 
					    tableKey = tableKey.toLowerCase();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Filters for "variant" table
 | 
					    // Filters for "variant" table
 | 
				
			||||||
    if (tableKey == "variants") {
 | 
					    if (tableKey == 'variants') {
 | 
				
			||||||
        return {
 | 
					        return {
 | 
				
			||||||
            active: {
 | 
					            active: {
 | 
				
			||||||
                type: 'bool',
 | 
					                type: 'bool',
 | 
				
			||||||
@@ -49,11 +49,11 @@ function getAvailableTableFilters(tableKey) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Filters for Bill of Materials table
 | 
					    // Filters for Bill of Materials table
 | 
				
			||||||
    if (tableKey == "bom") {
 | 
					    if (tableKey == 'bom') {
 | 
				
			||||||
        return {
 | 
					        return {
 | 
				
			||||||
            sub_part_trackable: {
 | 
					            sub_part_trackable: {
 | 
				
			||||||
                type: 'bool',
 | 
					                type: 'bool',
 | 
				
			||||||
                title: '{% trans "Trackable Part" %}'
 | 
					                title: '{% trans "Trackable Part" %}',
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            sub_part_assembly: {
 | 
					            sub_part_assembly: {
 | 
				
			||||||
                type: 'bool',
 | 
					                type: 'bool',
 | 
				
			||||||
@@ -70,7 +70,7 @@ function getAvailableTableFilters(tableKey) {
 | 
				
			|||||||
            allow_variants: {
 | 
					            allow_variants: {
 | 
				
			||||||
                type: 'bool',
 | 
					                type: 'bool',
 | 
				
			||||||
                title: '{% trans "Allow Variant Stock" %}',
 | 
					                title: '{% trans "Allow Variant Stock" %}',
 | 
				
			||||||
            }
 | 
					            },
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -85,29 +85,29 @@ function getAvailableTableFilters(tableKey) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Filters for "stock location" table
 | 
					    // Filters for "stock location" table
 | 
				
			||||||
    if (tableKey == "location") {
 | 
					    if (tableKey == 'location') {
 | 
				
			||||||
        return {
 | 
					        return {
 | 
				
			||||||
            cascade: {
 | 
					            cascade: {
 | 
				
			||||||
                type: 'bool',
 | 
					                type: 'bool',
 | 
				
			||||||
                title: '{% trans "Include sublocations" %}',
 | 
					                title: '{% trans "Include sublocations" %}',
 | 
				
			||||||
                description: '{% trans "Include locations" %}',
 | 
					                description: '{% trans "Include locations" %}',
 | 
				
			||||||
            }
 | 
					            },
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Filters for "part category" table
 | 
					    // Filters for "part category" table
 | 
				
			||||||
    if (tableKey == "category") {
 | 
					    if (tableKey == 'category') {
 | 
				
			||||||
        return {
 | 
					        return {
 | 
				
			||||||
            cascade: {
 | 
					            cascade: {
 | 
				
			||||||
                type: 'bool',
 | 
					                type: 'bool',
 | 
				
			||||||
                title: '{% trans "Include subcategories" %}',
 | 
					                title: '{% trans "Include subcategories" %}',
 | 
				
			||||||
                description: '{% trans "Include subcategories" %}',
 | 
					                description: '{% trans "Include subcategories" %}',
 | 
				
			||||||
            }
 | 
					            },
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Filters for the "customer stock" table (really a subset of "stock")
 | 
					    // Filters for the "customer stock" table (really a subset of "stock")
 | 
				
			||||||
    if (tableKey == "customerstock") {
 | 
					    if (tableKey == 'customerstock') {
 | 
				
			||||||
        return {
 | 
					        return {
 | 
				
			||||||
            serialized: {
 | 
					            serialized: {
 | 
				
			||||||
                type: 'bool',
 | 
					                type: 'bool',
 | 
				
			||||||
@@ -115,7 +115,7 @@ function getAvailableTableFilters(tableKey) {
 | 
				
			|||||||
            },
 | 
					            },
 | 
				
			||||||
            serial_gte: {
 | 
					            serial_gte: {
 | 
				
			||||||
                title: '{% trans "Serial number GTE" %}',
 | 
					                title: '{% trans "Serial number GTE" %}',
 | 
				
			||||||
                description: '{% trans "Serial number greater than or equal to" %}'
 | 
					                description: '{% trans "Serial number greater than or equal to" %}',
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            serial_lte: {
 | 
					            serial_lte: {
 | 
				
			||||||
                title: '{% trans "Serial number LTE" %}',
 | 
					                title: '{% trans "Serial number LTE" %}',
 | 
				
			||||||
@@ -123,7 +123,7 @@ function getAvailableTableFilters(tableKey) {
 | 
				
			|||||||
            },
 | 
					            },
 | 
				
			||||||
            serial: {
 | 
					            serial: {
 | 
				
			||||||
                title: '{% trans "Serial number" %}',
 | 
					                title: '{% trans "Serial number" %}',
 | 
				
			||||||
                description: '{% trans "Serial number" %}'
 | 
					                description: '{% trans "Serial number" %}',
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            batch: {
 | 
					            batch: {
 | 
				
			||||||
                title: '{% trans "Batch" %}',
 | 
					                title: '{% trans "Batch" %}',
 | 
				
			||||||
@@ -192,11 +192,11 @@ function getAvailableTableFilters(tableKey) {
 | 
				
			|||||||
            },
 | 
					            },
 | 
				
			||||||
            serial: {
 | 
					            serial: {
 | 
				
			||||||
                title: '{% trans "Serial number" %}',
 | 
					                title: '{% trans "Serial number" %}',
 | 
				
			||||||
                description: '{% trans "Serial number" %}'
 | 
					                description: '{% trans "Serial number" %}',
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            serial_gte: {
 | 
					            serial_gte: {
 | 
				
			||||||
                title: '{% trans "Serial number GTE" %}',
 | 
					                title: '{% trans "Serial number GTE" %}',
 | 
				
			||||||
                description: '{% trans "Serial number greater than or equal to" %}'
 | 
					                description: '{% trans "Serial number greater than or equal to" %}',
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            serial_lte: {
 | 
					            serial_lte: {
 | 
				
			||||||
                title: '{% trans "Serial number LTE" %}',
 | 
					                title: '{% trans "Serial number LTE" %}',
 | 
				
			||||||
@@ -252,7 +252,7 @@ function getAvailableTableFilters(tableKey) {
 | 
				
			|||||||
            required: {
 | 
					            required: {
 | 
				
			||||||
                type: 'bool',
 | 
					                type: 'bool',
 | 
				
			||||||
                title: '{% trans "Required" %}',
 | 
					                title: '{% trans "Required" %}',
 | 
				
			||||||
            }
 | 
					            },
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -275,7 +275,7 @@ function getAvailableTableFilters(tableKey) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Filters for the "Order" table
 | 
					    // Filters for the "Order" table
 | 
				
			||||||
    if (tableKey == "purchaseorder") {
 | 
					    if (tableKey == 'purchaseorder') {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return {
 | 
					        return {
 | 
				
			||||||
            status: {
 | 
					            status: {
 | 
				
			||||||
@@ -293,7 +293,7 @@ function getAvailableTableFilters(tableKey) {
 | 
				
			|||||||
        };
 | 
					        };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (tableKey == "salesorder") {
 | 
					    if (tableKey == 'salesorder') {
 | 
				
			||||||
        return {
 | 
					        return {
 | 
				
			||||||
            status: {
 | 
					            status: {
 | 
				
			||||||
                title: '{% trans "Order status" %}',
 | 
					                title: '{% trans "Order status" %}',
 | 
				
			||||||
@@ -315,12 +315,12 @@ function getAvailableTableFilters(tableKey) {
 | 
				
			|||||||
            active: {
 | 
					            active: {
 | 
				
			||||||
                type: 'bool',
 | 
					                type: 'bool',
 | 
				
			||||||
                title: '{% trans "Active parts" %}',
 | 
					                title: '{% trans "Active parts" %}',
 | 
				
			||||||
            }
 | 
					            },
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Filters for the "Parts" table
 | 
					    // Filters for the "Parts" table
 | 
				
			||||||
    if (tableKey == "parts") {
 | 
					    if (tableKey == 'parts') {
 | 
				
			||||||
        return {
 | 
					        return {
 | 
				
			||||||
            cascade: {
 | 
					            cascade: {
 | 
				
			||||||
                type: 'bool',
 | 
					                type: 'bool',
 | 
				
			||||||
@@ -343,7 +343,7 @@ function getAvailableTableFilters(tableKey) {
 | 
				
			|||||||
            },
 | 
					            },
 | 
				
			||||||
            has_stock: {
 | 
					            has_stock: {
 | 
				
			||||||
                type: 'bool',
 | 
					                type: 'bool',
 | 
				
			||||||
                title: '{% trans "Stock available" %}'
 | 
					                title: '{% trans "Stock available" %}',
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            low_stock: {
 | 
					            low_stock: {
 | 
				
			||||||
                type: 'bool',
 | 
					                type: 'bool',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -253,7 +253,7 @@ $.fn.inventreeTable = function(options) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // If a set of visible columns has been saved, load!
 | 
					    // If a set of visible columns has been saved, load!
 | 
				
			||||||
    if (visibleColumns) {
 | 
					    if (visibleColumns) {
 | 
				
			||||||
        var columns = visibleColumns.split(",");
 | 
					        var columns = visibleColumns.split(',');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Which columns are currently visible?
 | 
					        // Which columns are currently visible?
 | 
				
			||||||
        var visible = table.bootstrapTable('getVisibleColumns');
 | 
					        var visible = table.bootstrapTable('getVisibleColumns');
 | 
				
			||||||
@@ -275,7 +275,8 @@ $.fn.inventreeTable = function(options) {
 | 
				
			|||||||
    if (options.buttons) {
 | 
					    if (options.buttons) {
 | 
				
			||||||
        linkButtonsToSelection(table, options.buttons);
 | 
					        linkButtonsToSelection(table, options.buttons);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function customGroupSorter(sortName, sortOrder, sortData) {
 | 
					function customGroupSorter(sortName, sortOrder, sortData) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -381,7 +382,7 @@ function customGroupSorter(sortName, sortOrder, sortData) {
 | 
				
			|||||||
        },
 | 
					        },
 | 
				
			||||||
        formatAllRows: function() {
 | 
					        formatAllRows: function() {
 | 
				
			||||||
            return '{% trans "All" %}';
 | 
					            return '{% trans "All" %}';
 | 
				
			||||||
        }
 | 
					        },
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['en-US-custom']);
 | 
					    $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['en-US-custom']);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user