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:
@@ -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');
|
||||||
|
|||||||
Reference in New Issue
Block a user