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 }) {
setImage
(
""
);
setCategory
(
0
);
setMessage
({
message
:
"เพิ่มสินค้าสำเร็จ"
,
error
:
false
});
handleClose
()
handleClose
()
;
setTimeout
(()
=>
{
setMessage
({
message
:
""
,
error
:
false
});
},
3000
);
...
...
@@ -74,7 +74,7 @@ export default function AddProduct({ open, handleClose }) {
}
}
return
(
return
(
<>
<
Snackbar
anchorOrigin
=
{{
horizontal
:
"center"
,
vertical
:
"top"
}}
...
...
@@ -107,6 +107,7 @@ export default function AddProduct({ open, handleClose }) {
/>
<
div
className
=
"text-left"
>
<
TextField
fullWidth
className
=
"m-1"
label
=
"รายละเอียด"
variant
=
"standard"
...
...
src/pages/admin/category.js
View file @
bbf90a9e
import
{
Add
}
from
"@mui/icons-material"
;
import
{
Snackbar
,
Box
,
Button
,
Grid
,
...
...
@@ -10,19 +9,17 @@ import {
TableCell
,
TableHead
,
TableRow
,
Alert
,
}
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
axios
from
"axios"
;
import
{
Delete
}
from
"@mui/icons-material"
;
import
{
Edit
}
from
"@mui/icons-material"
;
import
UpdateCategory
from
"@/components/category/UpdateCategory"
;
import
{
UserContext
}
from
"../_app"
;
import
DeleteCategory
from
"@/components/category/DeleteCategory"
;
import
Head
from
"next/head"
;
export
default
function
AdminCategory
()
{
const
user
=
useContext
(
UserContext
);
const
[
modal
,
setModal
]
=
useState
(
false
);
const
[
message
,
setMessage
]
=
useState
({
message
:
""
,
error
:
false
});
const
[
deleteState
,
setDeleteState
]
=
useState
({
...
...
@@ -40,8 +37,12 @@ export default function AdminCategory() {
setCategory
(
res
.
data
);
});
};
useEffect
(
fetchCategory
,
[
modal
,
updateState
,
message
,
deleteState
]);
useEffect
(
fetchCategory
,
[
modal
,
updateState
,
message
,
deleteState
]);
return
(
<>
<
Head
>
<
title
>
จัดการหมวดหมู่
|
admin
<
/title
>
<
/Head
>
<
Box
>
<
Grid
container
>
<
Grid
item
lg
=
{
3
}
md
=
{
0
}
><
/Grid
>
...
...
@@ -87,7 +88,9 @@ export default function AdminCategory() {
<
TableCell
sx
=
{{
maxWidth
:
10
}}
>
<
Button
color
=
"error"
onClick
=
{()
=>
setDeleteState
({
open
:
true
,
id
:
cate
.
id
})}
onClick
=
{()
=>
setDeleteState
({
open
:
true
,
id
:
cate
.
id
})
}
>
<
Delete
/>
<
/Button
>
...
...
@@ -120,5 +123,6 @@ export default function AdminCategory() {
/
>
)}
<
/Box
>
<
/
>
);
}
src/pages/admin/report.js
View file @
bbf90a9e
...
...
@@ -4,10 +4,14 @@ import { Grid, Paper } from "@mui/material";
import
Chart
from
"@/components/dashboard/Chart"
;
import
Deposits
from
"@/components/dashboard/Deposits"
;
import
Orders
from
"@/components/dashboard/Orders"
;
import
Head
from
"next/head"
;
export
default
function
Report
()
{
return
(
<
main
>
<>
<
Head
>
<
title
>
รายงาน
|
admin
<
/title
>
<
/Head
>
<
DashboardLayout
>
<
Grid
container
spacing
=
{
3
}
>
{
/* Chart */
}
...
...
@@ -44,6 +48,6 @@ export default function Report() {
<
/Grid
>
<
/Grid
>
<
/DashboardLayout
>
<
/
main
>
<
/
>
);
}
src/pages/admin/stock.js
View file @
bbf90a9e
...
...
@@ -6,21 +6,18 @@ import {
Card
,
CardActions
,
CardContent
,
CardHeader
,
CardMedia
,
Paper
,
Table
,
TableBody
,
TableCell
,
TableHead
,
TableRow
,
Typography
,
}
from
"@mui/material"
;
import
{
useState
,
useEffect
}
from
"react"
;
import
axios
from
"axios"
;
import
Head
from
"next/head"
;
import
{
Delete
}
from
"@mui/icons-material"
;
import
{
Edit
}
from
"@mui/icons-material"
;
export
default
function
Stock
()
{
const
[
modal
,
setModal
]
=
useState
(
false
);
const
[
products
,
setProducts
]
=
useState
([]);
...
...
@@ -39,6 +36,10 @@ export default function Stock() {
},
[]);
return
(
<>
<
Head
>
<
title
>
รายการสินค้า
|
admin
<
/title
>
<
/Head
>
<
Box
>
<
Box
sx
=
{{
mb
:
2
,
textAlign
:
"right"
}}
>
<
Button
onClick
=
{()
=>
setModal
(
!
modal
)}
>
...
...
@@ -94,5 +95,6 @@ export default function Stock() {
))}
<
AddProduct
open
=
{
modal
}
handleClose
=
{()
=>
setModal
(
false
)}
/
>
<
/Box
>
<
/
>
);
}
src/pages/index.js
View file @
bbf90a9e
import
{
Inter
}
from
'next/font/google'
import
Head
from
'next/head'
const
inter
=
Inter
({
subsets
:
[
'latin'
]
})
export
default
function
Home
()
{
return
(
<
main
>
<>
<
Head
>
<
title
>
หน้าหลัก
|
OpenShop
<
/title
>
<
/Head
>
<
div
>
<
h1
>
Hello
world
<
/h1
>
<
/main
>
<
/div
>
<
/
>
)
}
src/pages/login.js
View file @
bbf90a9e
...
...
@@ -7,6 +7,7 @@ import { Container } from "@mui/material";
import
{
Google
}
from
"@mui/icons-material"
;
import
{
useState
}
from
"react"
;
import
axios
from
"axios"
;
import
Head
from
"next/head"
;
import
userCookie
from
"@/components/lib/userCookie"
;
export
default
function
Login
()
{
...
...
@@ -45,6 +46,9 @@ export default function Login() {
return
(
<
div
>
<
Head
>
<
title
>
เข้าสู่ระบบ
|
OpenShop
<
/title
>
<
/Head
>
<
Container
>
<
Snackbar
ContentProps
=
{{
className
:
"bg-red-500"
}}
...
...
src/pages/register.js
View file @
bbf90a9e
...
...
@@ -7,6 +7,7 @@ import { Container } from "@mui/material";
import
{
Google
}
from
"@mui/icons-material"
;
import
{
useState
}
from
"react"
;
import
axios
from
"axios"
;
import
Head
from
"next/head"
;
export
default
function
Login
()
{
const
[
errorMessage
,
setErrorMessage
]
=
useState
(
""
);
...
...
@@ -66,6 +67,9 @@ export default function Login() {
return
(
<
div
>
<
Head
>
<
title
>
สมัครสมาชิก
|
OpenShop
<
/title
>
<
/Head
>
<
Container
>
<
Snackbar
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