mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
Refactor notes for "purchase order"
This commit is contained in:
parent
df9c5c0048
commit
1c60d4e152
@ -181,24 +181,16 @@
|
|||||||
|
|
||||||
<div class='panel panel-hidden' id='panel-company-notes'>
|
<div class='panel panel-hidden' id='panel-company-notes'>
|
||||||
<div class='panel-heading'>
|
<div class='panel-heading'>
|
||||||
<div class='row'>
|
<div class='d-flex flex-wrap'>
|
||||||
<div class='col-sm-6'>
|
<h4>{% trans "Company Notes" %}</h4>
|
||||||
<h4>{% trans "Company Notes" %}</h4>
|
{% include "spacer.html" %}
|
||||||
</div>
|
<div class='btn-group' role='group'>
|
||||||
<div class='col-sm-6'>
|
{% include "notes_buttons.html" %}
|
||||||
<div class='btn-group float-right'>
|
|
||||||
<button type='button' id='edit-notes' title='{% trans "Edit Notes" %}' class='btn btn-small btn-outline-secondary'>
|
|
||||||
<span class='fas fa-edit'>
|
|
||||||
</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class='panel-content'>
|
<div class='panel-content'>
|
||||||
{% if company.notes %}
|
<textarea id='company-notes'></textarea>
|
||||||
{{ company.notes | markdownify }}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -207,16 +199,15 @@
|
|||||||
{% block js_ready %}
|
{% block js_ready %}
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
|
|
||||||
$('#edit-notes').click(function() {
|
onPanelLoad('company-notes', function() {
|
||||||
constructForm('{% url "api-company-detail" company.pk %}', {
|
|
||||||
fields: {
|
setupNotesField(
|
||||||
notes: {
|
'company-notes',
|
||||||
multiline: true,
|
'{% url "api-company-detail" company.pk %}',
|
||||||
}
|
{
|
||||||
},
|
editable: true,
|
||||||
title: '{% trans "Edit Notes" %}',
|
}
|
||||||
reload: true,
|
)
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
loadStockTable($("#assigned-stock-table"), {
|
loadStockTable($("#assigned-stock-table"), {
|
||||||
@ -230,18 +221,37 @@
|
|||||||
filterTarget: '#filter-list-customerstock',
|
filterTarget: '#filter-list-customerstock',
|
||||||
});
|
});
|
||||||
|
|
||||||
{% if company.is_customer %}
|
onPanelLoad('company-stock', function() {
|
||||||
loadSalesOrderTable("#sales-order-table", {
|
|
||||||
url: "{% url 'api-so-list' %}",
|
loadStockTable($('#stock-table'), {
|
||||||
params: {
|
url: "{% url 'api-stock-list' %}",
|
||||||
customer: {{ company.id }},
|
params: {
|
||||||
}
|
company: {{ company.id }},
|
||||||
|
part_detail: true,
|
||||||
|
supplier_part_detail: true,
|
||||||
|
location_detail: true,
|
||||||
|
},
|
||||||
|
buttons: [
|
||||||
|
'#stock-options',
|
||||||
|
],
|
||||||
|
filterKey: "companystock",
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#new-sales-order").click(function() {
|
{% if company.is_customer %}
|
||||||
|
onPanelLoad('panel-sales-orders', function() {
|
||||||
|
loadSalesOrderTable("#sales-order-table", {
|
||||||
|
url: "{% url 'api-so-list' %}",
|
||||||
|
params: {
|
||||||
|
customer: {{ company.id }},
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
createSalesOrder({
|
$("#new-sales-order").click(function() {
|
||||||
customer: {{ company.pk }},
|
|
||||||
|
createSalesOrder({
|
||||||
|
customer: {{ company.pk }},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -270,20 +280,6 @@
|
|||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
loadStockTable($('#stock-table'), {
|
|
||||||
url: "{% url 'api-stock-list' %}",
|
|
||||||
params: {
|
|
||||||
company: {{ company.id }},
|
|
||||||
part_detail: true,
|
|
||||||
supplier_part_detail: true,
|
|
||||||
location_detail: true,
|
|
||||||
},
|
|
||||||
buttons: [
|
|
||||||
'#stock-options',
|
|
||||||
],
|
|
||||||
filterKey: "companystock",
|
|
||||||
});
|
|
||||||
|
|
||||||
{% if company.is_manufacturer %}
|
{% if company.is_manufacturer %}
|
||||||
|
|
||||||
function reloadManufacturerPartTable() {
|
function reloadManufacturerPartTable() {
|
||||||
|
@ -71,24 +71,16 @@
|
|||||||
|
|
||||||
<div class='panel panel-hidden' id='panel-order-notes'>
|
<div class='panel panel-hidden' id='panel-order-notes'>
|
||||||
<div class='panel-heading'>
|
<div class='panel-heading'>
|
||||||
<div class='row'>
|
<div class='d-flex flex-wrap'>
|
||||||
<div class='col-sm-6'>
|
<h4>{% trans "Order Notes" %}</h4>
|
||||||
<h4>{% trans "Order Notes" %}</h4>
|
{% include "spacer.html" %}
|
||||||
</div>
|
<div class='btn-group' role='group'>
|
||||||
<div class='col-sm-6'>
|
{% include "notes_buttons.html" %}
|
||||||
<div class='btn-group float-right'>
|
|
||||||
<button type='button' id='edit-notes' title='{% trans "Edit Notes" %}' class='btn btn-outline-secondary'>
|
|
||||||
<span class='fas fa-edit'>
|
|
||||||
</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class='panel-content'>
|
<div class='panel-content'>
|
||||||
{% if order.notes %}
|
<textarea id='order-notes'></textarea>
|
||||||
{{ order.notes | markdownify }}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -98,16 +90,18 @@
|
|||||||
|
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
|
|
||||||
$('#edit-notes').click(function() {
|
onPanelLoad('order-notes', function() {
|
||||||
constructForm('{% url "api-po-detail" order.pk %}', {
|
setupNotesField(
|
||||||
fields: {
|
'order-notes',
|
||||||
notes: {
|
'{% url "api-po-detail" order.pk %}',
|
||||||
multiline: true,
|
{
|
||||||
}
|
{% if roles.purchase_order.change %}
|
||||||
},
|
editable: true,
|
||||||
title: '{% trans "Edit Notes" %}',
|
{% else %}
|
||||||
reload: true,
|
editable: false,
|
||||||
});
|
{% endif %}
|
||||||
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
enableDragAndDrop(
|
enableDragAndDrop(
|
||||||
|
@ -239,7 +239,7 @@ function setupNotesField(element, url, options={}) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var toolbar_icons = [
|
var toolbar_icons = [
|
||||||
'preview',
|
'preview', '|',
|
||||||
];
|
];
|
||||||
|
|
||||||
if (editable) {
|
if (editable) {
|
||||||
@ -267,13 +267,13 @@ function setupNotesField(element, url, options={}) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// Hide the toolbar
|
||||||
|
$(`#${element}`).next('.EasyMDEContainer').find('.editor-toolbar').hide();
|
||||||
|
|
||||||
if (!editable) {
|
if (!editable) {
|
||||||
// Set readonly
|
// Set readonly
|
||||||
mde.codemirror.setOption('readOnly', true);
|
mde.codemirror.setOption('readOnly', true);
|
||||||
|
|
||||||
// Hide the toolbar
|
|
||||||
$(`#${element}`).next('.EasyMDEContainer').find('.editor-toolbar').hide();
|
|
||||||
|
|
||||||
// Hide the "edit" and "save" buttons
|
// Hide the "edit" and "save" buttons
|
||||||
$('#edit-notes').hide();
|
$('#edit-notes').hide();
|
||||||
$('#save-notes').hide();
|
$('#save-notes').hide();
|
||||||
@ -286,6 +286,9 @@ function setupNotesField(element, url, options={}) {
|
|||||||
$('#edit-notes').hide();
|
$('#edit-notes').hide();
|
||||||
$('#save-notes').show();
|
$('#save-notes').show();
|
||||||
|
|
||||||
|
// Show the toolbar
|
||||||
|
$(`#${element}`).next('.EasyMDEContainer').find('.editor-toolbar').show();
|
||||||
|
|
||||||
mde.togglePreview();
|
mde.togglePreview();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user