Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
inventory-promotion-react
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
0
Merge Requests
0
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
inventory-promotion-react
Commits
d281331f
Commit
d281331f
authored
May 13, 2021
by
John Lam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix to update forms and styles
parent
0b732f3a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
6 additions
and
16 deletions
+6
-16
Main.jsx
src/component/Main.jsx
+2
-0
PromotionsIndexComponent.jsx
src/component/promo_index/PromotionsIndexComponent.jsx
+1
-2
PromotionNewFormComponent.jsx
src/component/promotionforms/PromotionNewFormComponent.jsx
+1
-8
UpdatePromotionForm.jsx
src/component/promotionforms/UpdatePromotionForm.jsx
+1
-5
promoStyle.css
src/component/promotionforms/promoStyle.css
+1
-1
No files found.
src/component/Main.jsx
View file @
d281331f
...
...
@@ -5,6 +5,7 @@ import ProductIndex from "./ProductIndex";
import
SearchResults
from
"./SearchResults"
;
import
PromotionNewFormComponent
from
"./promotionforms/PromotionNewFormComponent"
;
import
PromotionIndexComponent
from
"./promo_index/PromotionsIndexComponent"
;
import
PromotionUpdateFormComponent
from
"./promotionforms/UpdatePromotionForm"
;
export
default
function
Main
()
{
...
...
@@ -22,6 +23,7 @@ export default function Main() {
path=
"/promos/new"
component=
{
PromotionNewFormComponent
}
></
AuthRoute
>
<
AuthRoute
exact
path=
"/promos/:promoId/update"
component=
{
PromotionUpdateFormComponent
}
></
AuthRoute
>
<
AuthRoute
exact
path=
"/products"
component=
{
ProductIndex
}
></
AuthRoute
>
<
AuthRoute
path=
"/promos"
>
<
PromotionIndexComponent
/>
...
...
src/component/promo_index/PromotionsIndexComponent.jsx
View file @
d281331f
...
...
@@ -15,7 +15,6 @@ export default function PromotionIndexComponent () {
const
response
=
await
fetch
(
`
${
Config
.
promotionsUrl
}
`
);
const
data
=
await
response
.
json
();
setPromoData
(
data
);
console
.
log
(
data
);
}
const
deletePromotion
=
(
promoId
)
=>
{
...
...
@@ -28,7 +27,7 @@ export default function PromotionIndexComponent () {
return
(
<
div
>
<
div
className=
"promo-container"
>
<
div
className=
"promo-
list-
container"
>
<
div
className=
"promo-list-container"
>
<
div
className=
"promo-header"
>
<
h1
className=
"promo-title"
>
Promotions
</
h1
>
...
...
src/component/promotionforms/PromotionNewFormComponent.jsx
View file @
d281331f
...
...
@@ -16,7 +16,6 @@ export default function PromotionNewFormComponent (props) {
const
onSubmit
=
(
data
)
=>
{
console
.
log
(
data
)
fetch
(
`
${
Config
.
promotionsUrl
}
`
,
{
method
:
"POST"
,
...
...
@@ -36,20 +35,14 @@ export default function PromotionNewFormComponent (props) {
const
loadProducts
=
async
(
event
)
=>
{
const
data
=
await
getAllProducts
();
setproductData
(
data
);
}
const
onChange
=
(
e
,
data
)
=>
{
console
.
log
(
data
)
setValue
(
'productSku'
,
data
.
value
)
console
.
log
(
productSku
)
}
const
productSku
=
register
(
'productSku'
,
{
required
:
true
})
return
(
<
div
>
<
div
className=
"promo-container"
>
...
...
@@ -136,7 +129,7 @@ export default function PromotionNewFormComponent (props) {
{
...
register
("
minimumQuantity
",
{
valueAsNumber
:
true
,
required
:
"
minimum
quantity
is
required
",
min
:
{
value
:
1,
message
:
"
discount
percentage
must
be
greater
than
0"
},
min
:
{
value
:
1,
message
:
"
minimum
quantity
must
be
greater
than
0"
},
})}
id=
"minimumQuantity"
...
...
src/component/promotionforms/UpdatePromotionForm.jsx
View file @
d281331f
...
...
@@ -16,8 +16,6 @@ export default function PromotionUpdateFormComponent(props) {
const
[
productData
,
setproductData
]
=
useState
([]);
const
onSubmit
=
(
data
)
=>
{
console
.
log
(
data
)
fetch
(
`
${
Config
.
promotionsUrl
}
/
${
data
.
promotionId
}
`
,
{
method
:
"PUT"
,
headers
:
{
...
...
@@ -88,7 +86,6 @@ export default function PromotionUpdateFormComponent(props) {
}
})
}
/>
{
errors
.
productSku
&&
<
p
className=
"form-error"
>
{
errors
.
productSku
.
message
}
</
p
>
}
{
errors
.
productSku
&&
console
.
log
(
errors
)
&&
<
p
className=
"form-error"
>
{
errors
.
productSku
.
message
}
</
p
>
}
<
br
></
br
>
</
div
>
...
...
@@ -124,12 +121,11 @@ export default function PromotionUpdateFormComponent(props) {
valueAsNumber
:
true
,
value
:
props
.
location
.
state
.
promo
.
minimumQuantity
,
required
:
"
minimum
quantity
is
required
",
min
:
{
value
:
1,
message
:
"
discount
percentage
must
be
greater
than
0"
},
min
:
{
value
:
1,
message
:
"
minimum
quantity
must
be
greater
than
0"
},
})}
id=
"minimumQuantity"
className=
"form-control"
type=
"number"
min=
"1"
placeholder=
{
props
.
location
.
state
.
promo
.
minimumQuantity
}
/>
{
errors
.
minimumQuantity
&&
<
p
className=
"form-error"
>
{
errors
.
minimumQuantity
.
message
}
</
p
>
}
...
...
src/component/promotionforms/promoStyle.css
View file @
d281331f
...
...
@@ -3,7 +3,7 @@
margin
:
0px
auto
;
padding
:
50px
;
border-radius
:
3px
;
max-width
:
500px
;
}
...
...
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