Compare commits

..

1 Commits

3 changed files with 18 additions and 50 deletions
+3 -4
View File
@@ -4,10 +4,9 @@
### Bug Fixes
- **Fixed purchase date, price, and notes not being saved when adding an individual minifigure** (Issue #151, branch `bugfix/issue-151`): Filling in purchase date, price, or notes before clicking Add had no effect, only purchase location was saved
- `BrickMinifigureSocket` was missing references to `#add-purchase-date`, `#add-purchase-price`, and `#add-description`, so those fields were never read or included in the socket emit
- The backend already supported all three fields. This was just a frontend error
- **Fixed deleting a wish with an owner assigned** (Issue #152): Resolved foreign key constraint error when removing a set from the wishlist that had an owner assigned
- **Fixed "Reset to Defaults" blanking all settings instead of restoring them** (Issue #149a, branch `bugfix/issue-149a`): "Reset to Defaults" was clearing all fields to empty/false instead of populating them with their actual default values
- `resetToDefaults()` now reads from `window.DEFAULT_CONFIG` and restores each field to its proper default, matching the same logic used on initial page load
- **Fixed deleting a wish with an owner assigned** (Issue #152, branch `bugfix/issue-152`): Resolved foreign key constraint error when removing a set from the wishlist that had an owner assigned
- Wish owners are now deleted before the wish itself, respecting the FK constraint
## 1.4
+14 -11
View File
@@ -285,18 +285,21 @@ function saveLiveConfiguration() {
function resetToDefaults() {
console.log('Resetting to defaults');
// Reset all form inputs
document.querySelectorAll('.config-toggle, .config-number, .config-text').forEach(input => {
if (input.type === 'checkbox') {
input.checked = false;
} else {
input.value = '';
}
});
Object.keys(window.DEFAULT_CONFIG).forEach(varName => {
const defaultValue = window.DEFAULT_CONFIG[varName];
// Update badges
Object.keys(window.CURRENT_CONFIG).forEach(varName => {
updateConfigBadge(varName, null);
const toggle = document.getElementById(varName);
if (toggle && toggle.type === 'checkbox') {
toggle.checked = defaultValue === true;
}
document.querySelectorAll(`input[data-var="${varName}"]:not(.config-static)`).forEach(input => {
if (input.type !== 'checkbox') {
input.value = defaultValue !== null && defaultValue !== undefined ? defaultValue : '';
}
});
updateConfigBadge(varName, defaultValue);
});
// Show status message
+1 -35
View File
@@ -13,12 +13,9 @@ class BrickMinifigureSocket extends BrickSocket {
this.html_input = document.getElementById(`${id}-set`);
this.html_no_confim = document.getElementById(`${id}-no-confirm`);
this.html_owners = document.getElementById(`${id}-owners`);
this.html_purchase_date = document.getElementById(`${id}-purchase-date`);
this.html_purchase_price = document.getElementById(`${id}-purchase-price`);
this.html_purchase_location = document.getElementById(`${id}-purchase-location`);
this.html_storage = document.getElementById(`${id}-storage`);
this.html_tags = document.getElementById(`${id}-tags`);
this.html_description = document.getElementById(`${id}-description`);
// Card elements
this.html_card = document.getElementById(`${id}-card`);
@@ -101,28 +98,12 @@ class BrickMinifigureSocket extends BrickSocket {
});
}
// Grab the purchase info
let purchase_date = null;
if (this.html_purchase_date) {
purchase_date = this.html_purchase_date.value || null;
}
let purchase_price = null;
if (this.html_purchase_price) {
purchase_price = this.html_purchase_price.value || null;
}
// Grab the purchase location
let purchase_location = null;
if (this.html_purchase_location) {
purchase_location = this.html_purchase_location.value;
}
// Grab the description (notes)
let description = '';
if (this.html_description) {
description = this.html_description.value || '';
}
// Grab the storage
let storage = null;
if (this.html_storage) {
@@ -148,12 +129,9 @@ class BrickMinifigureSocket extends BrickSocket {
this.socket.emit(this.messages.IMPORT_MINIFIGURE, {
figure: (figure !== undefined) ? figure : this.html_input.value,
owners: owners,
purchase_date: purchase_date,
purchase_price: purchase_price,
purchase_location: purchase_location,
storage: storage,
tags: tags,
description: description,
quantity: 1
});
} else {
@@ -257,22 +235,10 @@ class BrickMinifigureSocket extends BrickSocket {
this.html_owners.querySelectorAll('input').forEach(input => input.disabled = !enabled);
}
if (this.html_purchase_date) {
this.html_purchase_date.disabled = !enabled;
}
if (this.html_purchase_price) {
this.html_purchase_price.disabled = !enabled;
}
if (this.html_purchase_location) {
this.html_purchase_location.disabled = !enabled;
}
if (this.html_description) {
this.html_description.disabled = !enabled;
}
if (this.html_storage) {
this.html_storage.disabled = !enabled;
}