Commit b9ea4a79 authored by Piyaphorn Arphornsri's avatar Piyaphorn Arphornsri

add project

parent 93f8ea60
var mysql = require("mysql");
var con = mysql.createConnection({
host: "localhost",
user: "root",
password: "",
database: "b_beauty_project"
});
con.connect(function(err) {
if (err) throw err;
console.log("Connected!");
});
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `npm start`
Runs the app in the development mode.<br />
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.<br />
You will also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.<br />
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `npm run build`
Builds the app for production to the `build` folder.<br />
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.<br />
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `npm run eject`
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
### Code Splitting
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
### Analyzing the Bundle Size
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
### Making a Progressive Web App
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
### Advanced Configuration
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
### Deployment
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
### `npm run build` fails to minify
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
This diff is collapsed.
{
"name": "b_beauty_project",
"version": "0.1.0",
"private": true,
"dependencies": {
"@date-io/date-fns": "^1.3.11",
"@material-ui/core": "^4.8.3",
"@material-ui/icons": "^4.5.1",
"@material-ui/lab": "^4.0.0-alpha.40",
"@material-ui/pickers": "^3.2.9",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.4.0",
"@testing-library/user-event": "^7.2.1",
"axios": "^0.19.2",
"date-fns": "^2.9.0",
"material-table": "^1.56.1",
"mysql": "^2.18.1",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-intl": "^3.11.0",
"react-router-dom": "^5.1.2",
"react-scripts": "3.3.0",
"recompose": "^0.30.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Web site created using create-react-app" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!-- Fonts -->
<title>จองคิวร้านเสริมสวย กับ B Beauty</title>
<link href="https://fonts.googleapis.com/css?family=Prompt" rel="stylesheet" />
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>
\ No newline at end of file
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
# https://www.robotstxt.org/robotstxt.html
User-agent: *
import React, { Component } from "react";
import { withStyles } from "@material-ui/styles";
import { AppBar, Tabs, Tab, Badge, Paper } from "@material-ui/core";
import ShoppingBasket from "@material-ui/icons/ShoppingBasketOutlined";
import AccountCircle from "@material-ui/icons/AccountCircleOutlined";
import CreditCard from "@material-ui/icons/CreditCardOutlined";
import LiveHelpIcon from "@material-ui/icons/LiveHelpOutlined";
import HelpIcon from "@material-ui/icons/HelpOutline";
import RedeemIcon from "@material-ui/icons/RedeemOutlined";
import SupervisedUserCircleOutlinedIcon from "@material-ui/icons/SupervisedUserCircleOutlined";
import MapIcon from "@material-ui/icons/MapOutlined";
import compose from "recompose/compose";
import { withRouter } from "react-router-dom";
const styles = theme => ({
root: {
flexGrow: 1,
width: "100%",
backgroundColor: theme.palette.background.paper
},
flex: {
flex: 1
},
fab: {
position: "absolute",
bottom: theme.spacing(3),
right: theme.spacing(3)
},
container: {
display: "flex",
flexWrap: "wrap"
},
dense: {
marginTop: theme.spacing(2)
},
textField: {
marginLeft: theme.spacing(1),
marginRight: theme.spacing(1)
},
margin: {
margin: theme.spacing(2)
}
});
class Dashboard extends Component {
render() {
const { classes, history, tab, handleChangeTab } = this.props;
const badgeOrder = 5;
const badgeUser = 6;
const badgeCredit = 2;
const badgePlace = 12;
return (
<div className={classes.root}>
<AppBar position="static" color="default">
<Tabs
value={tab}
onChange={(event, newValue) => {
handleChangeTab(event, newValue);
}}
variant="scrollable"
scrollButtons="on"
indicatorColor="primary"
textColor="primary"
aria-label="scrollable force tabs example"
>
<Tab
label="สปาและนวด"
icon={
<Badge
className={classes.margin}
//badgeContent={badgeOrder}
color="secondary"
>
<ShoppingBasket />
</Badge>
}
className={classes.flex}
/>
<Tab
label="ผิวหน้า"
icon={
<Badge
className={classes.margin}
//badgeContent={badgeUser}
color="secondary"
>
<AccountCircle />
</Badge>
}
className={classes.flex}
/>
<Tab
label="ขนตาและคิ้ว"
icon={
<Badge
className={classes.margin}
//badgeContent={badgeCredit}
color="secondary"
>
<CreditCard />
</Badge>
}
className={classes.flex}
/>
<Tab
label="ทำเล็บ"
icon={<SupervisedUserCircleOutlinedIcon />}
className={classes.flex}
/>
<Tab
label="ชาลอน"
icon={<LiveHelpIcon />}
className={classes.flex}
/>
<Tab
label="แต่งหน้าทำผม"
icon={<HelpIcon />}
className={classes.flex}
/>
</Tabs>
</AppBar>
</div>
);
}
}
export default compose(withStyles(styles), withRouter)(Dashboard);
import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import AppBar from '@material-ui/core/AppBar';
import Toolbar from '@material-ui/core/Toolbar';
import Typography from '@material-ui/core/Typography';
import Button from '@material-ui/core/Button';
import IconButton from '@material-ui/core/IconButton';
import MenuIcon from '@material-ui/icons/Menu';
const useStyles = makeStyles(theme => ({
root: {
flexGrow: 1,
},
menuButton: {
marginRight: theme.spacing(2),
},
title: {
flexGrow: 1,
},
}));
export default function ButtonAppBar() {
const classes = useStyles();
return (
<div className={classes.root}>
<AppBar position="static">
<Toolbar>
<IconButton edge="start" className={classes.menuButton} color="inherit" aria-label="menu" Link href="/" >
B Beauty
</IconButton>
<Typography variant="h6" className={classes.title}>
</Typography>
<Button color="inherit" Link href="/LoginPage" >Login</Button>
<Button color="inherit" Link href="/RigisterPage" >rigister</Button>
<Button color="inherit" Link href="/RigisterShopPage" >rigistershop</Button>
</Toolbar>
</AppBar>
</div>
);
}
\ No newline at end of file
import React from "react";
import ReactDOM from "react-dom";
import Routes from "./routes/index";
import * as serviceWorker from "./serviceWorker";
import { MuiPickersUtilsProvider } from "@material-ui/pickers";
import DateFnsUtils from "@date-io/date-fns";
import { th } from "date-fns/locale";
import { MuiThemeProvider, createMuiTheme } from "@material-ui/core/styles";
import "./styles/custom.css";
import "./styles/materialize.css";
import "./styles/spacing.css";
const theme = createMuiTheme({
fontFamily: `'Prompt', sans-serif`,
typography: {
useNextVariants: true,
fontFamily: `'Prompt', sans-serif`
},
palette: {
// primary: {
// light: '#80DEEA',
// main: '#1a8a98',
// dark: '#00838F',
// contrastText: '#fff'
// },
// secondary: {
// light: '#ff7961',
// main: '#f44336',
// dark: '#ba000d',
// contrastText: '#000'
// }
}
});
ReactDOM.render(
<MuiPickersUtilsProvider utils={DateFnsUtils} locale={th}>
<MuiThemeProvider theme={theme}>
<Routes />
</MuiThemeProvider>
</MuiPickersUtilsProvider>,
document.getElementById("root")
);
serviceWorker.unregister();
import React, { Component, Fragment } from "react";
import { Switch, Route, BrowserRouter } from "react-router-dom";
import AppHeader from "../components/AppHeader";
import HomePage from "../views/HomePage";
import DataShopPage from "../views/DataShopPage/Home";
import LoginPage from "../views/LoginPage";
import RigisterPage from "../views/RigisterPage";
import RigisterShopPage from "../views/RigisterShopPage";
import ShopPage from "../views/ShopPage";
import BeauticianShopPage from "../views/BeauticianShopPage/Home";
class Router extends Component {
constructor(props) {
super(props);
this.state = {};
}
render() {
return (
<BrowserRouter>
<Fragment>
<AppHeader />
<Switch>
<Route exact path="/" component={HomePage} />
<Route path="/DataShopPage" component={DataShopPage} />
<Route path="/LoginPage" component={LoginPage} />
<Route path="/RigisterPage" component={RigisterPage} />
<Route path="/RigisterShopPage" component={RigisterShopPage} />
<Route path="/ShopPage" component={ShopPage} />
<Route path="/BeauticianShopPage" component={BeauticianShopPage} />
</Switch>
</Fragment>
</BrowserRouter>
);
}
}
export default Router;
// This optional code is used to register a service worker.
// register() is not called by default.
// This lets the app load faster on subsequent visits in production, and gives
// it offline capabilities. However, it also means that developers (and users)
// will only see deployed updates on subsequent visits to a page, after all the
// existing tabs open on the page have been closed, since previously cached
// resources are updated in the background.
// To learn more about the benefits of this model and instructions on how to
// opt-in, read https://bit.ly/CRA-PWA
const isLocalhost = Boolean(
window.location.hostname === 'localhost' ||
// [::1] is the IPv6 localhost address.
window.location.hostname === '[::1]' ||
// 127.0.0.0/8 are considered localhost for IPv4.
window.location.hostname.match(
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
)
);
export function register(config) {
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
// The URL constructor is available in all browsers that support SW.
const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
if (publicUrl.origin !== window.location.origin) {
// Our service worker won't work if PUBLIC_URL is on a different origin
// from what our page is served on. This might happen if a CDN is used to
// serve assets; see https://github.com/facebook/create-react-app/issues/2374
return;
}
window.addEventListener('load', () => {
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
if (isLocalhost) {
// This is running on localhost. Let's check if a service worker still exists or not.
checkValidServiceWorker(swUrl, config);
// Add some additional logging to localhost, pointing developers to the
// service worker/PWA documentation.
navigator.serviceWorker.ready.then(() => {
console.log(
'This web app is being served cache-first by a service ' +
'worker. To learn more, visit https://bit.ly/CRA-PWA'
);
});
} else {
// Is not localhost. Just register service worker
registerValidSW(swUrl, config);
}
});
}
}
function registerValidSW(swUrl, config) {
navigator.serviceWorker
.register(swUrl)
.then(registration => {
registration.onupdatefound = () => {
const installingWorker = registration.installing;
if (installingWorker == null) {
return;
}
installingWorker.onstatechange = () => {
if (installingWorker.state === 'installed') {
if (navigator.serviceWorker.controller) {
// At this point, the updated precached content has been fetched,
// but the previous service worker will still serve the older
// content until all client tabs are closed.
console.log(
'New content is available and will be used when all ' +
'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
);
// Execute callback
if (config && config.onUpdate) {
config.onUpdate(registration);
}
} else {
// At this point, everything has been precached.
// It's the perfect time to display a
// "Content is cached for offline use." message.
console.log('Content is cached for offline use.');
// Execute callback
if (config && config.onSuccess) {
config.onSuccess(registration);
}
}
}
};
};
})
.catch(error => {
console.error('Error during service worker registration:', error);
});
}
function checkValidServiceWorker(swUrl, config) {
// Check if the service worker can be found. If it can't reload the page.
fetch(swUrl, {
headers: { 'Service-Worker': 'script' }
})
.then(response => {
// Ensure service worker exists, and that we really are getting a JS file.
const contentType = response.headers.get('content-type');
if (
response.status === 404 ||
(contentType != null && contentType.indexOf('javascript') === -1)
) {
// No service worker found. Probably a different app. Reload the page.
navigator.serviceWorker.ready.then(registration => {
registration.unregister().then(() => {
window.location.reload();
});
});
} else {
// Service worker found. Proceed as normal.
registerValidSW(swUrl, config);
}
})
.catch(() => {
console.log(
'No internet connection found. App is running in offline mode.'
);
});
}
export function unregister() {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready.then(registration => {
registration.unregister();
});
}
}
body {
margin: 0;
padding: 0;
font-family: 'Prompt', sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.right {
float: right;
}
.bold {
font-weight: bold;
}
\ No newline at end of file
This diff is collapsed.
.mt-0, .my-0 {
margin-top: 0 !important;
}
.mr-0, .mx-0 {
margin-right: 0 !important;
}
.mb-0, .my-0 {
margin-bottom: 0 !important;
}
.ml-0, .mx-0 {
margin-left: 0 !important;
}
.m-1 {
margin: 0.25rem !important;
}
.mt-1, .my-1 {
margin-top: 0.25rem !important;
}
.mr-1, .mx-1 {
margin-right: 0.25rem !important;
}
.mb-1, .my-1 {
margin-bottom: 0.25rem !important;
}
.ml-1, .mx-1 {
margin-left: 0.25rem !important;
}
.m-2 {
margin: 0.5rem !important;
}
.mt-2, .my-2 {
margin-top: 0.5rem !important;
}
.mr-2, .mx-2 {
margin-right: 0.5rem !important;
}
.mb-2, .my-2 {
margin-bottom: 0.5rem !important;
}
.ml-2, .mx-2 {
margin-left: 0.5rem !important;
}
.m-3 {
margin: 1rem !important;
}
.mt-3, .my-3 {
margin-top: 1rem !important;
}
.mr-3, .mx-3 {
margin-right: 1rem !important;
}
.mb-3, .my-3 {
margin-bottom: 1rem !important;
}
.ml-3, .mx-3 {
margin-left: 1rem !important;
}
.m-4 {
margin: 1.5rem !important;
}
.mt-4, .my-4 {
margin-top: 1.5rem !important;
}
.mr-4, .mx-4 {
margin-right: 1.5rem !important;
}
.mb-4, .my-4 {
margin-bottom: 1.5rem !important;
}
.ml-4, .mx-4 {
margin-left: 1.5rem !important;
}
.m-5 {
margin: 3rem !important;
}
.mt-5, .my-5 {
margin-top: 3rem !important;
}
.mr-5, .mx-5 {
margin-right: 3rem !important;
}
.mb-5, .my-5 {
margin-bottom: 3rem !important;
}
.ml-5, .mx-5 {
margin-left: 3rem !important;
}
.p-0 {
padding: 0 !important;
}
.pt-0, .py-0 {
padding-top: 0 !important;
}
.pr-0, .px-0 {
padding-right: 0 !important;
}
.pb-0, .py-0 {
padding-bottom: 0 !important;
}
.pl-0, .px-0 {
padding-left: 0 !important;
}
.p-1 {
padding: 0.25rem !important;
}
.pt-1, .py-1 {
padding-top: 0.25rem !important;
}
.pr-1, .px-1 {
padding-right: 0.25rem !important;
}
.pb-1, .py-1 {
padding-bottom: 0.25rem !important;
}
.pl-1, .px-1 {
padding-left: 0.25rem !important;
}
.p-2 {
padding: 0.5rem !important;
}
.pt-2, .py-2 {
padding-top: 0.5rem !important;
}
.pr-2, .px-2 {
padding-right: 0.5rem !important;
}
.pb-2, .py-2 {
padding-bottom: 0.5rem !important;
}
.pl-2, .px-2 {
padding-left: 0.5rem !important;
}
.p-3 {
padding: 1rem !important;
}
.pt-3, .py-3 {
padding-top: 1rem !important;
}
.pr-3, .px-3 {
padding-right: 1rem !important;
}
.pb-3, .py-3 {
padding-bottom: 1rem !important;
}
.pl-3, .px-3 {
padding-left: 1rem !important;
}
.p-4 {
padding: 1.5rem !important;
}
.pt-4, .py-4 {
padding-top: 1.5rem !important;
}
.pr-4, .px-4 {
padding-right: 1.5rem !important;
}
.pb-4, .py-4 {
padding-bottom: 1.5rem !important;
}
.pl-4, .px-4 {
padding-left: 1.5rem !important;
}
.p-5 {
padding: 3rem !important;
}
.pt-5, .py-5 {
padding-top: 3rem !important;
}
.pr-5, .px-5 {
padding-right: 3rem !important;
}
.pb-5, .py-5 {
padding-bottom: 3rem !important;
}
.pl-5, .px-5 {
padding-left: 3rem !important;
}
.text-center {
text-align: center !important;
}
.text-left {
text-align: left !important;
}
.text-right {
text-align: right !important;
}
.no-margin {
margin: 0;
}
.no-margin-bottom {
margin-bottom: 0;
}
.no-border {
border: none;
}
.no-padding {
padding: 0;
}
.no-pt {
padding-top: 0;
}
.no-pb {
padding-bottom: 0;
}
.no-pl {
padding-left: 0;
}
\ No newline at end of file
import React, { Component } from "react";
import { withStyles, makeStyles } from "@material-ui/core/styles";
import {
Dialog,
Button,
DialogActions,
DialogContent,
DialogContentText,
DialogTitle,
Paper,
InputBase,
Divider,
IconButton
} from "@material-ui/core";
import AppBra from "../../../components/AppBra";
import { withRouter } from "react-router-dom";
import compose from "recompose/compose";
import { th } from "date-fns/locale";
import { format } from "date-fns";
import { MenuIcon } from "@material-ui/icons/Menu";
import Fab from "@material-ui/core/Fab";
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 InputLabel from "@material-ui/core/InputLabel";
import InputAdornment from "@material-ui/core/InputAdornment";
import FormControl from "@material-ui/core/FormControl";
import TextField from "@material-ui/core/TextField";
import Grid from "@material-ui/core/Grid";
import AccountCircle from "@material-ui/icons/AccountCircle";
import AddPhotoAlternateIcon from "@material-ui/icons/AddPhotoAlternate";
import MailOutlineIcon from "@material-ui/icons/MailOutline";
import VpnKeyIcon from "@material-ui/icons/VpnKey";
import TextareaAutosize from "@material-ui/core/TextareaAutosize";
import ContactPhoneIcon from "@material-ui/icons/ContactPhone";
import BusinessIcon from "@material-ui/icons/Business";
import MaterialTable from "material-table";
const styles = theme => ({
root: {
height: 150,
flexGrow: 1,
transform: "translateZ(0)",
// The position fixed scoping doesn't work in IE 11.
// Disable this demo to preserve the others.
"@media all and (-ms-high-contrast: none)": {
display: "none"
}
},
modal: {
display: "flex",
padding: theme.spacing(1),
alignItems: "center",
justifyContent: "center"
},
fab: {
position: "absolute",
bottom: 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: {
minWidth: 700
}
});
class Databeautician extends Component {
state = {
open: false,
columns: [
{ title: "รูปภาพ", field: "img" }
],
data: [
{ img: "Mehmet"},
{
img: "Zerya Betül"
}
]
};
handleClickOpen = () => {
this.setState({
open: true
});
};
handleClose = () => {
this.setState({
open: false
});
};
handleCloseAndSave = () => {
//Save to db
this.setState(prevState => {
const data = [...prevState.data];
const newData = {
img: "Mehmet",
};
data.push(newData);
return { ...prevState, data: data, open: false };
});
// this.setState({
// open: false
// });
};
componentDidMount = () => {
let { pathname } = this.props.location;
pathname = pathname.substring(1, pathname.length);
// console.log('pathname', pathname)
};
render() {
const { classes } = this.props;
const { open, columns, data } = this.state;
return (
<div>
<MaterialTable
title="ภาพผลงาน"
columns={columns}
data={data}
options={{
selection: false
}}
editable={{
// onRowAdd: newData =>
// new Promise(resolve => {
// setTimeout(() => {
// resolve();
// this.setState(prevState => {
// const data = [...prevState.data];
// data.push(newData);
// return { ...prevState, data };
// });
// }, 600);
// }),
// onRowUpdate: (newData, oldData) =>
// new Promise(resolve => {
// setTimeout(() => {
// resolve();
// if (oldData) {
// this.setState(prevState => {
// const data = [...prevState.data];
// data[data.indexOf(oldData)] = newData;
// return { ...prevState, data };
// });
// }
// }, 600);
// }),
onRowDelete: oldData =>
new Promise(resolve => {
setTimeout(() => {
resolve();
this.setState(prevState => {
const data = [...prevState.data];
data.splice(data.indexOf(oldData), 1);
return { ...prevState, data };
});
}, 600);
})
}}
/>
<div className="row">
<Fab
aria-label={"add"}
className={classes.fab}
color="primary"
onClick={this.handleClickOpen}
>
<AddIcon />
</Fab>
<Dialog
open={open}
onClose={this.handleClose}
aria-labelledby="alert-dialog-title"
aria-describedby="alert-dialog-description"
>
<DialogTitle id="alert-dialog-title">{"เพิ่มรูปภาพ"}</DialogTitle>
<DialogContent>
<TextField
className={classes.margin}
id="outlined-file-input"
label="เพิ่มรูปภาพ"
type="file"
autoComplete="current-password"
variant="outlined"
InputProps={{
startAdornment: (
<InputAdornment position="start">
<AddPhotoAlternateIcon />
</InputAdornment>
)
}}
/>
</DialogContent>
<DialogActions>
<Button onClick={this.handleClose} color="primary">
ยกเลิก
</Button>
<Button
onClick={this.handleCloseAndSave}
color="primary"
autoFocus
>
ยืนยัน
</Button>
</DialogActions>
</Dialog>
</div>
</div>
);
}
}
export default compose(withStyles(styles), withRouter)(Databeautician);
import React, { Component } from "react";
import PropTypes from "prop-types";
import AppBar from "@material-ui/core/AppBar";
import CssBaseline from "@material-ui/core/CssBaseline";
import {
Divider,
Drawer,
Hidden,
IconButton,
Typography,
List,
ListItem,
ListItemIcon,
ListItemText,
Toolbar
} from "@material-ui/core";
import { withStyles } from "@material-ui/core/styles";
import InboxIcon from "@material-ui/icons/Inbox";
import MailIcon from "@material-ui/icons/Mail";
import MenuIcon from "@material-ui/icons/Menu";
import { withRouter } from "react-router-dom";
import compose from "recompose/compose";
import Profile from "../Profile";
import Addimage from "../Addimage";
import Work from "../Work";
const drawerWidth = 240;
const styles = theme => ({
root: {
display: "flex"
},
drawer: {
[theme.breakpoints.up("sm")]: {
width: drawerWidth,
flexShrink: 0
// zIndex: -1
}
},
appBar: {
[theme.breakpoints.up("sm")]: {
width: `calc(100% - ${drawerWidth}px)`,
marginLeft: drawerWidth
}
},
menuButton: {
marginRight: theme.spacing(2),
[theme.breakpoints.up("sm")]: {
display: "none"
},
zIndex: 2
},
toolbar: theme.mixins.toolbar,
drawerPaper: {
width: drawerWidth
},
content: {
flexGrow: 1,
padding: theme.spacing(3)
}
});
class ResponsiveDrawer extends Component {
state = {
mobileOpen: false,
path: "profile"
// path: "datashop"
};
handleDrawerToggle = () => {
this.setState(prevState => {
return { ...prevState, mobileOpen: !prevState.mobileOpen };
});
};
handleChangePath = path => {
this.setState({
path: path
});
};
drawer = () => {
const { classes } = this.props;
const { path } = this.state;
return (
<div>
<div
className={classes.toolbar}
style={{ backgroundColor: "#3f51b5", textAlign: "center" }}
>
<IconButton
edge="start"
color="inherit"
aria-label="menu"
Link
href="/"
style={{ color: "white" }}
>
B Beauty
</IconButton>
</div>
<Divider />
<List>
<ListItem
button
onClick={() => {
this.handleChangePath("profile");
}}
selected={path == "profile" ? true : false}
>
<ListItemIcon>
<InboxIcon />
</ListItemIcon>
<ListItemText primary="โปรไฟล์ร้าน" />
</ListItem>
<ListItem
button
onClick={() => {
this.handleChangePath("work");
}}
selected={path == "work" ? true : false}
>
<ListItemIcon>
<MailIcon />
</ListItemIcon>
<ListItemText primary="ตารางงาน" />
</ListItem>
<ListItem
button
onClick={() => {
this.handleChangePath("addimage");
}}
selected={path == "addimage" ? true : false}
>
<ListItemIcon>
<MailIcon />
</ListItemIcon>
<ListItemText primary="ภาพผลงาน" />
</ListItem>
</List>
</div>
);
};
render() {
const { classes, theme } = this.props;
const { mobileOpen, path } = this.state;
return (
<div className={classes.root}>
<CssBaseline />
<nav className={classes.drawer} aria-label="mailbox folders">
<Hidden smUp implementation="css">
<Drawer
variant="temporary"
anchor={theme.direction === "rtl" ? "right" : "left"}
open={mobileOpen}
onClose={this.handleDrawerToggle}
classes={{
paper: classes.drawerPaper
}}
ModalProps={{
keepMounted: true // Better open performance on mobile.
}}
>
{this.drawer()}
</Drawer>
</Hidden>
<Hidden xsDown implementation="css">
<Drawer
classes={{
paper: classes.drawerPaper
}}
variant="permanent"
open
>
{this.drawer()}
</Drawer>
</Hidden>
</nav>
<main className={classes.content}>
{path == "profile" ? <Profile /> : null}
{path == "addimage" ? <Addimage /> : null}
{path == "work" ? <Work /> : null}
</main>
</div>
);
}
}
ResponsiveDrawer.propTypes = {
classes: PropTypes.object.isRequired
};
export default compose(
withStyles(styles, { withTheme: true }),
withRouter
)(ResponsiveDrawer);
import React, { Component } from "react";
import { withStyles } from "@material-ui/core/styles";
import { withRouter } from "react-router-dom";
import compose from "recompose/compose";
import { DatePicker } from "@material-ui/pickers";
import { injectIntl, FormattedRelativeTime } from "react-intl";
import { th } from "date-fns/locale";
import { format } from "date-fns";
import { MenuIcon } from "@material-ui/icons/Menu";
import {
MuiPickersUtilsProvider,
KeyboardTimePicker,
KeyboardDatePicker,
} from '@material-ui/pickers';
const styles = theme => ({
root: {
height: 150,
flexGrow: 1,
transform: "translateZ(0)",
// The position fixed scoping doesn't work in IE 11.
// Disable this demo to preserve the others.
"@media all and (-ms-high-contrast: none)": {
display: "none"
}
}
});
class Work extends Component {
state = {
selectedDate : new Date()
};
handleChangeDate = newDate => {
console.log("newDate: ", newDate);
this.setState({
date: newDate
});
};
render() {
const { classes } = this.props;
// const tab = this.state.tab;
// หรือ
const { selectedDate } = this.state;
return (
<div className="row center">
<KeyboardDatePicker
disableToolbar
variant="inline"
format="dd/MM/yyyy"
margin="normal"
id="date-picker-inline"
label="เลือกวันที่"
value={selectedDate}
onChange={this.handleDateChange}
KeyboardButtonProps={{
'aria-label': 'change date',
}}
/>
</div>
);
}
}
export default compose(withStyles(styles), withRouter)(Work);
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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