diff --git a/inventory/templates/settings.html b/inventory/templates/settings.html
index 7b12ffa..3a4b565 100644
--- a/inventory/templates/settings.html
+++ b/inventory/templates/settings.html
@@ -175,6 +175,42 @@ dtlist.style.height = height;
dtlist.style.maxHeight = height;
dtlist.style.minHeight = height;
+document.querySelectorAll('.dt-target').forEach((el) => {
+ el.addEventListener('change', async (ev) => {
+ const num = ev.target.value;
+ const id = ev.target.parentElement.dataset.invId;
+
+ let res, data;
+ try {
+ const res = await fetch(`{{ url_for('crudkit.devicetype.rest_list') }}${id}`, {
+ method: 'PATCH',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json'
+ },
+ credentials: 'same-origin',
+ body: JSON.stringify({target: num})
+ });
+
+ const ct = res.headers.get('Content-Type') || '';
+ if (ct.includes('application/json')) {
+ data = await res.json();
+ }
+
+ if (res.status !== 200) {
+ const msg = data?.error || `Create failed (${res.status})`;
+ toastMessage(msg, 'danger');
+ return;
+ }
+ } catch (err) {
+ toastMessage('Network error setting target number', 'danger');
+ return;
+ }
+
+ toastMessage('Updated target number.', 'success');
+ });
+});
+
document.addEventListener('click', (ev) => {
const addButton = document.getElementById('add-devicetype');
const editButton = document.getElementById('edit-devicetype');