Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
final-exam
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nawasan Wisitsingkhon
final-exam
Commits
bbf90a9e
Commit
bbf90a9e
authored
Oct 01, 2023
by
Nawasan Wisitsingkhon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change title page
parent
25a6bea2
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
42 additions
and
17 deletions
+42
-17
AddProduct.js
src/components/AddProduct.js
+3
-2
category.js
src/pages/admin/category.js
+11
-7
report.js
src/pages/admin/report.js
+6
-2
stock.js
src/pages/admin/stock.js
+6
-4
index.js
src/pages/index.js
+8
-2
login.js
src/pages/login.js
+4
-0
register.js
src/pages/register.js
+4
-0
No files found.
src/components/AddProduct.js
View file @
bbf90a9e
...
@@ -62,7 +62,7 @@ export default function AddProduct({ open, handleClose }) {
...
@@ -62,7 +62,7 @@ export default function AddProduct({ open, handleClose }) {
setImage
(
""
);
setImage
(
""
);
setCategory
(
0
);
setCategory
(
0
);
setMessage
({
message
:
"เพิ่มสินค้าสำเร็จ"
,
error
:
false
});
setMessage
({
message
:
"เพิ่มสินค้าสำเร็จ"
,
error
:
false
});
handleClose
()
handleClose
()
;
setTimeout
(()
=>
{
setTimeout
(()
=>
{
setMessage
({
message
:
""
,
error
:
false
});
setMessage
({
message
:
""
,
error
:
false
});
},
3000
);
},
3000
);
...
@@ -74,7 +74,7 @@ export default function AddProduct({ open, handleClose }) {
...
@@ -74,7 +74,7 @@ export default function AddProduct({ open, handleClose }) {
}
}
}
}
return
(
return
(
<>
<>
<
Snackbar
<
Snackbar
anchorOrigin
=
{{
horizontal
:
"center"
,
vertical
:
"top"
}}
anchorOrigin
=
{{
horizontal
:
"center"
,
vertical
:
"top"
}}
...
@@ -107,6 +107,7 @@ export default function AddProduct({ open, handleClose }) {
...
@@ -107,6 +107,7 @@ export default function AddProduct({ open, handleClose }) {
/>
/>
<
div
className
=
"text-left"
>
<
div
className
=
"text-left"
>
<
TextField
<
TextField
fullWidth
className
=
"m-1"
className
=
"m-1"
label
=
"รายละเอียด"
label
=
"รายละเอียด"
variant
=
"standard"
variant
=
"standard"
...
...
src/pages/admin/category.js
View file @
bbf90a9e
import
{
Add
}
from
"@mui/icons-material"
;
import
{
Add
}
from
"@mui/icons-material"
;
import
{
import
{
Snackbar
,
Box
,
Box
,
Button
,
Button
,
Grid
,
Grid
,
...
@@ -10,19 +9,17 @@ import {
...
@@ -10,19 +9,17 @@ import {
TableCell
,
TableCell
,
TableHead
,
TableHead
,
TableRow
,
TableRow
,
Alert
,
}
from
"@mui/material"
;
}
from
"@mui/material"
;
import
React
,
{
useState
,
use
Context
,
use
Effect
}
from
"react"
;
import
React
,
{
useState
,
useEffect
}
from
"react"
;
import
AddCategory
from
"@/components/category/AddCategory"
;
import
AddCategory
from
"@/components/category/AddCategory"
;
import
axios
from
"axios"
;
import
axios
from
"axios"
;
import
{
Delete
}
from
"@mui/icons-material"
;
import
{
Delete
}
from
"@mui/icons-material"
;
import
{
Edit
}
from
"@mui/icons-material"
;
import
{
Edit
}
from
"@mui/icons-material"
;
import
UpdateCategory
from
"@/components/category/UpdateCategory"
;
import
UpdateCategory
from
"@/components/category/UpdateCategory"
;
import
{
UserContext
}
from
"../_app"
;
import
DeleteCategory
from
"@/components/category/DeleteCategory"
;
import
DeleteCategory
from
"@/components/category/DeleteCategory"
;
import
Head
from
"next/head"
;
export
default
function
AdminCategory
()
{
export
default
function
AdminCategory
()
{
const
user
=
useContext
(
UserContext
);
const
[
modal
,
setModal
]
=
useState
(
false
);
const
[
modal
,
setModal
]
=
useState
(
false
);
const
[
message
,
setMessage
]
=
useState
({
message
:
""
,
error
:
false
});
const
[
message
,
setMessage
]
=
useState
({
message
:
""
,
error
:
false
});
const
[
deleteState
,
setDeleteState
]
=
useState
({
const
[
deleteState
,
setDeleteState
]
=
useState
({
...
@@ -40,8 +37,12 @@ export default function AdminCategory() {
...
@@ -40,8 +37,12 @@ export default function AdminCategory() {
setCategory
(
res
.
data
);
setCategory
(
res
.
data
);
});
});
};
};
useEffect
(
fetchCategory
,
[
modal
,
updateState
,
message
,
deleteState
]);
useEffect
(
fetchCategory
,
[
modal
,
updateState
,
message
,
deleteState
]);
return
(
return
(
<>
<
Head
>
<
title
>
จัดการหมวดหมู่
|
admin
<
/title
>
<
/Head
>
<
Box
>
<
Box
>
<
Grid
container
>
<
Grid
container
>
<
Grid
item
lg
=
{
3
}
md
=
{
0
}
><
/Grid
>
<
Grid
item
lg
=
{
3
}
md
=
{
0
}
><
/Grid
>
...
@@ -87,7 +88,9 @@ export default function AdminCategory() {
...
@@ -87,7 +88,9 @@ export default function AdminCategory() {
<
TableCell
sx
=
{{
maxWidth
:
10
}}
>
<
TableCell
sx
=
{{
maxWidth
:
10
}}
>
<
Button
<
Button
color
=
"error"
color
=
"error"
onClick
=
{()
=>
setDeleteState
({
open
:
true
,
id
:
cate
.
id
})}
onClick
=
{()
=>
setDeleteState
({
open
:
true
,
id
:
cate
.
id
})
}
>
>
<
Delete
/>
<
Delete
/>
<
/Button
>
<
/Button
>
...
@@ -120,5 +123,6 @@ export default function AdminCategory() {
...
@@ -120,5 +123,6 @@ export default function AdminCategory() {
/
>
/
>
)}
)}
<
/Box
>
<
/Box
>
<
/
>
);
);
}
}
src/pages/admin/report.js
View file @
bbf90a9e
...
@@ -4,10 +4,14 @@ import { Grid, Paper } from "@mui/material";
...
@@ -4,10 +4,14 @@ import { Grid, Paper } from "@mui/material";
import
Chart
from
"@/components/dashboard/Chart"
;
import
Chart
from
"@/components/dashboard/Chart"
;
import
Deposits
from
"@/components/dashboard/Deposits"
;
import
Deposits
from
"@/components/dashboard/Deposits"
;
import
Orders
from
"@/components/dashboard/Orders"
;
import
Orders
from
"@/components/dashboard/Orders"
;
import
Head
from
"next/head"
;
export
default
function
Report
()
{
export
default
function
Report
()
{
return
(
return
(
<
main
>
<>
<
Head
>
<
title
>
รายงาน
|
admin
<
/title
>
<
/Head
>
<
DashboardLayout
>
<
DashboardLayout
>
<
Grid
container
spacing
=
{
3
}
>
<
Grid
container
spacing
=
{
3
}
>
{
/* Chart */
}
{
/* Chart */
}
...
@@ -44,6 +48,6 @@ export default function Report() {
...
@@ -44,6 +48,6 @@ export default function Report() {
<
/Grid
>
<
/Grid
>
<
/Grid
>
<
/Grid
>
<
/DashboardLayout
>
<
/DashboardLayout
>
<
/
main
>
<
/
>
);
);
}
}
src/pages/admin/stock.js
View file @
bbf90a9e
...
@@ -6,21 +6,18 @@ import {
...
@@ -6,21 +6,18 @@ import {
Card
,
Card
,
CardActions
,
CardActions
,
CardContent
,
CardContent
,
CardHeader
,
CardMedia
,
CardMedia
,
Paper
,
Table
,
Table
,
TableBody
,
TableBody
,
TableCell
,
TableCell
,
TableHead
,
TableRow
,
TableRow
,
Typography
,
Typography
,
}
from
"@mui/material"
;
}
from
"@mui/material"
;
import
{
useState
,
useEffect
}
from
"react"
;
import
{
useState
,
useEffect
}
from
"react"
;
import
axios
from
"axios"
;
import
axios
from
"axios"
;
import
Head
from
"next/head"
;
import
{
Delete
}
from
"@mui/icons-material"
;
import
{
Delete
}
from
"@mui/icons-material"
;
import
{
Edit
}
from
"@mui/icons-material"
;
import
{
Edit
}
from
"@mui/icons-material"
;
export
default
function
Stock
()
{
export
default
function
Stock
()
{
const
[
modal
,
setModal
]
=
useState
(
false
);
const
[
modal
,
setModal
]
=
useState
(
false
);
const
[
products
,
setProducts
]
=
useState
([]);
const
[
products
,
setProducts
]
=
useState
([]);
...
@@ -39,6 +36,10 @@ export default function Stock() {
...
@@ -39,6 +36,10 @@ export default function Stock() {
},
[]);
},
[]);
return
(
return
(
<>
<
Head
>
<
title
>
รายการสินค้า
|
admin
<
/title
>
<
/Head
>
<
Box
>
<
Box
>
<
Box
sx
=
{{
mb
:
2
,
textAlign
:
"right"
}}
>
<
Box
sx
=
{{
mb
:
2
,
textAlign
:
"right"
}}
>
<
Button
onClick
=
{()
=>
setModal
(
!
modal
)}
>
<
Button
onClick
=
{()
=>
setModal
(
!
modal
)}
>
...
@@ -94,5 +95,6 @@ export default function Stock() {
...
@@ -94,5 +95,6 @@ export default function Stock() {
))}
))}
<
AddProduct
open
=
{
modal
}
handleClose
=
{()
=>
setModal
(
false
)}
/
>
<
AddProduct
open
=
{
modal
}
handleClose
=
{()
=>
setModal
(
false
)}
/
>
<
/Box
>
<
/Box
>
<
/
>
);
);
}
}
src/pages/index.js
View file @
bbf90a9e
import
{
Inter
}
from
'next/font/google'
import
{
Inter
}
from
'next/font/google'
import
Head
from
'next/head'
const
inter
=
Inter
({
subsets
:
[
'latin'
]
})
const
inter
=
Inter
({
subsets
:
[
'latin'
]
})
export
default
function
Home
()
{
export
default
function
Home
()
{
return
(
return
(
<
main
>
<>
<
Head
>
<
title
>
หน้าหลัก
|
OpenShop
<
/title
>
<
/Head
>
<
div
>
<
h1
>
Hello
world
<
/h1
>
<
h1
>
Hello
world
<
/h1
>
<
/main
>
<
/div
>
<
/
>
)
)
}
}
src/pages/login.js
View file @
bbf90a9e
...
@@ -7,6 +7,7 @@ import { Container } from "@mui/material";
...
@@ -7,6 +7,7 @@ import { Container } from "@mui/material";
import
{
Google
}
from
"@mui/icons-material"
;
import
{
Google
}
from
"@mui/icons-material"
;
import
{
useState
}
from
"react"
;
import
{
useState
}
from
"react"
;
import
axios
from
"axios"
;
import
axios
from
"axios"
;
import
Head
from
"next/head"
;
import
userCookie
from
"@/components/lib/userCookie"
;
import
userCookie
from
"@/components/lib/userCookie"
;
export
default
function
Login
()
{
export
default
function
Login
()
{
...
@@ -45,6 +46,9 @@ export default function Login() {
...
@@ -45,6 +46,9 @@ export default function Login() {
return
(
return
(
<
div
>
<
div
>
<
Head
>
<
title
>
เข้าสู่ระบบ
|
OpenShop
<
/title
>
<
/Head
>
<
Container
>
<
Container
>
<
Snackbar
<
Snackbar
ContentProps
=
{{
className
:
"bg-red-500"
}}
ContentProps
=
{{
className
:
"bg-red-500"
}}
...
...
src/pages/register.js
View file @
bbf90a9e
...
@@ -7,6 +7,7 @@ import { Container } from "@mui/material";
...
@@ -7,6 +7,7 @@ import { Container } from "@mui/material";
import
{
Google
}
from
"@mui/icons-material"
;
import
{
Google
}
from
"@mui/icons-material"
;
import
{
useState
}
from
"react"
;
import
{
useState
}
from
"react"
;
import
axios
from
"axios"
;
import
axios
from
"axios"
;
import
Head
from
"next/head"
;
export
default
function
Login
()
{
export
default
function
Login
()
{
const
[
errorMessage
,
setErrorMessage
]
=
useState
(
""
);
const
[
errorMessage
,
setErrorMessage
]
=
useState
(
""
);
...
@@ -66,6 +67,9 @@ export default function Login() {
...
@@ -66,6 +67,9 @@ export default function Login() {
return
(
return
(
<
div
>
<
div
>
<
Head
>
<
title
>
สมัครสมาชิก
|
OpenShop
<
/title
>
<
/Head
>
<
Container
>
<
Container
>
<
Snackbar
<
Snackbar
ContentProps
=
{{
className
:
"bg-red-500"
}}
ContentProps
=
{{
className
:
"bg-red-500"
}}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment