Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ppl-fasilkom-ui
IT Project 2020
Group B
pilar-web
Commits
76be493a
Commit
76be493a
authored
Oct 13, 2020
by
Wan Muhammad Rayhan Arwindra
🤸🏽
Browse files
Merge branch 'pbi_3_batch_transaksi' into 'staging'
Pbi 3 batch transaksi See merge request
!85
parents
e78125b8
a45c2454
Pipeline
#58624
passed with stages
in 36 minutes and 15 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/__test__/transaksi/ListTransaksi.test.js
View file @
76be493a
...
...
@@ -51,7 +51,7 @@ test(" Test List transaksi", async () => {
created_at
:
"
2020-04-18T10:59:42.074386+07:00
"
,
updated_at
:
"
2020-04-18T11:00:18.150633+07:00
"
,
subtotal
:
"
370000.00
"
,
batch
:
"
Batch 1
"
batch
_name
:
"
Batch 1
"
},
],
})
...
...
@@ -114,7 +114,7 @@ test(" Test List transaksi filter", async () => {
created_at
:
"
2020-04-18T10:59:42.074386+07:00
"
,
updated_at
:
"
2020-04-18T11:00:18.150633+07:00
"
,
subtotal
:
"
370000.00
"
,
batch
:
"
Batch 2
"
,
batch
_name
:
"
Batch 2
"
,
},
],
})
...
...
@@ -161,7 +161,7 @@ test(" Test List transaksi filter", async () => {
created_at
:
"
2020-04-18T10:59:42.074386+07:00
"
,
updated_at
:
"
2020-04-18T11:00:18.150633+07:00
"
,
subtotal
:
"
370000.00
"
,
batch
:
"
Batch 1
"
,
batch
_name
:
"
Batch 1
"
,
},
],
})
...
...
src/page/batch/FormBatch.jsx
View file @
76be493a
...
...
@@ -27,6 +27,8 @@ const FormBatch = ({ onSubmit, initialData = null }) => {
flex-direction: column;
`
}
>
{
errors
.
batch_name
&&
<
ErrorDiv
>
Nama batch tidak boleh kosong
</
ErrorDiv
>
}
<
RowInput
>
<
LabelInput
htmlFor
=
"batch_name"
>
Nama batch
</
LabelInput
>
<
InputForm
...
...
@@ -34,26 +36,18 @@ const FormBatch = ({ onSubmit, initialData = null }) => {
name
=
"batch_name"
ref
=
{
register
({
required
:
true
})
}
/>
{
errors
.
batch_name
&&
<
ErrorDiv
>
Nama batch tidak boleh kosong
</
ErrorDiv
>
}
</
RowInput
>
{
/* {initialData !== null && initialData["image"] != null ? (
<img
css={css`
height: 10rem;
object-fit: contain;
`}
alt={initialData["name"]}
src={initialData["image"]}
/>
) : null} */
}
<
RowInput
>
<
LabelInput
htmlFor
=
"start_date"
>
Tanggal Dimulai
</
LabelInput
>
<
InputForm
type
=
"date"
name
=
"start_date"
ref
=
{
register
}
readOnly
=
{
initialData
!==
null
}
/>
</
RowInput
>
<
RowInput
>
<
LabelInput
htmlFor
=
"end_date"
>
Tanggal Berakhir
</
LabelInput
>
<
InputForm
type
=
"date"
name
=
"end_date"
ref
=
{
register
}
readOnly
=
{
initialData
!==
null
}
/>
</
RowInput
>
<
RowInput
>
<
LabelInput
htmlFor
=
"shipping_cost"
>
Ongkos Kirim
</
LabelInput
>
<
InputForm
type
=
"text"
name
=
"shipping_cost"
ref
=
{
register
}
/>
...
...
src/page/batch/ListBatch.jsx
View file @
76be493a
...
...
@@ -9,8 +9,14 @@ const ListBatch = () =>{
const
[
batches
,
error
]
=
useFetchSingleData
(
`
${
process
.
env
.
REACT_APP_BASE_URL
}
/batch/`
);
if
(
!
error
&&
batches
.
results
!==
undefined
){
const
shippingCosts
=
batches
.
results
.
map
(
(
batch
)
=>
batch
.
shipping_cost
);
const
cost
=
shippingCosts
.
reduce
(
(
acc
,
curr
)
=>
acc
+
curr
);
totalCost
=
cost
;
if
(
shippingCosts
){
const
cost
=
shippingCosts
.
reduce
(
(
acc
,
curr
)
=>
acc
+
curr
);
totalCost
=
cost
;
}
else
{
totalCost
=
"
0
"
;
}
}
const
data
=
{
url
:
`
${
process
.
env
.
REACT_APP_BASE_URL
}
/batch/`
,
...
...
src/page/transaksi/ListTransaksi.jsx
View file @
76be493a
...
...
@@ -21,7 +21,7 @@ const ListTransaksi = () => {
[
"
updated_at
"
,
"
Tanggal Update
"
,
stringToDate
],
[
""
,
"
Status
"
,
transactionToColoredStatus
],
[
"
subtotal
"
,
"
Total
"
,
stringToCurrency
],
[
"
batch
"
,
"
Batch
"
]
[
"
batch
_name
"
,
"
Batch
"
]
],
link
:
"
/transaksi/
"
,
filter
:
[
...
...
src/utils/useDownloadFile.jsx
View file @
76be493a
...
...
@@ -21,7 +21,7 @@ const useDownloadFile = (urlString) => {
:
url
;
url
=
batch
!==
""
?
url
.
concat
(
`batch_name
${
batch
}
&`
)
?
url
.
concat
(
`batch_name
=
${
batch
}
&`
)
:
url
;
trackPromise
(
fetch
(
url
,
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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