mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Refactor notes editing for "StockItem"
This commit is contained in:
parent
e1784c93b2
commit
df9c5c0048
@ -135,7 +135,7 @@
|
|||||||
<div class='panel panel-hidden' id='panel-part-notes'>
|
<div class='panel panel-hidden' id='panel-part-notes'>
|
||||||
<div class='panel-heading'>
|
<div class='panel-heading'>
|
||||||
<div class='d-flex flex-wrap'>
|
<div class='d-flex flex-wrap'>
|
||||||
<h4>{% trans "Notes" %}</h4>
|
<h4>{% trans "Part Notes" %}</h4>
|
||||||
{% include "spacer.html" %}
|
{% include "spacer.html" %}
|
||||||
<div class='btn-group' role='group'>
|
<div class='btn-group' role='group'>
|
||||||
{% include "notes_buttons.html" %}
|
{% include "notes_buttons.html" %}
|
||||||
@ -418,7 +418,7 @@
|
|||||||
'part-notes',
|
'part-notes',
|
||||||
'{% url "api-part-detail" part.pk %}',
|
'{% url "api-part-detail" part.pk %}',
|
||||||
{
|
{
|
||||||
editable: true,
|
editable: {% if roles.part.change %}true{% else %}false{% endif %},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -133,24 +133,16 @@
|
|||||||
|
|
||||||
<div class='panel panel-hidden' id='panel-notes'>
|
<div class='panel panel-hidden' id='panel-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 "Stock Item Notes" %}</h4>
|
||||||
<h4>{% trans "Stock Item 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 item.notes %}
|
<textarea id='stock-notes'></textarea>
|
||||||
{{ item.notes | markdownify }}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -235,18 +227,21 @@
|
|||||||
reload: true,
|
reload: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#edit-notes').click(function() {
|
onPanelLoad('notes', function() {
|
||||||
constructForm('{% url "api-stock-detail" item.pk %}', {
|
setupNotesField(
|
||||||
fields: {
|
'stock-notes',
|
||||||
notes: {
|
'{% url "api-stock-detail" item.pk %}',
|
||||||
multiline: true,
|
{
|
||||||
}
|
{% if roles.stock.change and user_owns_item %}
|
||||||
},
|
editable: true,
|
||||||
title: '{% trans "Edit Notes" %}',
|
{% else %}
|
||||||
reload: true,
|
editable: false,
|
||||||
});
|
{% endif %}
|
||||||
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
enableDragAndDrop(
|
enableDragAndDrop(
|
||||||
|
Loading…
Reference in New Issue
Block a user