2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-05-02 13:28:49 +00:00
InvenTree/InvenTree/templates/status_codes.html
Oliver 327ecf2156
Implement a generic API endpoint for enumeration of status codes (#4543)
* Implement a generic API endpoint for enumeration of status codes

* Adds endpoint for PurchaseOrderStatus

* Add more endpoints (sales order / return orer)

* Add endpoints for StockStatus and StockTrackingCode

* Support build status

* Use the attribute name as the dict key

* Refactored status codes in javascript

- Now accessible by "name" (instead of integer key)
- Will make javascript code much more readable

* Bump API version
2023-03-31 07:27:24 +11:00

24 lines
595 B
HTML

{% load report %}
/*
* Status codes for the {{ label }} model.
* Generated from the values specified in "status_codes.py"
*/
const {{ label }}Codes = {
{% for entry in data %}
'{{ entry.name }}': {
key: {{ entry.key }},
value: '{{ entry.label }}',{% if entry.color %}
label: 'bg-{{ entry.color }}',{% endif %}
},
{% endfor %}
};
/*
* Render the status for a {{ label }} object.
* Uses the values specified in "status_codes.py"
*/
function {{ label }}StatusDisplay(key, options={}) {
return renderStatusLabel(key, {{ label }}Codes, options);
}