fix(07-01): fix job type dropdown not pre-populating on edit

Improved JavaScript to use case-insensitive matching for select fields, so 'vollzeit' matches 'Vollzeit'. Also normalized all job_type values to lowercase when saving to ensure consistency.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-17 21:27:49 +09:00
parent 9142b56a9f
commit 0c9ebb9e89
2 changed files with 19 additions and 2 deletions

View File

@@ -98,13 +98,30 @@ if ( $is_edit_mode ) {
if (field.length) {
if (field.is('select')) {
field.val(value).trigger('change');
// For select fields, try case-insensitive matching
var options = field.find('option');
var matched = false;
options.each(function() {
if ($(this).val().toLowerCase() === value.toLowerCase()) {
field.val($(this).val()).trigger('change');
matched = true;
console.log('Matched select option:', $(this).val(), 'for value:', value);
return false; // break
}
});
if (!matched) {
console.warn('No matching option found for field', fieldId, 'value:', value, 'Available options:', options.map(function() { return $(this).val(); }).get());
}
} else if (field.is(':checkbox') || field.is(':radio')) {
field.filter('[value="' + value + '"]').prop('checked', true);
} else {
field.val(value);
}
console.log('Populated field ' + fieldId + ' with:', value);
} else {
console.warn('Field not found:', fieldId);
}
});
}, 500);