Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2022-158
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2022-158
2022-158
Commits
4f5d2b3e
Commit
4f5d2b3e
authored
Oct 06, 2022
by
Thushara Thiwanka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CREATE: assignment view integrated
parent
f408c290
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
92 deletions
+14
-92
frontend/src/pages/ViewAssignment.js
frontend/src/pages/ViewAssignment.js
+14
-92
No files found.
frontend/src/pages/ViewAssignment.js
View file @
4f5d2b3e
import
axios
from
"
axios
"
;
import
{
Link
}
from
"
react-router-dom
"
;
import
{
Link
,
useParams
}
from
"
react-router-dom
"
;
import
React
,
{
useEffect
,
useState
}
from
"
react
"
;
import
Sidebar
from
"
../components/sidebar/Sidebar
"
;
import
TopNav
from
"
../components/topnav/TopNav
"
;
...
...
@@ -10,8 +10,10 @@ import { RiDeleteBinLine } from "react-icons/ri";
import
Popup
from
"
./Popup
"
;
const
ViewAssignment
=
()
=>
{
const
{
id
}
=
useParams
();
const
siteId
=
localStorage
.
getItem
(
"
site
"
);
const
[
Materials
,
setMaterials
]
=
useState
([]);
const
[
assignment
,
setAssignment
]
=
useState
({});
const
students
=
[
{
email
:
"
email@gmail.com
"
,
...
...
@@ -49,63 +51,23 @@ const ViewAssignment = () => {
approved
:
"
success
"
,
rejected
:
"
danger
"
,
};
const
[
OrderDetail
,
setOrderDetail
]
=
useState
([]);
const
[
Loading
,
setLoading
]
=
useState
(
false
);
const
[
Trigger
,
setTrigger
]
=
useState
(
false
);
const
[
Name
,
setName
]
=
useState
(
""
);
const
[
Id
,
setId
]
=
useState
(
""
);
const
[
ItemName
,
setItemName
]
=
useState
(
""
);
const
[
Description
,
setDescription
]
=
useState
(
""
);
const
[
Order
,
setOrder
]
=
useState
({
item
:
{},
quantity
:
0
,
siteid
:
siteId
,
requiredDate
:
""
,
urgentOrder
:
false
,
});
console
.
log
(
Order
);
const
FetchData
=
async
()
=>
{
const
resMaterials
=
await
axios
.
get
(
`materials`
);
setMaterials
(
resMaterials
.
data
.
materials
);
const
resOrders
=
await
axios
.
get
(
"
/orders
"
);
setOrderDetail
(
resOrders
.
data
.
orders
);
if
(
resOrders
.
statusText
===
"
OK
"
)
{
setLoading
(
true
);
const
getAssignment
=
async
()
=>
{
setLoading
(
true
);
try
{
const
res
=
await
axios
.
get
(
"
/assignments/
"
+
id
);
console
.
log
(
res
);
setAssignment
(
res
.
data
.
assignment
);
setLoading
(
false
);
}
catch
(
err
)
{
console
.
log
(
err
.
response
);
}
};
useEffect
(()
=>
{
FetchData
();
getAssignment
();
},
[]);
const
deleteHandler
=
async
id
=>
{
console
.
log
(
id
);
try
{
const
res
=
await
axios
.
delete
(
`/orders/delete/
${
id
}
`
);
if
(
res
.
statusText
===
"
OK
"
)
{
window
.
location
.
reload
();
}
}
catch
(
Err
)
{
console
.
log
(
Err
.
response
);
}
};
const
orderHandler
=
async
()
=>
{
try
{
console
.
log
(
Order
);
const
res
=
await
axios
.
post
(
"
/orders
"
,
Order
);
if
(
res
.
statusText
===
"
OK
"
)
{
window
.
location
.
reload
();
}
}
catch
(
Err
)
{
console
.
log
(
Err
.
response
);
}
};
const
renderOrderHead
=
(
item
,
index
)
=>
<
th
key
=
{
index
}
>
{
item
}
<
/th>
;
const
renderOrderBody
=
(
item
,
index
)
=>
(
...
...
@@ -124,27 +86,6 @@ const ViewAssignment = () => {
<
td
>
{
item
.
submittedAt
}
<
/td
>
<
td
>
<
div
style
=
{{
display
:
"
flex
"
,
alignItems
:
"
center
"
}}
>
<
button
className
=
"
action-btn check
"
>
<
i
className
=
"
bx bx-check
"
onClick
=
{()
=>
{
if
(
window
.
confirm
(
"
Are you sure to accept this submission?
"
))
{
// successHandler(item._id);
}
}}
><
/i
>
<
/button
>
<
button
className
=
"
action-btn x
"
style
=
{{
marginRight
:
"
2rem
"
}}
onClick
=
{()
=>
{
if
(
window
.
confirm
(
"
Are you sure to remove this submission?
"
))
{
deleteHandler
(
item
.
_id
);
}
}}
>
<
RiDeleteBinLine
/>
<
/button
>
<
Link
to
=
{
``
}
>
<
button
className
=
"
view-btn
"
>
View
<
/button
>
<
/Link
>
...
...
@@ -159,7 +100,6 @@ const ViewAssignment = () => {
<
div
id
=
"
main
"
className
=
"
layout__content
"
>
<
TopNav
/>
<
div
className
=
"
layout__content-main
"
>
<
h1
className
=
"
page-header
"
>
CTSE
Assignment
01
<
/h1
>
<
div
className
=
"
row
"
>
<
div
className
=
"
col-12
"
>
<
div
className
=
"
card
"
>
...
...
@@ -176,25 +116,7 @@ const ViewAssignment = () => {
<
/div
>
<
/div
>
<
br
/>
<
p
>
“
GlamourFashions
(
GF
)
”
is
a
clothing
store
situated
in
Colombo
and
it
’
s
planning
to
build
an
online
shopping
system
to
promote
their
sales
further
.
The
management
of
clothing
store
hired
you
as
a
System
Analyst
and
asked
to
come
up
with
the
design
models
for
GlamourFashions
Online
Store
(
GFOS
).
GlamourFashions
(
GF
)
Online
Clothing
Store
is
expected
to
organize
clothing
items
under
several
categories
like
office
wear
,
casual
wear
,
evening
wear
and
so
on
.
A
visitor
can
browse
on
items
without
being
registering
to
the
system
.
If
he
/
she
likes
to
order
item
,
the
system
facilitates
to
add
selected
items
into
the
shopping
cart
and
directly
move
to
checkout
option
.
If
the
user
interested
to
be
a
regular
user
,
the
system
will
provide
“
registration
”
facility
as
well
.
Without
even
registering
,
the
user
can
directly
go
for
the
“
checkout
”
.
For
a
registered
user
,
the
system
is
expected
to
send
a
promotion
code
for
users
’
mobile
every
month
which
can
be
used
only
once
.
when
the
user
logs
into
the
system
to
do
online
shopping
,
user
can
enter
this
code
which
will
give
a
5
%
discount
for
the
order
he
/
she
makes
.
If
the
user
does
not
use
the
code
within
the
month
,
automatically
the
system
must
“
discard
promotion
code
”
.
If
it
’
s
been
already
used
,
the
system
must
display
a
message
saying
“
it
’
s
already
been
used
”
.
<
/p
>
<
p
>
{
assignment
.
content
}
<
/p
>
<
/div
>
<
/div
>
<
/div
>
...
...
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