<div class="mx-5" id="partition-warning" style="display:none; color:red; font-weight: bold;">
    {{ _('Warning: You have selected a partition from a disk other than 1. This will be considered for storage only.') }}
</div>

<script>
function checkPartition() {
    var partitionSelect = document.getElementById('{{ partition_field_id }}');
    var selectedValue = partitionSelect.value;
    var warningDiv = document.getElementById('partition-warning');

    // Extract the disk_id
    var diskId = parseInt(selectedValue.split(' ')[0]);

    if (diskId !== 1) {
        warningDiv.style.display = 'block';
    } else {
        warningDiv.style.display = 'none';
    }
}

document.addEventListener("DOMContentLoaded", function () {
    var partitionSelect = document.getElementById('{{ partition_field_id }}');
    if (partitionSelect) {
        partitionSelect.addEventListener('change', checkPartition);
        checkPartition();
    } else {
        console.error("Element with ID '{{ partition_field_id }}' not found.");
    }
});
</script>