|
38 | 38 | <div class="modal-dialog" role="document">
|
39 | 39 | <div class="modal-content">
|
40 | 40 | <div class="modal-header">
|
41 |
| - <h5 class="modal-title" id="bulkEditModalLabel">Bulk Edit Devices</h5> |
| 41 | + <h5 class="modal-title" id="bulkEditModalLabel">Bulk Edit Devices - <span id="bulk-edit-field-name"></span></h5> |
42 | 42 | <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
43 | 43 | <span aria-hidden="true">×</span>
|
44 | 44 | </button>
|
|
54 | 54 | </div>
|
55 | 55 | <div id="alert-container" class="alert alert-warning hidden" role="alert"></div>
|
56 | 56 | <div class="form-group">
|
57 |
| - <label for="custom-field-value">Custom Field Value</label> |
| 57 | + <label for="custom-field-value">Value for <strong id="bulk-edit-field-name-label"></strong></label> |
58 | 58 | <input type="text" class="form-control" id="blkeddit-custom-field-value" name="custom_field_value" placeholder="Enter value">
|
59 | 59 | </div>
|
60 | 60 | <input type="hidden" id="blkedit_custom_field_id" name=" custom_field_id" value="{{ $customfield->id }}">
|
|
297 | 297 | let selectDevices = $('#bulk-edit-select-devices');
|
298 | 298 | selectDevices.empty();
|
299 | 299 |
|
300 |
| - let inputField = $('#blkedit-custom-field-value'); |
| 300 | + let inputField = $('#blkeddit-custom-field-value'); |
301 | 301 | inputField.val('');
|
302 | 302 |
|
| 303 | + // Always hide the alert container when opening the modal |
| 304 | + $('#alert-container').addClass('hidden').empty(); |
| 305 | +
|
| 306 | + let fieldName = $('#custom_field_id option:selected').text(); |
| 307 | + $('#bulk-edit-field-name').text(fieldName); |
| 308 | + $('#bulk-edit-field-name-label').text(fieldName); |
| 309 | +
|
303 | 310 | let selectedRowIds = grid.bootgrid("getSelectedRows");
|
304 | 311 | let multipleValuesWarning = 'Warning: Multiple different values selected. This will override all selected devices with this value.';
|
305 | 312 |
|
|
312 | 319 | inputField.attr('placeholder', '');
|
313 | 320 | } else {
|
314 | 321 | inputField.val('');
|
| 322 | + inputField.attr('placeholder', 'Enter new value that will replace all existing values'); |
315 | 323 | $('#alert-container').text(multipleValuesWarning).removeClass('hidden');
|
316 | 324 | }
|
317 | 325 |
|
|
325 | 333 | $('#device_ids').val(selectedRows.map(row => row.device_id).join(","));
|
326 | 334 | }
|
327 | 335 |
|
328 |
| - $('#blkedit-custom-field-value').focus(); |
| 336 | + $('#blkeddit-custom-field-value').focus(); |
329 | 337 | // set the blkedit_custom_field_id to the value of custom_field_id
|
330 | 338 | $('#blkedit_custom_field_id').val($("#custom_field_id").val());
|
331 | 339 | });
|
|
0 commit comments