Commit 69157781 authored by Piyaphorn Arphornsri's avatar Piyaphorn Arphornsri

add

parent dbb28bff
......@@ -15,7 +15,7 @@ exports.addShop = async (req, res) => {
exports.getShop = async (req, res) => {
try {
let shop = await Shop.findAll();
res.status(200).send("success");
res.status(200).send(shop);
} catch (err) {
console.log(err);
res.sendStatus(401);
......@@ -45,7 +45,7 @@ exports.getShopId = async (req, res) => {
id: shopId
}
});
res.status(200).send("success");
res.status(200).send(shop);
} catch (err) {
console.log(err);
res.sendStatus(401);
......
......@@ -9,13 +9,16 @@ module.exports = db.sequelize.define("shops", {
},
name: {
type: Sequelize.INTEGER
type: Sequelize.STRING
},
timeopen: {
nameeng: {
type: Sequelize.STRING
},
timeopen: {
type: Sequelize.DATE
},
timeclose: {
type: Sequelize.STRING
type: Sequelize.DATE
},
address: {
type: Sequelize.TEXT
......@@ -32,6 +35,14 @@ module.exports = db.sequelize.define("shops", {
facebook: {
type: Sequelize.TEXT
},
image:{
type: Sequelize.TEXT
},
userId: {
type: Sequelize.INTEGER,
references: 'users',
referencesKey: 'id'
},
type: {
type: Sequelize.ENUM(
"สปาและนวด",
......@@ -42,4 +53,7 @@ module.exports = db.sequelize.define("shops", {
"แต่งหน้าทำผม"
)
}
});
......@@ -80,11 +80,13 @@ class Datashop extends Component {
state = {
currency: "1",
name: "",
nameeng: "",
timeopen: "",
timeclose: "",
tel: "",
address: "",
detail: "",
images: "",
map: "",
facebook: "",
type: "",
......@@ -110,6 +112,7 @@ class Datashop extends Component {
const {
currency,
name,
nameeng,
timeopen,
timeclose,
tel,
......@@ -161,7 +164,22 @@ class Datashop extends Component {
}}
onChange={this.handleChange}
/>
<TextField
className={classes.margin}
id="nameeng"
name="nameeng"
value={nameeng}
label="Name"
variant="outlined"
InputProps={{
startAdornment: (
<InputAdornment position="start">
<AccountCircle />
</InputAdornment>
)
}}
onChange={this.handleChange}
/>
<TextField
className={classes.margin}
id="timeopen"
......@@ -179,7 +197,11 @@ class Datashop extends Component {
}}
onChange={this.handleChange}
/>
<TextField
</div>
<br />
<div>
<TextField
className={classes.margin}
id="timeclose"
name="timeclose"
......@@ -196,9 +218,6 @@ class Datashop extends Component {
}}
onChange={this.handleChange}
/>
</div>
<br />
<div>
<TextField
className={classes.margin}
id="tel"
......@@ -233,7 +252,11 @@ class Datashop extends Component {
}}
onChange={this.handleChange}
/>
<TextField
</div>
<br />
<div>
<TextField
className={classes.margin}
id="detail"
name="detail"
......@@ -250,9 +273,6 @@ class Datashop extends Component {
}}
onChange={this.handleChange}
/>
</div>
<br />
<div>
<TextField
className={classes.margin}
id="map"
......@@ -330,6 +350,7 @@ class Datashop extends Component {
axios
.post("http://localhost:9000/api/shop/add", {
name: name,
nameeng:nameeng,
timeopen: timeopen,
timeclose: timeclose,
tel: tel,
......
......@@ -20,7 +20,7 @@ import {
DialogTitle,
InputAdornment,
TextField,
InputBase,
InputBase
} from "@material-ui/core";
import MoreVertIcon from "@material-ui/icons/MoreVert";
import { DatePicker } from "@material-ui/pickers";
......@@ -70,15 +70,76 @@ const styles = theme => ({
right: theme.spacing(2)
}
});
const currencieslist = [
{
value: "1",
label: " กรุณาเลือกรายการ "
},
{
value: "2",
label: "อบไอน้ำ 30 นาที"
},
{
value: "3",
label: "นวดหน้า 60 นาที "
},
{
value: "4",
label: "สระได 20 นาที"
},
{
value: "5",
label: "ทำเล็บ 60 นาที"
},
{
value: "6",
label: "ยืดผมถาวร 120 นาที"
},
{
value: "7",
label: "ทำสีผม 60 นาที"
}
];
const currencies = [
{
value: "1",
label: " กรุณาเลือกช่าง "
},
{
value: "2",
label: "ช่าง ก"
},
{
value: "3",
label: "ช่าง ข"
},
{
value: "4",
label: "ช่าง ค"
},
{
value: "5",
label: "ช่าง ง"
},
{
value: "6",
label: "ช่าง จ"
},
{
value: "7",
label: "ช่าง"
}
];
class ShopPage extends Component {
state = {
name: "xxx",
email: "xyz.ggg.com",
reviwe: false,
list: false,
date: new Date(),
open: false,
data: false
queue:false,
shop: null
};
handleClickOpen = () => {
this.setState({
......@@ -110,58 +171,40 @@ class ShopPage extends Component {
list: false
});
};
ClickOpendata = () => {
ClickOpenqueue = () => {
this.setState({
data: true
queue: true
});
};
Closedata = () => {
Closequeue = () => {
this.setState({
data: false
queue: false
});
};
componentDidMount = () => {
axios
.get("http://localhost:9000/api/auth/getUserById/7")
.then(function(response) {
// handle success
// console.log("response : ", response.data);
// const name = response.data.name;
// const email = response.data.email;
const { name, email } = response.data;
console.log("name : ", name);
console.log("email : ", email);
this.setState({
name: name,
email: email
});
})
.catch(function(error) {
// handle error
console.log(error);
});
console.log("here");
componentDidMount = async () => {
const {location } = this.props;
const id = location.state.id;
const response = await axios.get(`http://localhost:9000/api/shop/getShopId/${id}`);
this.setState({
shop: response.data
});
};
render() {
const { classes } = this.props;
const bull = <span className={classes.bullet}></span>;
const { name, email, reviwe, list, date, open ,data} = this.state;
const { shop, reviwe, list, date, open, queue } = this.state;
return (
<div>
<AppBar />
<div className="row ">
{ shop && <div className="row">
<div className="row mt-2 mb-2">
<div className="col s12 m6 l1"></div>
<div className="col s12 m6 l11">
<h3>น้องใหม่บิวตี้ NongMai Beauty</h3>
10 หมู่ 1 บ้านโพนเมือง ตำบลโพนเมือง อำเภอเหล่าเสือโก้ก
จังหวัดอุบลราชธานี 34000
<h3>{shop.name}</h3>
{shop.address}
</div>
</div>
<div className="row mt-4 mb-2">
......@@ -240,15 +283,15 @@ class ShopPage extends Component {
<Button
variant="outlined"
color="primary"
onClick={this.ClickOpendata}
onClick={this.ClickOpenqueue}
>
ถัดไป
</Button>
</DialogActions>
</Dialog>
<Dialog
open={data}
onClose={this.Closedata}
open={queue}
onClose={this.Closequeue}
aria-labelledby="max-width-dialog-title"
>
<DialogTitle id="max-width-dialog-title">
......@@ -275,12 +318,12 @@ class ShopPage extends Component {
)
}}
>
{/* {currencies.map(option => (
{currencieslist.map(option => (
<option key={option.value} value={option.value}>
{option.label}
</option>
))} */}
</TextField>&nbsp;&nbsp;
))}
</TextField> &nbsp; &nbsp; &nbsp;
<TextField
className={classes.margin}
id="list"
......@@ -300,19 +343,19 @@ class ShopPage extends Component {
)
}}
>
{/* {currencies.map(option => (
{currencies.map(option => (
<option key={option.value} value={option.value}>
{option.label}
</option>
))} */}
))}
</TextField>
</DialogContentText>
</DialogContent>
<DialogActions>
<Button onClick={this.Closedata} color="primary">
<Button onClick={this.Closequeue} color="primary">
Cancel
</Button>
<Button onClick={this.Closedata} color="primary">
<Button onClick={this.Closequeue} color="primary">
Subscribe
</Button>
</DialogActions>
......@@ -331,15 +374,14 @@ class ShopPage extends Component {
</div>
<div className="row">
<h4>
ที่อยู่ : 10 หมู่ 1 บ้านโพนเมือง ตำบลโพนเมือง
อำเภอเหล่าเสือโก้ก จังหวัดอุบลราชธานี 34000
{shop.address}
</h4>
</div>
<div className="row">
<h4>เบอร์โทร : 082-547-8955</h4>
<h4>เวลาเปิด : 08:00 .</h4>
<h4>เวลาปิด : 18:00 .</h4>
<h4>เบอร์โทร : {shop.tel}</h4>
<h4>เวลาเปิด : {shop.timeopen} .</h4>
<h4>เวลาปิด : {shop.timeclose} .</h4>
</div>
</div>
</div>
......@@ -347,15 +389,13 @@ class ShopPage extends Component {
<div className="row mt-2 mb-2">
<div className="col s12 m6 l7">
<div className="row center">
<h4>ผลงานช่าง ปิยพร อาภรศรี</h4>
<div className="col s12 m6 l4">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSAaEt_unwBuDLyqCP_bW3PBawVHkjZrNq-F3u7mAKtSjmBTrHE"></img>
</div>
<div className="col s12 m6 l4">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSAaEt_unwBuDLyqCP_bW3PBawVHkjZrNq-F3u7mAKtSjmBTrHE"></img>
</div>
<h4>ผลงานช่าง ปิยพร อาภรศรี</h4>
<div className="col s12 m6 l4">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSAaEt_unwBuDLyqCP_bW3PBawVHkjZrNq-F3u7mAKtSjmBTrHE"></img>
</div>
<div className="col s12 m6 l4">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSAaEt_unwBuDLyqCP_bW3PBawVHkjZrNq-F3u7mAKtSjmBTrHE"></img>
</div>
</div>
</div>
<div className="col s12 m6 l1"></div>
......@@ -443,7 +483,7 @@ class ShopPage extends Component {
onClose={this.handleClose}
aria-labelledby="form-dialog-title"
>
<DialogTitle id="form-dialog-title">Subscribe</DialogTitle>
<DialogTitle id="form-dialog-title">เขียนรีวิวติชม</DialogTitle>
<DialogContent>
<DialogContentText>
To subscribe to this website, please enter your email
......@@ -463,6 +503,7 @@ class ShopPage extends Component {
</div>
</div>
</div>
}
</div>
);
}
......
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