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
9ff8cb19
Commit
9ff8cb19
authored
Oct 05, 2023
by
Nawasan Wisitsingkhon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
report deposites in report
parent
c24a22ef
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
8 deletions
+35
-8
Deposits.js
src/components/dashboard/Deposits.js
+34
-7
[id].js
src/pages/admin/order/[id].js
+1
-1
No files found.
src/components/dashboard/Deposits.js
View file @
9ff8cb19
import
*
as
React
from
'react'
;
import
*
as
React
from
"react"
;
import
Link
from
'@mui/material/Link'
;
import
Link
from
"@mui/material/Link"
;
import
Typography
from
'@mui/material/Typography'
;
import
Typography
from
"@mui/material/Typography"
;
import
Title
from
'./Title'
;
import
Title
from
"./Title"
;
import
{
AdminOrderContext
}
from
"../layout/AdminLayout"
;
import
{
UserContext
}
from
"@/pages/_app"
;
function
preventDefault
(
event
)
{
function
preventDefault
(
event
)
{
event
.
preventDefault
();
event
.
preventDefault
();
}
}
export
default
function
Deposits
()
{
export
default
function
Deposits
()
{
const
[
totalSelling
,
setTotalSelling
]
=
React
.
useState
(
0
);
const
adminOrder
=
React
.
useContext
(
AdminOrderContext
);
const
user
=
React
.
useContext
(
UserContext
);
const
[
month
,
setMonth
]
=
React
.
useState
(
""
);
const
[
year
,
setYear
]
=
React
.
useState
(
"2023"
);
React
.
useEffect
(()
=>
{
if
(
!
user
.
value
?.
token
||
adminOrder
.
value
.
length
===
0
)
return
;
let
total
=
0
;
const
date
=
new
Date
(
adminOrder
.
value
[
0
].
date
);
const
month_now
=
date
.
toLocaleString
(
"default"
,
{
month
:
"long"
});
const
year_now
=
date
.
getFullYear
();
for
(
let
i
=
0
;
i
<
adminOrder
.
value
.
length
;
i
++
)
{
let
d
=
new
Date
(
adminOrder
.
value
[
i
].
date
);
let
m
=
date
.
toLocaleString
(
"default"
,
{
month
:
"long"
});
let
y
=
date
.
getFullYear
();
if
(
m
===
month_now
&&
y
===
year_now
)
{
total
+=
Number
(
adminOrder
.
value
[
i
].
total_price
);
}
}
setMonth
(
month_now
)
setYear
(
year_now
)
setTotalSelling
(
total
);
},
[
user
]);
return
(
return
(
<
React
.
Fragment
>
<
React
.
Fragment
>
<
Title
>
Recent
Deposits
<
/Title
>
<
Title
>
ยอดขายทั้งหมด
<
/Title
>
<
Typography
component
=
"p"
variant
=
"h4"
>
<
Typography
component
=
"p"
variant
=
"h4"
>
$
3
,
024.00
$
{
Number
(
totalSelling
).
toLocaleString
()}
<
/Typography
>
<
/Typography
>
<
Typography
color
=
"text.secondary"
sx
=
{{
flex
:
1
}}
>
<
Typography
color
=
"text.secondary"
sx
=
{{
flex
:
1
}}
>
on
15
March
,
2019
on
{
month
},
{
year
}
<
/Typography
>
<
/Typography
>
<
div
>
<
div
>
<
Link
color
=
"primary"
href
=
"#"
onClick
=
{
preventDefault
}
>
<
Link
color
=
"primary"
href
=
"#"
onClick
=
{
preventDefault
}
>
...
...
src/pages/admin/order/[id].js
View file @
9ff8cb19
...
@@ -63,7 +63,7 @@ export default function AdminOrderDetail() {
...
@@ -63,7 +63,7 @@ export default function AdminOrderDetail() {
{
orderDetailList
.
length
?
(
{
orderDetailList
.
length
?
(
<
Box
>
<
Box
>
<
Box
sx
=
{{
textAlign
:
"right"
,
p
:
1
}}
>
<
Box
sx
=
{{
textAlign
:
"right"
,
p
:
1
}}
>
<
Link
href
=
"/order"
>
<
Link
href
=
"/
admin/
order"
>
<
Button
color
=
"error"
>
<
Button
color
=
"error"
>
<
ArrowBackIos
/>
ย้อนกลับ
<
ArrowBackIos
/>
ย้อนกลับ
<
/Button
>
<
/Button
>
...
...
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