Skip to content

Commit

Permalink
First draft to choose a color for a sale
Browse files Browse the repository at this point in the history
  • Loading branch information
heymanpi committed Dec 14, 2020
1 parent 47d1d79 commit a5ecf54
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
10 changes: 9 additions & 1 deletion src/components/common/FieldGenerator.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
} from '@material-ui/core';
import { KeyboardDateTimePicker } from '@material-ui/pickers';
// import CheckInput from './CheckInput';

import { SketchPicker } from 'react-color';
class FieldGenerator {

// TODO Finish error texts
Expand Down Expand Up @@ -142,6 +142,14 @@ class FieldGenerator {
</Select>
</FormControl>
)

color = (key, label, props = {}) => (
//console.log(props)
<SketchPicker
color={this.getValue(key, props) || ''}
onChangeComplete={this.onChange}
/>
)
}

export default FieldGenerator;
6 changes: 6 additions & 0 deletions src/pages/admin/SaleEditor/DetailsEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ export default function DetailsEditor({ disabled, editing, isCreator, ...props }
{Field.text('id', 'ID', onlyCreate)}
{Field.select('association', 'Association', props.assos, onlyCreate)}
{Field.text('description', 'Description', { required: true, multiline: true, rows: 4 })}

{/*
{Field.color('color', 'QCouleuuur')}
*/}


</Grid>

<Grid item xs sm={6} className={mergeClasses(classes, 'column', 'controls')}>
Expand Down
1 change: 1 addition & 0 deletions src/pages/admin/SaleEditor/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class SaleEditor extends React.Component {
association,
begin_at: new Date(),
end_at: new Date(),
color: ""
},
items: {},
itemgroups: {},
Expand Down
22 changes: 11 additions & 11 deletions src/pages/public/SaleDetail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,17 @@ class SaleDetail extends React.Component {
</span>
</Alert>
)}

<Box clone my={2}>
<Paper>
<ItemsTable
disabled={this.areItemsDisabled()}
items={this.props.items}
quantities={this.state.quantities}
onQuantityChange={this.handleQuantityChange}
/>
</Paper>
</Box>
{saleState === 'ONGOING' && (
<React.Fragment>
<FormControlLabel
Expand Down Expand Up @@ -303,17 +314,6 @@ class SaleDetail extends React.Component {
</React.Fragment>
)}

<Box clone my={2}>
<Paper>
<ItemsTable
disabled={this.areItemsDisabled()}
items={this.props.items}
quantities={this.state.quantities}
onQuantityChange={this.handleQuantityChange}
/>
</Paper>
</Box>

{saleState === 'NOT_BEGUN' ? (

<Box style={{width: '100%'}}>
Expand Down

0 comments on commit a5ecf54

Please sign in to comment.