mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-03 22:55:43 +00:00 
			
		
		
		
	Add translation layer for build.js
This commit is contained in:
		@@ -77,6 +77,7 @@ settings_urls = [
 | 
				
			|||||||
dynamic_javascript_urls = [
 | 
					dynamic_javascript_urls = [
 | 
				
			||||||
    url(r'^part.js', DynamicJsView.as_view(template_name='js/part.js'), name='part.js'),
 | 
					    url(r'^part.js', DynamicJsView.as_view(template_name='js/part.js'), name='part.js'),
 | 
				
			||||||
    url(r'^stock.js', DynamicJsView.as_view(template_name='js/stock.js'), name='stock.js'),
 | 
					    url(r'^stock.js', DynamicJsView.as_view(template_name='js/stock.js'), name='stock.js'),
 | 
				
			||||||
 | 
					    url(r'^build.js', DynamicJsView.as_view(template_name='js/build.js'), name='build.js'),
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
urlpatterns = [
 | 
					urlpatterns = [
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -105,7 +105,6 @@ InvenTree
 | 
				
			|||||||
<script type='text/javascript' src="{% static 'script/inventree/bom.js' %}"></script>
 | 
					<script type='text/javascript' src="{% static 'script/inventree/bom.js' %}"></script>
 | 
				
			||||||
<script type='text/javascript' src="{% static 'script/inventree/filters.js' %}"></script>
 | 
					<script type='text/javascript' src="{% static 'script/inventree/filters.js' %}"></script>
 | 
				
			||||||
<script type='text/javascript' src="{% static 'script/inventree/tables.js' %}"></script>
 | 
					<script type='text/javascript' src="{% static 'script/inventree/tables.js' %}"></script>
 | 
				
			||||||
<script type='text/javascript' src="{% static 'script/inventree/build.js' %}"></script>
 | 
					 | 
				
			||||||
<script type='text/javascript' src="{% static 'script/inventree/modals.js' %}"></script>
 | 
					<script type='text/javascript' src="{% static 'script/inventree/modals.js' %}"></script>
 | 
				
			||||||
<script type='text/javascript' src="{% static 'script/inventree/order.js' %}"></script>
 | 
					<script type='text/javascript' src="{% static 'script/inventree/order.js' %}"></script>
 | 
				
			||||||
<script type='text/javascript' src="{% static 'script/inventree/company.js' %}"></script>
 | 
					<script type='text/javascript' src="{% static 'script/inventree/company.js' %}"></script>
 | 
				
			||||||
@@ -114,6 +113,7 @@ InvenTree
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
<script type='text/javascript' src="{% url 'part.js' %}"></script>
 | 
					<script type='text/javascript' src="{% url 'part.js' %}"></script>
 | 
				
			||||||
<script type='text/javascript' src="{% url 'stock.js' %}"></script>
 | 
					<script type='text/javascript' src="{% url 'stock.js' %}"></script>
 | 
				
			||||||
 | 
					<script type='text/javascript' src="{% url 'build.js' %}"></script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script type='text/javascript' src="{% static 'fontawesome/js/solid.js' %}"></script>
 | 
					<script type='text/javascript' src="{% static 'fontawesome/js/solid.js' %}"></script>
 | 
				
			||||||
<script type='text/javascript' src="{% static 'fontawesome/js/brands.js' %}"></script>
 | 
					<script type='text/javascript' src="{% static 'fontawesome/js/brands.js' %}"></script>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,3 +1,5 @@
 | 
				
			|||||||
 | 
					{% load i18n %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function loadBuildTable(table, options) {
 | 
					function loadBuildTable(table, options) {
 | 
				
			||||||
    // Display a table of Build objects
 | 
					    // Display a table of Build objects
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -14,7 +16,7 @@ function loadBuildTable(table, options) {
 | 
				
			|||||||
    table.inventreeTable({
 | 
					    table.inventreeTable({
 | 
				
			||||||
        method: 'get',
 | 
					        method: 'get',
 | 
				
			||||||
        formatNoMatches: function() {
 | 
					        formatNoMatches: function() {
 | 
				
			||||||
            return "No builds matching query";
 | 
					            return "{% trans "No builds matching query" %}";
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        url: options.url,
 | 
					        url: options.url,
 | 
				
			||||||
        queryParams: filters,
 | 
					        queryParams: filters,
 | 
				
			||||||
@@ -28,7 +30,7 @@ function loadBuildTable(table, options) {
 | 
				
			|||||||
            },
 | 
					            },
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                field: 'title',
 | 
					                field: 'title',
 | 
				
			||||||
                title: 'Build',
 | 
					                title: '{% trans "Build" %}',
 | 
				
			||||||
                sortable: true,
 | 
					                sortable: true,
 | 
				
			||||||
                formatter: function(value, row, index, field) {
 | 
					                formatter: function(value, row, index, field) {
 | 
				
			||||||
                    return renderLink(value, '/build/' + row.pk + '/');
 | 
					                    return renderLink(value, '/build/' + row.pk + '/');
 | 
				
			||||||
@@ -36,7 +38,7 @@ function loadBuildTable(table, options) {
 | 
				
			|||||||
            },
 | 
					            },
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                field: 'part',
 | 
					                field: 'part',
 | 
				
			||||||
                title: 'Part',
 | 
					                title: '{% trans "Part" %}',
 | 
				
			||||||
                sortable: true,
 | 
					                sortable: true,
 | 
				
			||||||
                formatter: function(value, row, index, field) {
 | 
					                formatter: function(value, row, index, field) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -47,12 +49,12 @@ function loadBuildTable(table, options) {
 | 
				
			|||||||
            },
 | 
					            },
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                field: 'quantity',
 | 
					                field: 'quantity',
 | 
				
			||||||
                title: 'Quantity',
 | 
					                title: '{% trans "Quantity" %}',
 | 
				
			||||||
                sortable: true,
 | 
					                sortable: true,
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                field: 'status',
 | 
					                field: 'status',
 | 
				
			||||||
                title: 'Status',
 | 
					                title: '{% trans "Status" %}',
 | 
				
			||||||
                sortable: true,
 | 
					                sortable: true,
 | 
				
			||||||
                formatter: function(value, row, index, field) {
 | 
					                formatter: function(value, row, index, field) {
 | 
				
			||||||
                    return buildStatusDisplay(value);
 | 
					                    return buildStatusDisplay(value);
 | 
				
			||||||
@@ -60,12 +62,12 @@ function loadBuildTable(table, options) {
 | 
				
			|||||||
            },
 | 
					            },
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                field: 'creation_date',
 | 
					                field: 'creation_date',
 | 
				
			||||||
                title: 'Created',
 | 
					                title: '{% trans "Created" %}',
 | 
				
			||||||
                sortable: true,
 | 
					                sortable: true,
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                field: 'completion_date',
 | 
					                field: 'completion_date',
 | 
				
			||||||
                title: 'Completed',
 | 
					                title: '{% trans "Completed" %}',
 | 
				
			||||||
                sortable: true,
 | 
					                sortable: true,
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
        ],
 | 
					        ],
 | 
				
			||||||
@@ -97,30 +99,30 @@ function loadAllocationTable(table, part_id, part, url, required, button) {
 | 
				
			|||||||
    table.bootstrapTable({
 | 
					    table.bootstrapTable({
 | 
				
			||||||
        url: url,
 | 
					        url: url,
 | 
				
			||||||
        sortable: false,
 | 
					        sortable: false,
 | 
				
			||||||
        formatNoMatches: function() { return 'No parts allocated for ' + part; },
 | 
					        formatNoMatches: function() { return '{% trans "No parts allocated for" %} ' + part; },
 | 
				
			||||||
        columns: [
 | 
					        columns: [
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                field: 'stock_item_detail',
 | 
					                field: 'stock_item_detail',
 | 
				
			||||||
                title: 'Stock Item',
 | 
					                title: '{% trans "Stock Item" %}',
 | 
				
			||||||
                formatter: function(value, row, index, field) {
 | 
					                formatter: function(value, row, index, field) {
 | 
				
			||||||
                    return '' + parseFloat(value.quantity) + ' x ' + value.part_name + ' @ ' + value.location_name;
 | 
					                    return '' + parseFloat(value.quantity) + ' x ' + value.part_name + ' @ ' + value.location_name;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                field: 'stock_item_detail.quantity',
 | 
					                field: 'stock_item_detail.quantity',
 | 
				
			||||||
                title: 'Available',
 | 
					                title: '{% trans "Available" %}',
 | 
				
			||||||
                formatter: function(value, row, index, field) {
 | 
					                formatter: function(value, row, index, field) {
 | 
				
			||||||
                    return parseFloat(value);
 | 
					                    return parseFloat(value);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                field: 'quantity',
 | 
					                field: 'quantity',
 | 
				
			||||||
                title: 'Allocated',
 | 
					                title: '{% trans "Allocated" %}',
 | 
				
			||||||
                formatter: function(value, row, index, field) {
 | 
					                formatter: function(value, row, index, field) {
 | 
				
			||||||
                    var html = parseFloat(value);
 | 
					                    var html = parseFloat(value);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    var bEdit = "<button class='btn item-edit-button btn-sm' type='button' title='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='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>";
 | 
				
			||||||
                    
 | 
					                    
 | 
				
			||||||
		Reference in New Issue
	
	Block a user