Add worklog form fields and enhance templates for better data handling
- Introduced worklog form fields for start and end timestamps, contact, work item, completion status, follow-up, analysis, and notes. - Updated worklog.html to include a save button and improved layout. - Enhanced datalist.js for dynamic data binding between input fields and datalists. - Refactored inventory.html and user.html for consistency and readability. - Added form.html template for future use.
This commit is contained in:
parent
189f73b7c2
commit
795b23fbae
8 changed files with 265 additions and 172 deletions
20
static/js/datalist.js
Normal file
20
static/js/datalist.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
document.querySelectorAll('[data-datalist-bind]').forEach(input => {
|
||||
const datalistSelector = input.dataset.datalistBind;
|
||||
const hiddenSelector = input.dataset.hiddenTarget;
|
||||
const datalist = document.querySelector(datalistSelector);
|
||||
const hidden = document.querySelector(hiddenSelector);
|
||||
|
||||
if (!datalist || !hidden) return;
|
||||
|
||||
input.addEventListener('input', function () {
|
||||
const value = this.value;
|
||||
const options = datalist.querySelectorAll('option');
|
||||
let foundId = '';
|
||||
options.forEach(option => {
|
||||
if (option.value === value) {
|
||||
foundId = option.dataset.id || '';
|
||||
}
|
||||
});
|
||||
hidden.value = foundId;
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue