Commit 340845da authored by Piyaphorn Arphornsri's avatar Piyaphorn Arphornsri

add

parent 7fff7e5b
...@@ -37,7 +37,7 @@ class AppHeader extends Component { ...@@ -37,7 +37,7 @@ class AppHeader extends Component {
Link Link
href="/" href="/"
> >
B Beauty <img src={require('../../image/icon.png') }></img>
</IconButton> </IconButton>
<Typography variant="h6" className={classes.title}></Typography> <Typography variant="h6" className={classes.title}></Typography>
<Button color="inherit" Link href="/LoginPage"> <Button color="inherit" Link href="/LoginPage">
......
...@@ -97,7 +97,7 @@ class ResponsiveDrawer extends Component { ...@@ -97,7 +97,7 @@ class ResponsiveDrawer extends Component {
href="/" href="/"
style={{ color: "white" }} style={{ color: "white" }}
> >
B Beauty <img src={require('../../../image/icon.png') }></img>
</IconButton> </IconButton>
</div> </div>
......
import React, { Component } from "react"; import React, { Component } from "react";
import { withStyles, makeStyles } from "@material-ui/core/styles"; import { withStyles } from "@material-ui/core/styles";
import { import {
Dialog, Dialog,
Button, Button,
...@@ -20,14 +20,7 @@ import { format } from "date-fns"; ...@@ -20,14 +20,7 @@ import { format } from "date-fns";
import { MenuIcon } from "@material-ui/icons/Menu"; import { MenuIcon } from "@material-ui/icons/Menu";
import Fab from "@material-ui/core/Fab"; import Fab from "@material-ui/core/Fab";
import AddIcon from "@material-ui/icons/Add"; import AddIcon from "@material-ui/icons/Add";
import Table from "@material-ui/core/Table";
import TableBody from "@material-ui/core/TableBody";
import TableCell from "@material-ui/core/TableCell";
import TableContainer from "@material-ui/core/TableContainer";
import TableHead from "@material-ui/core/TableHead";
import TableRow from "@material-ui/core/TableRow";
import DeleteIcon from "@material-ui/icons/Delete";
import EditIcon from "@material-ui/icons/Edit";
import Input from "@material-ui/core/Input"; import Input from "@material-ui/core/Input";
import InputLabel from "@material-ui/core/InputLabel"; import InputLabel from "@material-ui/core/InputLabel";
import InputAdornment from "@material-ui/core/InputAdornment"; import InputAdornment from "@material-ui/core/InputAdornment";
...@@ -44,6 +37,8 @@ import BusinessIcon from "@material-ui/icons/Business"; ...@@ -44,6 +37,8 @@ import BusinessIcon from "@material-ui/icons/Business";
import MaterialTable from "material-table"; import MaterialTable from "material-table";
import axios from "axios";
const styles = theme => ({ const styles = theme => ({
root: { root: {
height: 150, height: 150,
...@@ -65,42 +60,7 @@ const styles = theme => ({ ...@@ -65,42 +60,7 @@ const styles = theme => ({
position: "absolute", position: "absolute",
bottom: theme.spacing(2), bottom: theme.spacing(2),
right: theme.spacing(2) right: theme.spacing(2)
}
});
const StyledTableCell = withStyles(theme => ({
head: {
backgroundColor: theme.palette.common.black,
color: theme.palette.common.white
}, },
body: {
fontSize: 14
}
}))(TableCell);
const StyledTableRow = withStyles(theme => ({
root: {
"&:nth-of-type(odd)": {
backgroundColor: theme.palette.background.default
}
}
}))(TableRow);
function createData(name, email, address, phonenumber, edit, action) {
return { name, email, address, phonenumber, edit, action };
}
const rows = [
createData(
"Frozen yoghurt",
"email@mmmj",
"ที่อยู่ 120/255 มหาวิทยาลัยุบลราชธานี ",
" 012455887",
<EditIcon />,
<DeleteIcon />
)
];
const useStyles = makeStyles({
table: { table: {
minWidth: 700 minWidth: 700
} }
...@@ -127,7 +87,24 @@ class Databeautician extends Component { ...@@ -127,7 +87,24 @@ class Databeautician extends Component {
birthYear: 2017, birthYear: 2017,
birthCity: 34 birthCity: 34
} }
] ],
name: "",
email: "",
password: "",
password2: "",
address: "",
tel: "",
image: "",
rolr: ""
};
handleChange = event => {
console.log("name : ", event.target.name);
console.log("value : ", event.target.value);
this.setState({
[event.target.name]: event.target.value
});
}; };
handleClickOpen = () => { handleClickOpen = () => {
this.setState({ this.setState({
...@@ -140,7 +117,7 @@ class Databeautician extends Component { ...@@ -140,7 +117,7 @@ class Databeautician extends Component {
}); });
}; };
handleCloseAndSave = () => { handleCloseAndSave = () => {
//Save to db
this.setState(prevState => { this.setState(prevState => {
const data = [...prevState.data]; const data = [...prevState.data];
...@@ -167,7 +144,19 @@ class Databeautician extends Component { ...@@ -167,7 +144,19 @@ class Databeautician extends Component {
render() { render() {
const { classes } = this.props; const { classes } = this.props;
const { open, columns, data } = this.state; const {
open,
columns,
data,
name,
email,
password,
password2,
address,
tel,
image,
role
} = this.state;
return ( return (
<div> <div>
<MaterialTable <MaterialTable
...@@ -178,17 +167,17 @@ class Databeautician extends Component { ...@@ -178,17 +167,17 @@ class Databeautician extends Component {
selection: false selection: false
}} }}
editable={{ editable={{
// onRowAdd: newData => // onRowAdd: newData =>
// new Promise(resolve => { // new Promise(resolve => {
// setTimeout(() => { // setTimeout(() => {
// resolve(); // resolve();
// this.setState(prevState => { // this.setState(prevState => {
// const data = [...prevState.data]; // const data = [...prevState.data];
// data.push(newData); // data.push(newData);
// return { ...prevState, data }; // return { ...prevState, data };
// }); // });
// }, 600); // }, 600);
// }), // }),
onRowUpdate: (newData, oldData) => onRowUpdate: (newData, oldData) =>
new Promise(resolve => { new Promise(resolve => {
setTimeout(() => { setTimeout(() => {
...@@ -233,120 +222,179 @@ class Databeautician extends Component { ...@@ -233,120 +222,179 @@ class Databeautician extends Component {
> >
<DialogTitle id="alert-dialog-title">{"ลงทะเบียนช่าง"}</DialogTitle> <DialogTitle id="alert-dialog-title">{"ลงทะเบียนช่าง"}</DialogTitle>
<DialogContent> <DialogContent>
<TextField <div>
className={classes.margin} <TextField
id="outlined-uncontrolled" className={classes.margin}
label="ชื่อ-สกุล" id="name"
variant="outlined" name="name"
InputProps={{ value={name}
startAdornment: ( label="ชื่อ-สกุล"
<InputAdornment position="start"> variant="outlined"
<AccountCircle /> InputProps={{
</InputAdornment> startAdornment: (
) <InputAdornment position="start">
}} <AccountCircle />
/> </InputAdornment>
<br /> <br /> )
<TextField }}
className={classes.margin} onChange={this.handleChange}
id="outlined-uncontrolled" />
label="E_mail" </div>
variant="outlined" <br></br>
InputProps={{ <div>
startAdornment: ( <TextField
<InputAdornment position="start"> className={classes.margin}
<MailOutlineIcon /> id="email"
</InputAdornment> name="email"
) value={email}
}} label="E_mail"
/> variant="outlined"
<br /> <br /> InputProps={{
<TextField startAdornment: (
className={classes.margin} <InputAdornment position="start">
id="outlined-password-input" <MailOutlineIcon />
label="Password" </InputAdornment>
type="password" )
autoComplete="current-password" }}
variant="outlined" onChange={this.handleChange}
InputProps={{ />
startAdornment: ( </div>
<InputAdornment position="start"> <br></br>
<VpnKeyIcon /> <div>
</InputAdornment> <TextField
) className={classes.margin}
}} id="password"
/> name="password"
<br /> <br /> value={password}
<TextField label="Password"
className={classes.margin} type="password"
id="outlined-password-input" autoComplete="current-password"
label="Confirm-Password" variant="outlined"
type="password" InputProps={{
autoComplete="current-password" startAdornment: (
variant="outlined" <InputAdornment position="start">
InputProps={{ <VpnKeyIcon />
startAdornment: ( </InputAdornment>
<InputAdornment position="start"> )
<VpnKeyIcon /> }}
</InputAdornment> onChange={this.handleChange}
) />
}} </div>
/> <br></br>
<br /> <br /> <div>
<TextField <TextField
className={classes.margin} className={classes.margin}
id="outlined-password-input" id="password2"
label="ที่อยู่" name="password2"
autoComplete="address" value={password2}
variant="outlined" label="Confirm-Password"
InputProps={{ type="password"
startAdornment: ( autoComplete="current-password"
<InputAdornment position="start"> variant="outlined"
<BusinessIcon /> InputProps={{
</InputAdornment> startAdornment: (
) <InputAdornment position="start">
}} <VpnKeyIcon />
/> </InputAdornment>
<br /> <br /> )
<TextField }}
className={classes.margin} onChange={this.handleChange}
id="outlined-password-input" />
label="เบอร์โทร" </div>
autoComplete="Phone number" <br></br>
variant="outlined" <div>
InputProps={{ <TextField
startAdornment: ( className={classes.margin}
<InputAdornment position="start"> id="address"
<ContactPhoneIcon /> name="address"
</InputAdornment> value={address}
) label="ที่อยู่"
}} autoComplete="address"
/> variant="outlined"
<br /> <br /> InputProps={{
<TextField startAdornment: (
className={classes.margin} <InputAdornment position="start">
id="outlined-file-input" <BusinessIcon />
label="เพิ่มรูปภาพ" </InputAdornment>
type="file" )
autoComplete="current-password" }}
variant="outlined" onChange={this.handleChange}
InputProps={{ />
startAdornment: ( </div>
<InputAdornment position="start"> <br></br>
<AddPhotoAlternateIcon /> <div>
</InputAdornment> <TextField
) className={classes.margin}
}} id="tel"
/> name="tel"
value={tel}
label="เบอร์โทร"
autoComplete="Phone number"
variant="outlined"
InputProps={{
startAdornment: (
<InputAdornment position="start">
<ContactPhoneIcon />
</InputAdornment>
)
}}
onChange={this.handleChange}
/>
</div>
<br></br>
<div>
<TextField
className={classes.margin}
id="image"
name="image"
value={image}
label="เพิ่มรูปภาพ"
type="file"
autoComplete="current-password"
variant="outlined"
InputProps={{
startAdornment: (
<InputAdornment position="start">
<AddPhotoAlternateIcon />
</InputAdornment>
)
}}
onChange={this.handleChange}
/>
</div>
</DialogContent> </DialogContent>
<DialogActions> <DialogActions>
<Button onClick={this.handleClose} color="primary"> <Button onClick={this.handleClose} color="primary">
ยกเลิก ยกเลิก
</Button> </Button>
<Button <Button
onClick={this.handleCloseAndSave}
color="primary" color="primary"
autoFocus autoFocus
onClick={() => {
if (password === password2) {
axios
.post("http://localhost:9000/api/auth/register", {
email: email,
password: password,
name: name,
image: image,
address: address,
tel: tel,
role: "2"
})
.then(response => {
console.log("สร้างผู้ใช้สำเร็จ", response);
})
.catch(error => {
console.log(error);
});
// alert("ลงทะเบียนสำเร็จ");
} else {
alert("password ไม่ถูกต้อง");
}
}}
> >
ยืนยัน ยืนยัน
</Button> </Button>
......
...@@ -22,6 +22,8 @@ import Paper from "@material-ui/core/Paper"; ...@@ -22,6 +22,8 @@ import Paper from "@material-ui/core/Paper";
import CardMedia from "@material-ui/core/CardMedia"; import CardMedia from "@material-ui/core/CardMedia";
import MenuItem from "@material-ui/core/MenuItem"; import MenuItem from "@material-ui/core/MenuItem";
import PhotoCameraIcon from "@material-ui/icons/PhotoCamera"; import PhotoCameraIcon from "@material-ui/icons/PhotoCamera";
import PostAddIcon from '@material-ui/icons/PostAdd';
import CancelIcon from '@material-ui/icons/Cancel';
import Avatar from "react-avatar"; import Avatar from "react-avatar";
const styles = theme => ({ const styles = theme => ({
...@@ -90,7 +92,7 @@ class Datashop extends Component { ...@@ -90,7 +92,7 @@ class Datashop extends Component {
<div className="row mt-2 mb-2"> <div className="row mt-2 mb-2">
<div className="col s12 m6 l12"> <div className="col s12 m6 l12">
<div className="row center"> <div className="row center">
<h4>ข้อมูทั่วไป</h4> <h3>ข้อมูลทั่วไป</h3>
</div> </div>
<div className="row center"> <div className="row center">
<br /> <br />
...@@ -235,7 +237,6 @@ class Datashop extends Component { ...@@ -235,7 +237,6 @@ class Datashop extends Component {
native: true native: true
}} }}
variant="outlined" variant="outlined"
InputProps={{ InputProps={{
startAdornment: ( startAdornment: (
<InputAdornment position="start"> <InputAdornment position="start">
...@@ -243,12 +244,13 @@ class Datashop extends Component { ...@@ -243,12 +244,13 @@ class Datashop extends Component {
</InputAdornment> </InputAdornment>
) )
}} }}
>{currencies.map(option => ( >
<option key={option.value} value={option.value}> {currencies.map(option => (
{option.label} <option key={option.value} value={option.value}>
</option> {option.label}
))}</TextField> </option>
))}
</TextField>
</div> </div>
<br></br> <br></br>
...@@ -269,6 +271,40 @@ class Datashop extends Component { ...@@ -269,6 +271,40 @@ class Datashop extends Component {
</div> </div>
</div> </div>
</div> </div>
<div className="row center">
<div className="row">
<h3>ข้อมูลโปรโมชั่น</h3>
</div>
<div>
<TextField
className={classes.margin}
id="promotion"
label="ข้อมูลโปรโมชั่น"
autoComplete="promotion"
variant="outlined"
InputProps={{
startAdornment: (
<InputAdornment position="start">
<PostAddIcon/>
</InputAdornment>
)
}}
/>
&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;
<Button variant="contained" color="secondary">
ยกเลิก
</Button>{" "}
&nbsp; &nbsp; &nbsp;
<Button variant="contained" color="primary">
ตกลง
</Button>
&nbsp; &nbsp; &nbsp;
<Fab color="secondary" aria-label="edit">
<EditIcon />
</Fab>
</div>
<br></br>
</div>
</div> </div>
); );
} }
......
...@@ -105,7 +105,7 @@ class ResponsiveDrawer extends Component { ...@@ -105,7 +105,7 @@ class ResponsiveDrawer extends Component {
href="/" href="/"
style={{ color: "white" }} style={{ color: "white" }}
> >
B Beauty <img src={require('../../../image/icon.png') }></img>
</IconButton> </IconButton>
</div> </div>
...@@ -122,7 +122,7 @@ class ResponsiveDrawer extends Component { ...@@ -122,7 +122,7 @@ class ResponsiveDrawer extends Component {
<ListItemIcon> <ListItemIcon>
<AccountBoxIcon /> <AccountBoxIcon />
</ListItemIcon> </ListItemIcon>
<ListItemText primary="โปรไฟล์ร้าน" /> <ListItemText primary="โปรไฟล์" />
</ListItem> </ListItem>
<ListItem <ListItem
......
...@@ -2,8 +2,7 @@ import React, { Component } from "react"; ...@@ -2,8 +2,7 @@ import React, { Component } from "react";
import { withStyles } from "@material-ui/core/styles"; import { withStyles } from "@material-ui/core/styles";
import { withRouter } from "react-router-dom"; import { withRouter } from "react-router-dom";
import compose from "recompose/compose"; import compose from "recompose/compose";
import Input from "@material-ui/core/Input"; import { Input, InputLabel } from "@material-ui/core";
import InputLabel from "@material-ui/core/InputLabel";
import InputAdornment from "@material-ui/core/InputAdornment"; import InputAdornment from "@material-ui/core/InputAdornment";
import FormControl from "@material-ui/core/FormControl"; import FormControl from "@material-ui/core/FormControl";
import TextField from "@material-ui/core/TextField"; import TextField from "@material-ui/core/TextField";
...@@ -37,7 +36,7 @@ class Profile extends Component { ...@@ -37,7 +36,7 @@ class Profile extends Component {
return ( return (
<div className="row center"> <div className="row center">
<div className="row mt-2 mb-2"> <div className="row mt-2 mb-2">
<h2>โปรไฟล์ร้าน</h2> <h2>โปรไฟล์</h2>
</div> </div>
<br /> <br />
<div className="row mt-2 mb-2"> <div className="row mt-2 mb-2">
...@@ -63,8 +62,8 @@ class Profile extends Component { ...@@ -63,8 +62,8 @@ class Profile extends Component {
<div ClassName="row"> <div ClassName="row">
<TextField <TextField
className={classes.margin} className={classes.margin}
id="outlined-uncontrolled" id="name"
label="ชื่อร้าน" label="ชื่อ-นามสกุล"
variant="outlined" variant="outlined"
InputProps={{ InputProps={{
startAdornment: ( startAdornment: (
...@@ -77,7 +76,7 @@ class Profile extends Component { ...@@ -77,7 +76,7 @@ class Profile extends Component {
<TextField <TextField
className={classes.margin} className={classes.margin}
id="outlined-uncontrolled" id="email"
label="E_mail" label="E_mail"
variant="outlined" variant="outlined"
InputProps={{ InputProps={{
...@@ -93,7 +92,7 @@ class Profile extends Component { ...@@ -93,7 +92,7 @@ class Profile extends Component {
<div> <div>
<TextField <TextField
className={classes.margin} className={classes.margin}
id="outlined-password-input" id="password1"
label="Password" label="Password"
type="password" type="password"
autoComplete="current-password" autoComplete="current-password"
...@@ -109,7 +108,7 @@ class Profile extends Component { ...@@ -109,7 +108,7 @@ class Profile extends Component {
<TextField <TextField
className={classes.margin} className={classes.margin}
id="outlined-password-input" id="password2"
label="Confirm-Password" label="Confirm-Password"
type="password" type="password"
autoComplete="current-password" autoComplete="current-password"
...@@ -127,7 +126,7 @@ class Profile extends Component { ...@@ -127,7 +126,7 @@ class Profile extends Component {
<div> <div>
<TextField <TextField
className={classes.margin} className={classes.margin}
id="outlined-password-input" id="address"
label="ที่อยู่" label="ที่อยู่"
autoComplete="address" autoComplete="address"
variant="outlined" variant="outlined"
...@@ -141,7 +140,7 @@ class Profile extends Component { ...@@ -141,7 +140,7 @@ class Profile extends Component {
/> />
<TextField <TextField
className={classes.margin} className={classes.margin}
id="outlined-password-input" id="tel"
label="เบอร์โทร" label="เบอร์โทร"
autoComplete="Phone number" autoComplete="Phone number"
variant="outlined" variant="outlined"
......
...@@ -13,7 +13,8 @@ import AddPhotoAlternateIcon from "@material-ui/icons/AddPhotoAlternate"; ...@@ -13,7 +13,8 @@ import AddPhotoAlternateIcon from "@material-ui/icons/AddPhotoAlternate";
import MailOutlineIcon from "@material-ui/icons/MailOutline"; import MailOutlineIcon from "@material-ui/icons/MailOutline";
import VpnKeyIcon from "@material-ui/icons/VpnKey"; import VpnKeyIcon from "@material-ui/icons/VpnKey";
import Button from "@material-ui/core/Button"; import Button from "@material-ui/core/Button";
import Link from '@material-ui/core/Link';
import axios from "axios";
const styles = theme => ({ const styles = theme => ({
root: { root: {
...@@ -24,8 +25,23 @@ const styles = theme => ({ ...@@ -24,8 +25,23 @@ const styles = theme => ({
} }
}); });
class Login extends Component { class Login extends Component {
state = {
email: "",
password: ""
};
handleChange = event => {
console.log("name : ", event.target.name);
console.log("value : ", event.target.value);
this.setState({
[event.target.name]: event.target.value
});
};
render() { render() {
const {classes} = this.props; const { classes } = this.props;
const { email, password } = this.state;
return ( return (
<div> <div>
...@@ -34,7 +50,9 @@ class Login extends Component { ...@@ -34,7 +50,9 @@ class Login extends Component {
<div> <div>
<TextField <TextField
className={classes.margin} className={classes.margin}
id="outlined-uncontrolled" id="email"
name="email"
value={email}
label="E_mail" label="E_mail"
variant="outlined" variant="outlined"
InputProps={{ InputProps={{
...@@ -44,13 +62,16 @@ class Login extends Component { ...@@ -44,13 +62,16 @@ class Login extends Component {
</InputAdornment> </InputAdornment>
) )
}} }}
onChange={this.handleChange}
/> />
</div> </div>
<br></br> <br></br>
<div> <div>
<TextField <TextField
className={classes.margin} className={classes.margin}
id="outlined-password-input" id="password"
name="password"
value={password}
label="Password" label="Password"
type="password" type="password"
autoComplete="current-password" autoComplete="current-password"
...@@ -62,6 +83,7 @@ class Login extends Component { ...@@ -62,6 +83,7 @@ class Login extends Component {
</InputAdornment> </InputAdornment>
) )
}} }}
onChange={this.handleChange}
/> />
</div> </div>
<br></br> <br></br>
...@@ -69,7 +91,12 @@ class Login extends Component { ...@@ -69,7 +91,12 @@ class Login extends Component {
<Button variant="contained" color="primary" disableElevation> <Button variant="contained" color="primary" disableElevation>
เข้าสู่ระบบ เข้าสู่ระบบ
</Button> </Button>
</div>
<br/><br/>
<div className="row center">
<Link href="/RegisterPage" >
ยังไม่ได้ลงทะเบียน
</Link>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -33,7 +33,7 @@ class RegisterPage extends Component { ...@@ -33,7 +33,7 @@ class RegisterPage extends Component {
address: "", address: "",
tel: "", tel: "",
image: "", image: "",
rolr: "0" rolr: ""
}; };
handleChange = event => { handleChange = event => {
...@@ -214,7 +214,7 @@ class RegisterPage extends Component { ...@@ -214,7 +214,7 @@ class RegisterPage extends Component {
image: image, image: image,
address: address, address: address,
tel: tel, tel: tel,
role:role role: '0'
}) })
.then(response => { .then(response => {
console.log("สร้างผู้ใช้สำเร็จ", response); console.log("สร้างผู้ใช้สำเร็จ", response);
......
...@@ -214,7 +214,7 @@ class RegisterShopPage extends Component { ...@@ -214,7 +214,7 @@ class RegisterShopPage extends Component {
image: image, image: image,
address: address, address: address,
tel: tel, tel: tel,
role:role role: '1'
}) })
.then(response => { .then(response => {
console.log("สร้างผู้ใช้สำเร็จ", response); console.log("สร้างผู้ใช้สำเร็จ", response);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment