u
This commit is contained in:
@@ -147,7 +147,14 @@ export default class ArticleViewBrand extends Component {
|
||||
isDirty={brandDraftDirty}
|
||||
canSave={brandDraftValid}
|
||||
display={<PanelValue>{value.name || null}</PanelValue>}
|
||||
edit={<BrandEdit brands={brands} />}
|
||||
edit={({ draft, onChange, inputRef }) => (
|
||||
<BrandEdit
|
||||
brands={brands}
|
||||
draft={draft}
|
||||
onChange={onChange}
|
||||
inputRef={inputRef}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -112,7 +112,9 @@ export default class ArticleViewEANs extends Component {
|
||||
isDirty={eansDraftDirty}
|
||||
canSave={eansDraftValid}
|
||||
display={<EansDisplay sku={articleData.sku} eans={value.eans} />}
|
||||
edit={<EansEdit />}
|
||||
edit={({ draft, onChange, inputRef }) => (
|
||||
<EansEdit draft={draft} onChange={onChange} inputRef={inputRef} />
|
||||
)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -179,24 +179,20 @@ class NameDisplay extends Component {
|
||||
|
||||
class NameEdit extends Component {
|
||||
render() {
|
||||
const { draft, onChange, inputRef, name, categoryIds } = this.props;
|
||||
const currentName = draft?.name ?? name;
|
||||
const currentCategoryIds = draft?.categoryIds ?? categoryIds;
|
||||
const { name, categoryIds } = this.props;
|
||||
return (
|
||||
<Box sx={columnSx}>
|
||||
<Box sx={{ flex: 1, display: 'flex', alignItems: 'center' }}>
|
||||
<SingleLineTextEdit
|
||||
inputRef={inputRef}
|
||||
label="Name"
|
||||
value={currentName}
|
||||
onChange={(nextName) => onChange({ ...draft, name: nextName })}
|
||||
value={name}
|
||||
onChange={() => {}}
|
||||
sx={articleNameFieldSx}
|
||||
/>
|
||||
</Box>
|
||||
<CategoryPills
|
||||
categoryIds={currentCategoryIds}
|
||||
categoryIds={categoryIds}
|
||||
editMode
|
||||
onCategoryIdsChange={(nextIds) => onChange({ ...draft, categoryIds: nextIds })}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
@@ -217,6 +213,7 @@ export default class ArticleViewName extends Component {
|
||||
let article = null;
|
||||
|
||||
if (nameChanged) {
|
||||
console.log('nameChanged', name, articleData.name);
|
||||
const nameRes = await store.article.update(articleData.sku, { name });
|
||||
article = nameRes.article;
|
||||
}
|
||||
@@ -248,12 +245,16 @@ export default class ArticleViewName extends Component {
|
||||
<NameDisplay
|
||||
name={value.name}
|
||||
categoryIds={value.categoryIds}
|
||||
|
||||
/>
|
||||
}
|
||||
edit={
|
||||
<NameEdit
|
||||
name={value.name}
|
||||
categoryIds={value.categoryIds}
|
||||
onNameChange={() => {}}
|
||||
onCategoryIdsChange={() => {}}
|
||||
onIsDirtyChange={() => {}}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -512,13 +512,16 @@ export default class ArticleViewPrice extends Component {
|
||||
onSave={this.handleSave}
|
||||
isDirty={priceDraftDirty}
|
||||
canSave={priceDraftValid}
|
||||
overlay={
|
||||
overlay={({ editing, draft, onChange }) => (
|
||||
<PriceOverlay
|
||||
editing={editing}
|
||||
draft={draft}
|
||||
onChange={onChange}
|
||||
unitOptions={unitOptions}
|
||||
articleUnitSi={articleData.unit?.si}
|
||||
onOpenEditor={this.openUnitEditor}
|
||||
/>
|
||||
}
|
||||
)}
|
||||
display={
|
||||
<PriceDisplay
|
||||
saved={priceValue}
|
||||
@@ -527,8 +530,11 @@ export default class ArticleViewPrice extends Component {
|
||||
displaySymbol={displaySymbol}
|
||||
/>
|
||||
}
|
||||
edit={
|
||||
edit={({ draft, onChange, inputRef }) => (
|
||||
<PriceEdit
|
||||
draft={draft}
|
||||
onChange={onChange}
|
||||
inputRef={inputRef}
|
||||
taxRates={taxRates}
|
||||
unitOptions={unitOptions}
|
||||
displaySymbol={displaySymbol}
|
||||
@@ -540,7 +546,7 @@ export default class ArticleViewPrice extends Component {
|
||||
onUnitUpserted={this.refreshUnits}
|
||||
onUnitDeleted={this.refreshUnits}
|
||||
/>
|
||||
}
|
||||
)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user