fix: round edit values — margin shows whole number, prices show 2 decimals

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-04-01 11:44:10 -04:00
parent 4941df8131
commit 3de513fb7b

View File

@@ -545,7 +545,13 @@ export class ProductMapping extends Component {
startEdit(mapId, field, currentValue) { startEdit(mapId, field, currentValue) {
this.state.editingCell = { mapId, field }; this.state.editingCell = { mapId, field };
this.state.editValue = currentValue !== null && currentValue !== undefined ? String(currentValue) : ''; let val = currentValue !== null && currentValue !== undefined ? currentValue : '';
if (val !== '' && field === 'margin') {
val = String(Math.round(parseFloat(val)));
} else if (val !== '') {
val = String(parseFloat(parseFloat(val).toFixed(2)));
}
this.state.editValue = val;
// Focus the input after OWL re-renders // Focus the input after OWL re-renders
setTimeout(() => { setTimeout(() => {
const input = document.querySelector('.woo-edit-input'); const input = document.querySelector('.woo-edit-input');