Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
warehouse-management
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ascend
warehouse-management
Commits
cb28455f
Commit
cb28455f
authored
May 08, 2021
by
Darrick Yong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add final touches on order details and search
parent
9d24e12b
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
51 additions
and
15 deletions
+51
-15
filter.css
frontend/public/stylesheets/filter.css
+4
-3
order.css
frontend/public/stylesheets/order.css
+1
-1
reset.css
frontend/public/stylesheets/reset.css
+3
-0
Input.jsx
frontend/src/components/atoms/Input.jsx
+11
-2
Select.jsx
frontend/src/components/atoms/Select.jsx
+2
-1
Search.jsx
frontend/src/components/filter/Search.jsx
+25
-6
OrderDetails.jsx
frontend/src/components/order/OrderDetails.jsx
+5
-2
No files found.
frontend/public/stylesheets/filter.css
View file @
cb28455f
...
...
@@ -88,7 +88,7 @@
.search
>
select
{
cursor
:
pointer
;
border
:
none
;
padding
:
10px
0
;
font-size
:
16px
;
font-family
:
"Times New Roman"
,
Times
,
serif
;
}
...
...
@@ -106,8 +106,9 @@
background
:
#2b4162
;
}
.error
{
color
:
red
;
.search-select-error
,
.search-input-error
{
border
:
2px
solid
#c1292e
;
}
.fs-collapse
{
...
...
frontend/public/stylesheets/order.css
View file @
cb28455f
...
...
@@ -156,7 +156,7 @@
font-weight
:
400
;
font-size
:
16px
;
font-style
:
italic
;
width
:
2
80
px
;
width
:
2
75
px
;
}
.order-details-dates
>
div
{
...
...
frontend/public/stylesheets/reset.css
View file @
cb28455f
...
...
@@ -41,3 +41,6 @@ table {
border-collapse
:
collapse
;
border-spacing
:
0
;
}
select
:focus
,
input
:focus
{
outline
:
none
;
}
\ No newline at end of file
frontend/src/components/atoms/Input.jsx
View file @
cb28455f
const
Input
=
({
className
,
type
,
placeholder
,
value
,
onChange
,
onKeyPress
})
=>
(
const
Input
=
({
className
,
type
,
placeholder
,
value
,
onChange
,
onBlur
,
onKeyPress
,
})
=>
(
<
input
type=
{
type
||
"text"
}
className=
{
className
}
placeholder=
{
placeholder
}
value=
{
value
}
onChange=
{
onChange
}
onBlur=
{
onBlur
}
onKeyPress=
{
onKeyPress
}
/>
);
...
...
frontend/src/components/atoms/Select.jsx
View file @
cb28455f
const
Select
=
({
defaultVal
,
value
,
onChange
,
options
})
=>
(
const
Select
=
({
className
,
defaultVal
,
value
,
onChange
,
options
})
=>
(
<
select
className=
{
className
}
value=
{
value
?
value
:
defaultVal
}
onChange=
{
onChange
}
>
...
...
frontend/src/components/filter/Search.jsx
View file @
cb28455f
...
...
@@ -9,14 +9,21 @@ const Search = ({ orders, setOrdersToShow, setFiltersOn }) => {
const
[
searchInput
,
setSearchInput
]
=
useState
(
""
);
const
[
searchBy
,
setSearchBy
]
=
useState
(
""
);
const
[
error
,
setError
]
=
useState
(
""
);
const
[
inputError
,
setInputError
]
=
useState
(
false
);
const
[
byError
,
setByError
]
=
useState
(
false
);
const
searchOptions
=
[
"Warehouse ID"
,
"Order ID"
];
const
search
=
()
=>
{
if
(
!
searchInput
.
length
)
{
setError
(
"Please enter a search parameter."
);
setInputError
(
false
);
setByError
(
false
);
if
(
!
searchInput
.
length
&&
!
searchBy
.
length
)
{
setInputError
(
true
);
setByError
(
true
);
}
else
if
(
!
searchInput
.
length
)
{
setInputError
(
true
);
}
else
if
(
!
searchBy
.
length
)
{
set
Error
(
"Please enter search method."
);
set
ByError
(
true
);
}
else
{
const
searchResult
=
{
allIds
:
[],
byId
:
{}
};
const
searchedOrder
=
...
...
@@ -33,12 +40,17 @@ const Search = ({ orders, setOrdersToShow, setFiltersOn }) => {
if
(
searchBy
.
length
)
{
setOrdersToShow
(
searchResult
);
}
setError
(
""
);
setSearchInput
(
""
);
setFiltersOn
(
false
);
}
};
const
handleInputBlur
=
(
e
)
=>
{
if
(
!
e
.
target
.
value
.
length
)
{
setInputError
(
true
);
}
}
const
handleSearchEnter
=
(
e
)
=>
{
if
(
e
.
key
===
"Enter"
)
{
search
();
...
...
@@ -49,21 +61,28 @@ const Search = ({ orders, setOrdersToShow, setFiltersOn }) => {
<
div
className=
"search"
>
<
div
className=
"text"
>
Search:
</
div
>
<
Select
className=
{
byError
?
"search-select-error"
:
""
}
defaultVal=
{
"Choose one.."
}
value=
{
searchBy
}
options=
{
searchOptions
}
onChange=
{
(
e
)
=>
{
setByError
(
false
);
setSearchBy
(
e
.
target
.
selectedOptions
[
0
].
value
);
}
}
/>
<
Input
className=
{
inputError
?
"search-input-error"
:
""
}
placeholder=
{
"Search by ID"
}
value=
{
searchInput
}
onChange=
{
(
e
)
=>
setSearchInput
(
e
.
target
.
value
)
}
onChange=
{
(
e
)
=>
{
setInputError
(
false
);
setSearchInput
(
e
.
target
.
value
);
}
}
onBlur=
{
handleInputBlur
}
onKeyPress=
{
handleSearchEnter
}
/>
<
Button
className=
"search-btn"
text=
"Search"
onClick=
{
search
}
/>
{
error
.
length
?
<
Error
text=
{
error
}
/>
:
null
}
{
/* {error.length ? <Error text={error} /> : null} */
}
</
div
>
);
};
...
...
frontend/src/components/order/OrderDetails.jsx
View file @
cb28455f
...
...
@@ -10,8 +10,11 @@ const OrderDetails = ({ order, showDetails }) => {
const
month
=
date
.
toLocaleString
(
"default"
,
{
month
:
"short"
});
const
day
=
date
.
getDate
();
const
year
=
date
.
getFullYear
();
const
time
=
date
.
toLocaleTimeString
(
"en-US"
);
return
`
${
month
}
${
day
>
9
?
day
:
`0
${
day
}
`
}
,
${
year
}
at
${
time
}
`
;
const
hour
=
date
.
getHours
();
const
cHour
=
hour
>
12
?
hour
-
12
:
hour
;
const
minute
=
date
.
getMinutes
();
const
time
=
`
${
cHour
>
9
?
cHour
:
`0
${
cHour
}
`
}
:
${
minute
>
9
?
minute
:
`0
${
minute
}
`
}
`
;
return
`
${
month
}
${
day
>
9
?
day
:
`0
${
day
}
`
}
,
${
year
}
at
${
time
}
${
hour
>
11
?
"PM"
:
"AM"
}
`
;
};
return
(
...
...
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