mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 13:05:42 +00:00
Merge branch 'inventree:master' into matmair/issue2279
This commit is contained in:
@ -81,7 +81,7 @@
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ plugin.author }}</td>
|
||||
<td>{{ plugin.pub_date }}</td>
|
||||
<td>{% render_date plugin.pub_date %}</td>
|
||||
<td>{% if plugin.version %}{{ plugin.version }}{% endif %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
@ -36,7 +36,7 @@
|
||||
<tr>
|
||||
<td><span class='fas fa-calendar-alt'></span></td>
|
||||
<td>{% trans "Date" %}</td>
|
||||
<td>{{ plugin.pub_date }}{% include "clip.html" %}</td>
|
||||
<td>{% render_date plugin.pub_date %}{% include "clip.html" %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fas fa-hashtag'></span></td>
|
||||
@ -101,7 +101,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fas fa-calendar-alt'></span></td>
|
||||
<td>{% trans "Commit Date" %}</td><td>{{ plugin.package.date }}{% include "clip.html" %}</td>
|
||||
<td>{% trans "Commit Date" %}</td><td>{% render_date plugin.package.date %}{% include "clip.html" %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fas fa-code-branch'></span></td>
|
||||
|
@ -28,7 +28,11 @@
|
||||
<div id='setting-{{ setting.pk }}'>
|
||||
<span id='setting-value-{{ setting.key.upper }}' fieldname='{{ setting.key.upper }}'>
|
||||
{% if setting.value %}
|
||||
{% if setting.is_choice %}
|
||||
<strong>{{ setting.as_choice }}</strong>
|
||||
{% else %}
|
||||
<strong>{{ setting.value }}</strong>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<em style='color: #855;'>{% trans "No value set" %}</em>
|
||||
{% endif %}
|
||||
|
@ -15,6 +15,7 @@
|
||||
<table class='table table-striped table-condensed'>
|
||||
<tbody>
|
||||
{% include "InvenTree/settings/setting.html" with key="STICKY_HEADER" icon="fa-bars" user_setting=True %}
|
||||
{% include "InvenTree/settings/setting.html" with key="DATE_DISPLAY_FORMAT" icon="fa-calendar-alt" user_setting=True %}
|
||||
{% include "InvenTree/settings/setting.html" with key="FORMS_CLOSE_USING_ESCAPE" icon="fa-window-close" user_setting=True %}
|
||||
{% include "InvenTree/settings/setting.html" with key="PART_SHOW_QUANTITY_IN_FORMS" icon="fa-hashtag" user_setting=True %}
|
||||
</tbody>
|
||||
|
@ -44,7 +44,7 @@
|
||||
{% if commit_date %}
|
||||
<tr>
|
||||
<td><span class='fas fa-calendar-alt'></span></td>
|
||||
<td>{% trans "Commit Date" %}</td><td>{{ commit_date }}{% include "clip.html" %}</td>
|
||||
<td>{% trans "Commit Date" %}</td><td>{% render_date commit_date %}{% include "clip.html" %}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
@ -7,6 +7,7 @@
|
||||
clearEvents,
|
||||
endDate,
|
||||
startDate,
|
||||
renderDate,
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -32,3 +33,33 @@ function clearEvents(calendar) {
|
||||
event.remove();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Render the provided date in the user-specified format.
|
||||
*
|
||||
* The provided "date" variable is a string, nominally ISO format e.g. 2022-02-22
|
||||
* The user-configured setting DATE_DISPLAY_FORMAT determines how the date should be displayed.
|
||||
*/
|
||||
|
||||
function renderDate(date, options={}) {
|
||||
|
||||
if (!date) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var fmt = user_settings.DATE_DISPLAY_FORMAT || 'YYYY-MM-DD';
|
||||
|
||||
if (options.showTime) {
|
||||
fmt += ' HH:mm';
|
||||
}
|
||||
|
||||
var m = moment(date);
|
||||
|
||||
if (m.isValid()) {
|
||||
return m.format(fmt);
|
||||
} else {
|
||||
// Invalid input string, simply return provided value
|
||||
return date;
|
||||
}
|
||||
}
|
||||
|
@ -40,12 +40,15 @@ function editSetting(pk, options={}) {
|
||||
url = `/api/settings/user/${pk}/`;
|
||||
}
|
||||
|
||||
var reload_required = false;
|
||||
|
||||
// First, read the settings object from the server
|
||||
inventreeGet(url, {}, {
|
||||
success: function(response) {
|
||||
|
||||
if (response.choices && response.choices.length > 0) {
|
||||
response.type = 'choice';
|
||||
reload_required = true;
|
||||
}
|
||||
|
||||
// Construct the field
|
||||
@ -89,7 +92,9 @@ function editSetting(pk, options={}) {
|
||||
|
||||
var setting = response.key;
|
||||
|
||||
if (response.type == 'boolean') {
|
||||
if (reload_required) {
|
||||
location.reload();
|
||||
} else if (response.type == 'boolean') {
|
||||
var enabled = response.value.toString().toLowerCase() == 'true';
|
||||
$(`#setting-value-${setting}`).prop('checked', enabled);
|
||||
} else {
|
||||
|
@ -165,6 +165,9 @@ function loadAttachmentTable(url, options) {
|
||||
{
|
||||
field: 'upload_date',
|
||||
title: '{% trans "Upload Date" %}',
|
||||
formatter: function(value) {
|
||||
return renderDate(value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'actions',
|
||||
|
@ -1961,6 +1961,9 @@ function loadBuildTable(table, options) {
|
||||
field: 'creation_date',
|
||||
title: '{% trans "Created" %}',
|
||||
sortable: true,
|
||||
formatter: function(value) {
|
||||
return renderDate(value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'issued_by',
|
||||
@ -1990,11 +1993,17 @@ function loadBuildTable(table, options) {
|
||||
field: 'target_date',
|
||||
title: '{% trans "Target Date" %}',
|
||||
sortable: true,
|
||||
formatter: function(value) {
|
||||
return renderDate(value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'completion_date',
|
||||
title: '{% trans "Completion Date" %}',
|
||||
sortable: true,
|
||||
formatter: function(value) {
|
||||
return renderDate(value);
|
||||
}
|
||||
},
|
||||
],
|
||||
});
|
||||
|
@ -542,6 +542,11 @@ function constructFormBody(fields, options) {
|
||||
insertConfirmButton(options);
|
||||
}
|
||||
|
||||
// Insert "persist" button (if required)
|
||||
if (options.persist) {
|
||||
insertPersistButton(options);
|
||||
}
|
||||
|
||||
// Display the modal
|
||||
$(modal).modal('show');
|
||||
|
||||
@ -616,6 +621,22 @@ function insertConfirmButton(options) {
|
||||
}
|
||||
|
||||
|
||||
/* Add a checkbox to select if the modal will stay open after success */
|
||||
function insertPersistButton(options) {
|
||||
|
||||
var message = options.persistMessage || '{% trans "Keep this form open" %}';
|
||||
|
||||
var html = `
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" id="modal-persist">
|
||||
<label class="form-check-label" for="modal-persist">${message}</label>
|
||||
</div>
|
||||
`;
|
||||
|
||||
$(options.modal).find('#modal-footer-buttons').append(html);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Extract all specified form values as a single object
|
||||
*/
|
||||
@ -934,19 +955,40 @@ function getFormFieldValue(name, field={}, options={}) {
|
||||
*/
|
||||
function handleFormSuccess(response, options) {
|
||||
|
||||
// Close the modal
|
||||
if (!options.preventClose) {
|
||||
// Note: The modal will be deleted automatically after closing
|
||||
$(options.modal).modal('hide');
|
||||
}
|
||||
|
||||
// Display any required messages
|
||||
// Should we show alerts immediately or cache them?
|
||||
var cache = (options.follow && response.url) || options.redirect || options.reload;
|
||||
|
||||
// Should the form "persist"?
|
||||
var persist = false;
|
||||
|
||||
if (options.persist && options.modal) {
|
||||
// Determine if this form should "persist", or be dismissed?
|
||||
var chk = $(options.modal).find('#modal-persist');
|
||||
|
||||
persist = chk.exists() && chk.prop('checked');
|
||||
}
|
||||
|
||||
if (persist) {
|
||||
cache = false;
|
||||
}
|
||||
|
||||
var msg_target = null;
|
||||
|
||||
if (persist) {
|
||||
// If the modal is persistant, the target for any messages should be the modal!
|
||||
msg_target = $(options.modal).find('#pre-form-content');
|
||||
}
|
||||
|
||||
// Display any messages
|
||||
if (response && (response.success || options.successMessage)) {
|
||||
showAlertOrCache(response.success || options.successMessage, cache, {style: 'success'});
|
||||
showAlertOrCache(
|
||||
response.success || options.successMessage,
|
||||
cache,
|
||||
{
|
||||
style: 'success',
|
||||
target: msg_target,
|
||||
});
|
||||
}
|
||||
|
||||
if (response && response.info) {
|
||||
@ -961,20 +1003,41 @@ function handleFormSuccess(response, options) {
|
||||
showAlertOrCache(response.danger, cache, {style: 'danger'});
|
||||
}
|
||||
|
||||
if (options.onSuccess) {
|
||||
// Callback function
|
||||
options.onSuccess(response, options);
|
||||
}
|
||||
if (persist) {
|
||||
// Instead of closing the form and going somewhere else,
|
||||
// reload (empty) the form so the user can input more data
|
||||
|
||||
// Reset the status of the "submit" button
|
||||
if (options.modal) {
|
||||
$(options.modal).find('#modal-form-submit').prop('disabled', false);
|
||||
}
|
||||
|
||||
if (options.follow && response.url) {
|
||||
// Follow the returned URL
|
||||
window.location.href = response.url;
|
||||
} else if (options.reload) {
|
||||
// Reload the current page
|
||||
location.reload();
|
||||
} else if (options.redirect) {
|
||||
// Redirect to a specified URL
|
||||
window.location.href = options.redirect;
|
||||
// Remove any error flags from the form
|
||||
clearFormErrors(options);
|
||||
|
||||
} else {
|
||||
|
||||
// Close the modal
|
||||
if (!options.preventClose) {
|
||||
// Note: The modal will be deleted automatically after closing
|
||||
$(options.modal).modal('hide');
|
||||
}
|
||||
|
||||
if (options.onSuccess) {
|
||||
// Callback function
|
||||
options.onSuccess(response, options);
|
||||
}
|
||||
|
||||
if (options.follow && response.url) {
|
||||
// Follow the returned URL
|
||||
window.location.href = response.url;
|
||||
} else if (options.reload) {
|
||||
// Reload the current page
|
||||
location.reload();
|
||||
} else if (options.redirect) {
|
||||
// Redirect to a specified URL
|
||||
window.location.href = options.redirect;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -988,6 +1051,8 @@ function clearFormErrors(options={}) {
|
||||
if (options && options.modal) {
|
||||
// Remove the individual error messages
|
||||
$(options.modal).find('.form-error-message').remove();
|
||||
|
||||
$(options.modal).find('.modal-content').removeClass('modal-error');
|
||||
|
||||
// Remove the "has error" class
|
||||
$(options.modal).find('.form-field-error').removeClass('form-field-error');
|
||||
@ -1884,7 +1949,7 @@ function getFieldName(name, options={}) {
|
||||
* - Field description (help text)
|
||||
* - Field errors
|
||||
*/
|
||||
function constructField(name, parameters, options) {
|
||||
function constructField(name, parameters, options={}) {
|
||||
|
||||
var html = '';
|
||||
|
||||
@ -1976,7 +2041,7 @@ function constructField(name, parameters, options) {
|
||||
html += `<div class='controls'>`;
|
||||
|
||||
// Does this input deserve "extra" decorators?
|
||||
var extra = parameters.prefix != null;
|
||||
var extra = (parameters.icon != null) || (parameters.prefix != null) || (parameters.prefixRaw != null);
|
||||
|
||||
// Some fields can have 'clear' inputs associated with them
|
||||
if (!parameters.required && !parameters.read_only) {
|
||||
@ -1998,9 +2063,13 @@ function constructField(name, parameters, options) {
|
||||
|
||||
if (extra) {
|
||||
html += `<div class='input-group'>`;
|
||||
|
||||
|
||||
if (parameters.prefix) {
|
||||
html += `<span class='input-group-text'>${parameters.prefix}</span>`;
|
||||
} else if (parameters.prefixRaw) {
|
||||
html += parameters.prefixRaw;
|
||||
} else if (parameters.icon) {
|
||||
html += `<span class='input-group-text'><span class='fas ${parameters.icon}'></span></span>`;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2147,6 +2216,10 @@ function constructInputOptions(name, classes, type, parameters, options={}) {
|
||||
|
||||
opts.push(`type='${type}'`);
|
||||
|
||||
if (parameters.title || parameters.help_text) {
|
||||
opts.push(`title='${parameters.title || parameters.help_text}'`);
|
||||
}
|
||||
|
||||
// Read only?
|
||||
if (parameters.read_only) {
|
||||
opts.push(`readonly=''`);
|
||||
@ -2192,11 +2265,6 @@ function constructInputOptions(name, classes, type, parameters, options={}) {
|
||||
opts.push(`required=''`);
|
||||
}
|
||||
|
||||
// Custom mouseover title?
|
||||
if (parameters.title != null) {
|
||||
opts.push(`title='${parameters.title}'`);
|
||||
}
|
||||
|
||||
// Placeholder?
|
||||
if (parameters.placeholder != null) {
|
||||
opts.push(`placeholder='${parameters.placeholder}'`);
|
||||
|
@ -116,6 +116,10 @@ function makeIconButton(icon, cls, pk, title, options={}) {
|
||||
extraProps += `disabled='true' `;
|
||||
}
|
||||
|
||||
if (options.collapseTarget) {
|
||||
extraProps += `data-bs-toggle='collapse' href='#${options.collapseTarget}'`;
|
||||
}
|
||||
|
||||
html += `<button pk='${pk}' id='${id}' class='${classes}' title='${title}' ${extraProps}>`;
|
||||
html += `<span class='fas ${icon}'></span>`;
|
||||
html += `</button>`;
|
||||
|
@ -476,6 +476,19 @@ function receivePurchaseOrderItems(order_id, line_items, options={}) {
|
||||
quantity = 0;
|
||||
}
|
||||
|
||||
// Prepend toggles to the quantity input
|
||||
var toggle_batch = `
|
||||
<span class='input-group-text' title='{% trans "Add batch code" %}' data-bs-toggle='collapse' href='#div-batch-${pk}'>
|
||||
<span class='fas fa-layer-group'></span>
|
||||
</span>
|
||||
`;
|
||||
|
||||
var toggle_serials = `
|
||||
<span class='input-group-text' title='{% trans "Add serial numbers" %}' data-bs-toggle='collapse' href='#div-serials-${pk}'>
|
||||
<span class='fas fa-hashtag'></span>
|
||||
</span>
|
||||
`;
|
||||
|
||||
// Quantity to Receive
|
||||
var quantity_input = constructField(
|
||||
`items_quantity_${pk}`,
|
||||
@ -491,6 +504,36 @@ function receivePurchaseOrderItems(order_id, line_items, options={}) {
|
||||
}
|
||||
);
|
||||
|
||||
// Add in options for "batch code" and "serial numbers"
|
||||
var batch_input = constructField(
|
||||
`items_batch_code_${pk}`,
|
||||
{
|
||||
type: 'string',
|
||||
required: false,
|
||||
label: '{% trans "Batch Code" %}',
|
||||
help_text: '{% trans "Enter batch code for incoming stock items" %}',
|
||||
prefixRaw: toggle_batch,
|
||||
}
|
||||
);
|
||||
|
||||
var sn_input = constructField(
|
||||
`items_serial_numbers_${pk}`,
|
||||
{
|
||||
type: 'string',
|
||||
required: false,
|
||||
label: '{% trans "Serial Numbers" %}',
|
||||
help_text: '{% trans "Enter serial numbers for incoming stock items" %}',
|
||||
prefixRaw: toggle_serials,
|
||||
}
|
||||
);
|
||||
|
||||
// Hidden inputs below the "quantity" field
|
||||
var quantity_input_group = `${quantity_input}<div class='collapse' id='div-batch-${pk}'>${batch_input}</div>`;
|
||||
|
||||
if (line_item.part_detail.trackable) {
|
||||
quantity_input_group += `<div class='collapse' id='div-serials-${pk}'>${sn_input}</div>`;
|
||||
}
|
||||
|
||||
// Construct list of StockItem status codes
|
||||
var choices = [];
|
||||
|
||||
@ -528,16 +571,38 @@ function receivePurchaseOrderItems(order_id, line_items, options={}) {
|
||||
);
|
||||
|
||||
// Button to remove the row
|
||||
var delete_button = `<div class='btn-group float-right' role='group'>`;
|
||||
var buttons = `<div class='btn-group float-right' role='group'>`;
|
||||
|
||||
delete_button += makeIconButton(
|
||||
buttons += makeIconButton(
|
||||
'fa-layer-group',
|
||||
'button-row-add-batch',
|
||||
pk,
|
||||
'{% trans "Add batch code" %}',
|
||||
{
|
||||
collapseTarget: `div-batch-${pk}`
|
||||
}
|
||||
);
|
||||
|
||||
if (line_item.part_detail.trackable) {
|
||||
buttons += makeIconButton(
|
||||
'fa-hashtag',
|
||||
'button-row-add-serials',
|
||||
pk,
|
||||
'{% trans "Add serial numbers" %}',
|
||||
{
|
||||
collapseTarget: `div-serials-${pk}`,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
buttons += makeIconButton(
|
||||
'fa-times icon-red',
|
||||
'button-row-remove',
|
||||
pk,
|
||||
'{% trans "Remove row" %}',
|
||||
);
|
||||
|
||||
delete_button += '</div>';
|
||||
buttons += '</div>';
|
||||
|
||||
var html = `
|
||||
<tr id='receive_row_${pk}' class='stock-receive-row'>
|
||||
@ -554,7 +619,7 @@ function receivePurchaseOrderItems(order_id, line_items, options={}) {
|
||||
${line_item.received}
|
||||
</td>
|
||||
<td id='quantity_${pk}'>
|
||||
${quantity_input}
|
||||
${quantity_input_group}
|
||||
</td>
|
||||
<td id='status_${pk}'>
|
||||
${status_input}
|
||||
@ -563,7 +628,7 @@ function receivePurchaseOrderItems(order_id, line_items, options={}) {
|
||||
${destination_input}
|
||||
</td>
|
||||
<td id='actions_${pk}'>
|
||||
${delete_button}
|
||||
${buttons}
|
||||
</td>
|
||||
</tr>`;
|
||||
|
||||
@ -587,7 +652,7 @@ function receivePurchaseOrderItems(order_id, line_items, options={}) {
|
||||
<th>{% trans "Order Code" %}</th>
|
||||
<th>{% trans "Ordered" %}</th>
|
||||
<th>{% trans "Received" %}</th>
|
||||
<th style='min-width: 50px;'>{% trans "Receive" %}</th>
|
||||
<th style='min-width: 50px;'>{% trans "Quantity to Receive" %}</th>
|
||||
<th style='min-width: 150px;'>{% trans "Status" %}</th>
|
||||
<th style='min-width: 300px;'>{% trans "Destination" %}</th>
|
||||
<th></th>
|
||||
@ -678,13 +743,23 @@ function receivePurchaseOrderItems(order_id, line_items, options={}) {
|
||||
var location = getFormFieldValue(`items_location_${pk}`, {}, opts);
|
||||
|
||||
if (quantity != null) {
|
||||
data.items.push({
|
||||
|
||||
var line = {
|
||||
line_item: pk,
|
||||
quantity: quantity,
|
||||
status: status,
|
||||
location: location,
|
||||
});
|
||||
};
|
||||
|
||||
if (getFormFieldElement(`items_batch_code_${pk}`).exists()) {
|
||||
line.batch_code = getFormFieldValue(`items_batch_code_${pk}`);
|
||||
}
|
||||
|
||||
if (getFormFieldElement(`items_serial_numbers_${pk}`).exists()) {
|
||||
line.serial_numbers = getFormFieldValue(`items_serial_numbers_${pk}`);
|
||||
}
|
||||
|
||||
data.items.push(line);
|
||||
item_pk_values.push(pk);
|
||||
}
|
||||
|
||||
@ -848,11 +923,17 @@ function loadPurchaseOrderTable(table, options) {
|
||||
field: 'creation_date',
|
||||
title: '{% trans "Date" %}',
|
||||
sortable: true,
|
||||
formatter: function(value) {
|
||||
return renderDate(value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'target_date',
|
||||
title: '{% trans "Target Date" %}',
|
||||
sortable: true,
|
||||
formatter: function(value) {
|
||||
return renderDate(value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'line_items',
|
||||
@ -930,6 +1011,7 @@ function loadPurchaseOrderLineItemTable(table, options={}) {
|
||||
reference: {},
|
||||
purchase_price: {},
|
||||
purchase_price_currency: {},
|
||||
target_date: {},
|
||||
destination: {},
|
||||
notes: {},
|
||||
},
|
||||
@ -971,7 +1053,11 @@ function loadPurchaseOrderLineItemTable(table, options={}) {
|
||||
],
|
||||
{
|
||||
success: function() {
|
||||
// Reload the line item table
|
||||
$(table).bootstrapTable('refresh');
|
||||
|
||||
// Reload the "received stock" table
|
||||
$('#stock-table').bootstrapTable('refresh');
|
||||
}
|
||||
}
|
||||
);
|
||||
@ -1111,6 +1197,28 @@ function loadPurchaseOrderLineItemTable(table, options={}) {
|
||||
return formatter.format(total);
|
||||
}
|
||||
},
|
||||
{
|
||||
sortable: true,
|
||||
field: 'target_date',
|
||||
switchable: true,
|
||||
title: '{% trans "Target Date" %}',
|
||||
formatter: function(value, row) {
|
||||
if (row.target_date) {
|
||||
var html = renderDate(row.target_date);
|
||||
|
||||
if (row.overdue) {
|
||||
html += `<span class='fas fa-calendar-alt icon-red float-right' title='{% trans "This line item is overdue" %}'></span>`;
|
||||
}
|
||||
|
||||
return html;
|
||||
|
||||
} else if (row.order_detail && row.order_detail.target_date) {
|
||||
return `<em>${renderDate(row.order_detail.target_date)}</em>`;
|
||||
} else {
|
||||
return '-';
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
sortable: false,
|
||||
field: 'received',
|
||||
@ -1157,15 +1265,15 @@ function loadPurchaseOrderLineItemTable(table, options={}) {
|
||||
|
||||
var pk = row.pk;
|
||||
|
||||
if (options.allow_receive && row.received < row.quantity) {
|
||||
html += makeIconButton('fa-sign-in-alt icon-green', 'button-line-receive', pk, '{% trans "Receive line item" %}');
|
||||
}
|
||||
|
||||
if (options.allow_edit) {
|
||||
html += makeIconButton('fa-edit icon-blue', 'button-line-edit', pk, '{% trans "Edit line item" %}');
|
||||
html += makeIconButton('fa-trash-alt icon-red', 'button-line-delete', pk, '{% trans "Delete line item" %}');
|
||||
}
|
||||
|
||||
if (options.allow_receive && row.received < row.quantity) {
|
||||
html += makeIconButton('fa-sign-in-alt', 'button-line-receive', pk, '{% trans "Receive line item" %}');
|
||||
}
|
||||
|
||||
html += `</div>`;
|
||||
|
||||
return html;
|
||||
@ -1269,16 +1377,25 @@ function loadSalesOrderTable(table, options) {
|
||||
sortable: true,
|
||||
field: 'creation_date',
|
||||
title: '{% trans "Creation Date" %}',
|
||||
formatter: function(value) {
|
||||
return renderDate(value);
|
||||
}
|
||||
},
|
||||
{
|
||||
sortable: true,
|
||||
field: 'target_date',
|
||||
title: '{% trans "Target Date" %}',
|
||||
formatter: function(value) {
|
||||
return renderDate(value);
|
||||
}
|
||||
},
|
||||
{
|
||||
sortable: true,
|
||||
field: 'shipment_date',
|
||||
title: '{% trans "Shipment Date" %}',
|
||||
formatter: function(value) {
|
||||
return renderDate(value);
|
||||
}
|
||||
},
|
||||
{
|
||||
sortable: true,
|
||||
@ -1430,9 +1547,9 @@ function loadSalesOrderShipmentTable(table, options={}) {
|
||||
sortable: true,
|
||||
formatter: function(value, row) {
|
||||
if (value) {
|
||||
return value;
|
||||
return renderDate(value);
|
||||
} else {
|
||||
return '{% trans "Not shipped" %}';
|
||||
return '<em>{% trans "Not shipped" %}</em>';
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -2208,6 +2325,28 @@ function loadSalesOrderLineItemTable(table, options={}) {
|
||||
return formatter.format(total);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'target_date',
|
||||
title: '{% trans "Target Date" %}',
|
||||
sortable: true,
|
||||
switchable: true,
|
||||
formatter: function(value, row) {
|
||||
if (row.target_date) {
|
||||
var html = renderDate(row.target_date);
|
||||
|
||||
if (row.overdue) {
|
||||
html += `<span class='fas fa-calendar-alt icon-red float-right' title='{% trans "This line item is overdue" %}'></span>`;
|
||||
}
|
||||
|
||||
return html;
|
||||
|
||||
} else if (row.order_detail && row.order_detail.target_date) {
|
||||
return `<em>${renderDate(row.order_detail.target_date)}</em>`;
|
||||
} else {
|
||||
return '-';
|
||||
}
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
if (pending) {
|
||||
@ -2351,6 +2490,7 @@ function loadSalesOrderLineItemTable(table, options={}) {
|
||||
reference: {},
|
||||
sale_price: {},
|
||||
sale_price_currency: {},
|
||||
target_date: {},
|
||||
notes: {},
|
||||
},
|
||||
title: '{% trans "Edit Line Item" %}',
|
||||
|
@ -905,6 +905,28 @@ function loadPartPurchaseOrderTable(table, part_id, options={}) {
|
||||
field: 'quantity',
|
||||
title: '{% trans "Quantity" %}',
|
||||
},
|
||||
{
|
||||
field: 'target_date',
|
||||
title: '{% trans "Target Date" %}',
|
||||
switchable: true,
|
||||
sortable: true,
|
||||
formatter: function(value, row) {
|
||||
if (row.target_date) {
|
||||
var html = row.target_date;
|
||||
|
||||
if (row.overdue) {
|
||||
html += `<span class='fas fa-calendar-alt icon-red float-right' title='{% trans "This line item is overdue" %}'></span>`;
|
||||
}
|
||||
|
||||
return html;
|
||||
|
||||
} else if (row.order_detail && row.order_detail.target_date) {
|
||||
return `<em>${row.order_detail.target_date}</em>`;
|
||||
} else {
|
||||
return '-';
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'received',
|
||||
title: '{% trans "Received" %}',
|
||||
|
@ -25,7 +25,6 @@
|
||||
modalSetContent,
|
||||
modalSetTitle,
|
||||
modalSubmit,
|
||||
moment,
|
||||
openModal,
|
||||
printStockItemLabels,
|
||||
printTestReports,
|
||||
@ -1820,6 +1819,9 @@ function loadStockTable(table, options) {
|
||||
col = {
|
||||
field: 'stocktake_date',
|
||||
title: '{% trans "Stocktake" %}',
|
||||
formatter: function(value) {
|
||||
return renderDate(value);
|
||||
}
|
||||
};
|
||||
|
||||
if (!options.params.ordering) {
|
||||
@ -1833,6 +1835,9 @@ function loadStockTable(table, options) {
|
||||
title: '{% trans "Expiry Date" %}',
|
||||
visible: global_settings.STOCK_ENABLE_EXPIRY,
|
||||
switchable: global_settings.STOCK_ENABLE_EXPIRY,
|
||||
formatter: function(value) {
|
||||
return renderDate(value);
|
||||
}
|
||||
};
|
||||
|
||||
if (!options.params.ordering) {
|
||||
@ -1844,6 +1849,9 @@ function loadStockTable(table, options) {
|
||||
col = {
|
||||
field: 'updated',
|
||||
title: '{% trans "Last Updated" %}',
|
||||
formatter: function(value) {
|
||||
return renderDate(value);
|
||||
}
|
||||
};
|
||||
|
||||
if (!options.params.ordering) {
|
||||
@ -2649,14 +2657,7 @@ function loadStockTrackingTable(table, options) {
|
||||
title: '{% trans "Date" %}',
|
||||
sortable: true,
|
||||
formatter: function(value) {
|
||||
var m = moment(value);
|
||||
|
||||
if (m.isValid()) {
|
||||
var html = m.format('dddd MMMM Do YYYY'); // + '<br>' + m.format('h:mm a');
|
||||
return html;
|
||||
}
|
||||
|
||||
return '<i>{% trans "Invalid date" %}</i>';
|
||||
return renderDate(value, {showTime: true});
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -278,7 +278,7 @@ $.fn.inventreeTable = function(options) {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.log(`Could not get list of visible columns for column '${tableName}'`);
|
||||
console.log(`Could not get list of visible columns for table '${tableName}'`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@
|
||||
<ul class='dropdown-menu dropdown-menu-end inventree-navbar-menu'>
|
||||
{% if user.is_authenticated %}
|
||||
{% if user.is_staff and not demo %}
|
||||
<li><a class='dropdown-item' href="/admin/"><span class="fas fa-user-shield"></span> {% trans "Admin" %}</a></li>
|
||||
<li><a class='dropdown-item' href="{% url 'admin:index' %}"><span class="fas fa-user-shield"></span> {% trans "Admin" %}</a></li>
|
||||
{% endif %}
|
||||
<li><a class='dropdown-item' href="{% url 'settings' %}"><span class="fas fa-cog"></span> {% trans "Settings" %}</a></li>
|
||||
<li><a class='dropdown-item' href="{% url 'account_logout' %}"><span class="fas fa-sign-out-alt"></span> {% trans "Logout" %}</a></li>
|
||||
|
@ -46,16 +46,16 @@
|
||||
<ul class="dropdown-menu">
|
||||
{% if roles.stock.change %}
|
||||
<li><a class='dropdown-item' href="#" id='multi-item-add' title='{% trans "Add to selected stock items" %}'><span class='fas fa-plus-circle icon-green'></span> {% trans "Add stock" %}</a></li>
|
||||
<li><a class='dropdown-item' href="#" id='multi-item-remove' title='{% trans "Remove from selected stock items" %}'><span class='fas fa-minus-circle'></span> {% trans "Remove stock" %}</a></li>
|
||||
<li><a class='dropdown-item' href="#" id='multi-item-stocktake' title='{% trans "Stocktake selected stock items" %}'><span class='fas fa-check-circle'></span> {% trans "Count stock" %}</a></li>
|
||||
<li><a class='dropdown-item' href='#' id='multi-item-move' title='{% trans "Move selected stock items" %}'><span class='fas fa-exchange-alt'></span> {% trans "Move stock" %}</a></li>
|
||||
<li><a class='dropdown-item' href="#" id='multi-item-remove' title='{% trans "Remove from selected stock items" %}'><span class='fas fa-minus-circle icon-red'></span> {% trans "Remove stock" %}</a></li>
|
||||
<li><a class='dropdown-item' href="#" id='multi-item-stocktake' title='{% trans "Stocktake selected stock items" %}'><span class='fas fa-check-circle icon-green'></span> {% trans "Count stock" %}</a></li>
|
||||
<li><a class='dropdown-item' href='#' id='multi-item-move' title='{% trans "Move selected stock items" %}'><span class='fas fa-exchange-alt icon-blue'></span> {% trans "Transfer stock" %}</a></li>
|
||||
<li><a class='dropdown-item' href='#' id='multi-item-merge' title='{% trans "Merge selected stock items" %}'><span class='fas fa-object-group'></span> {% trans "Merge stock" %}</a></li>
|
||||
<li><a class='dropdown-item' href='#' id='multi-item-order' title='{% trans "Order selected items" %}'><span class='fas fa-shopping-cart'></span> {% trans "Order stock" %}</a></li>
|
||||
<li><a class='dropdown-item' href='#' id='multi-item-assign' title='{% trans "Assign to customer" %}'><span class='fas fa-user-tie'></span> {% trans "Assign to customer" %}</a></li>
|
||||
<li><a class='dropdown-item' href='#' id='multi-item-set-status' title='{% trans "Change status" %}'><span class='fas fa-exclamation-circle'></span> {% trans "Change stock status" %}</a></li>
|
||||
{% endif %}
|
||||
{% if roles.stock.delete %}
|
||||
<li><a class='dropdown-item' href='#' id='multi-item-delete' title='{% trans "Delete selected items" %}'><span class='fas fa-trash-alt icon-red'></span> {% trans "Delete Stock" %}</a></li>
|
||||
<li><a class='dropdown-item' href='#' id='multi-item-delete' title='{% trans "Delete selected items" %}'><span class='fas fa-trash-alt icon-red'></span> {% trans "Delete stock" %}</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -2,7 +2,7 @@
|
||||
InvenTree-Version: {% inventree_version %}
|
||||
Django Version: {% django_version %}
|
||||
{% inventree_commit_hash as hash %}{% if hash %}Commit Hash: {{ hash }}{% endif %}
|
||||
{% inventree_commit_date as commit_date %}{% if commit_date %}Commit Date: {{ commit_date }}{% endif %}
|
||||
{% inventree_commit_date as commit_date %}{% if commit_date %}Commit Date: {% render_date commit_date %}{% endif %}
|
||||
Database: {% inventree_db_engine %}
|
||||
Debug-Mode: {% inventree_in_debug_mode %}
|
||||
Deployed using Docker: {% inventree_docker_mode %}
|
Reference in New Issue
Block a user