diff --git a/django/templates/label_edit.html b/django/templates/label_edit.html
index 8a6e060..5830f6f 100644
--- a/django/templates/label_edit.html
+++ b/django/templates/label_edit.html
@@ -5,43 +5,12 @@
{% load backgroundtask_tags %}
{% load attachments_tags %}
-{% block title %}{{ object.type }} {{Â object.ref }}{% endblock %}
-
-
-{% comment %}{% endcomment %}
+{% block title %}{{ object.type }} {{ object.ref }}{% endblock %}
{% block content %}
{% get_attachments_for object.get_label_attachment as my_attachments %}
-
{% endif %}
-{% comment %}
-{% is_label_id_in_queue object.id as is_in_queue %}
- {% if is_in_queue %}
-
-
- Output in queue! This output is currently in the processing queue. It will be checked shortly.
-
-{% else %}
- {% if object.type == "output" %}
- {% switch output.get_spent_status %}
- {% case "spent" %}
-
- Output spent! Blockchain records indicate that this output has been spent in another transaction.
-
- {% case "unspent" %}
-
- Output unspent! Blockchain records indicate that this output has not been spent yet.
-
- {% case "unconfirmed" %}
-
-
-
- Actions
-
-
-
-
Output unconfirmed! Blockchain records indicate that this output has not been confirmed yet.
-
- {% endswitch %}
- {% endif %}
-{% endif %}
-{% endcomment %}
-
{% is_label_id_in_queue object.id as is_in_queue %}
{% if is_in_queue %}
@@ -204,32 +128,11 @@
{% endif %}
{% endif %}
-
-
-{% comment %}
-{% if object.type == "addr" %}
-
- Heads up! There are multiple transaction outputs sent to this address. For privacy reasons, do not reuse addresses.
-
-{% endif %}
-{% endcomment %}
-
{% block label_edit_content %}
{% endblock %}
-
-
-
-
-
-
-
-
-
+
+
+// Validate fmv field (JSON object with currency codes)
+const fmvField = document.getElementById('id_fmv');
+if (fmvField) {
+ fmvField.addEventListener('blur', function() {
+ try {
+ if (this.value && this.value.trim()) {
+ const parsed = JSON.parse(this.value);
+ if (typeof parsed !== 'object' || Array.isArray(parsed)) {
+ alert('FMV must be a JSON object like {"USD": 1233.45}');
+ return;
+ }
+ // Validate values are numeric (accept both numbers and numeric strings)
+ for (const [key, value] of Object.entries(parsed)) {
+ // Check if it's a number OR a numeric string
+ const isNumeric = typeof value === 'number' ||
+ (typeof value === 'string' && !isNaN(parseFloat(value)) && isFinite(value));
+ if (!isNumeric) {
+ alert(`FMV value for ${key} must be numeric (got: ${typeof value})`);
+ return;
+ }
+ }
+ }
+ } catch (e) {
+ alert('Invalid JSON format for fmv field');
+ }
+ });
+}
+// Validate rate field (JSON object with currency codes)
+const rateField = document.getElementById('id_rate');
+if (rateField) {
+ rateField.addEventListener('blur', function() {
+ try {
+ if (this.value && this.value.trim()) {
+ const parsed = JSON.parse(this.value);
+ if (typeof parsed !== 'object' || Array.isArray(parsed)) {
+ alert('Rate must be a JSON object like {"USD": 105620.00}');
+ return;
+ }
+ // Validate values are numeric (accept both numbers and numeric strings)
+ for (const [key, value] of Object.entries(parsed)) {
+ // Check if it's a number OR a numeric string
+ const isNumeric = typeof value === 'number' ||
+ (typeof value === 'string' && !isNaN(parseFloat(value)) && isFinite(value));
+ if (!isNumeric) {
+ alert(`Rate value for ${key} must be numeric (got: ${typeof value})`);
+ return;
+ }
+ }
+ }
+ } catch (e) {
+ alert('Invalid JSON format for rate field');
+ }
+ });
+}
+
+// Validate heights field (JSON array of integers)
+const heightsField = document.getElementById('id_heights');
+if (heightsField) {
+ heightsField.addEventListener('blur', function() {
+ try {
+ if (this.value && this.value.trim()) {
+ const parsed = JSON.parse(this.value);
+ if (!Array.isArray(parsed)) {
+ alert('Heights must be a JSON array like [123456, 789012]');
+ return;
+ }
+ // Validate all values are integers
+ for (const height of parsed) {
+ if (!Number.isInteger(height)) {
+ alert('All heights must be integers');
+ return;
+ }
+ }
+ }
+ } catch (e) {
+ alert('Invalid JSON format for heights field');
+ }
+ });
+}
+
+// Validate integer fields (height, fee, value)
+const integerFields = ['id_height', 'id_fee', 'id_value'];
+integerFields.forEach(fieldId => {
+ const field = document.getElementById(fieldId);
+ if (field) {
+ field.addEventListener('blur', function() {
+ if (this.value && this.value.trim()) {
+ if (!/^-?\d+$/.test(this.value.trim())) {
+ alert(`${fieldId.replace('id_', '')} must be an integer`);
+ }
+ }
+ });
+ }
+});
+
+{% endaddtoblock %}
+
{% endblock %}
diff --git a/django/templates/labelbase.html b/django/templates/labelbase.html
index 5b4ba2e..d893b5b 100644
--- a/django/templates/labelbase.html
+++ b/django/templates/labelbase.html
@@ -23,6 +23,31 @@