Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
E
ESDP_froot.kz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
10
Issues
10
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
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
ESDP_froot.kz
ESDP_froot.kz
Commits
6970c868
Commit
6970c868
authored
May 18, 2021
by
Elena Tsoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#86
добавлены адаптив и стили на все страницы платежей
parent
f82deaef
Pipeline
#333
passed with stages
in 2 minutes and 32 seconds
Changes
18
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
354 additions
and
349 deletions
+354
-349
Account.css
front/src/components/Account/Account.css
+8
-59
Account.js
front/src/components/Account/Account.js
+12
-12
Header.css
front/src/components/Header/Header.css
+1
-1
Total.css
front/src/components/Total/Total.css
+31
-0
Total.js
front/src/components/Total/Total.js
+29
-0
ButtonPink.css
front/src/components/UI/Buttons/ButtonPink/ButtonPink.css
+3
-3
ButtonWhite.css
front/src/components/UI/Buttons/ButtonWhite/ButtonWhite.css
+4
-5
Modal.css
front/src/components/UI/Modal/Modal.css
+10
-7
Modal.js
front/src/components/UI/Modal/Modal.js
+3
-3
Payments.css
front/src/containers/Payments/Payments.css
+56
-52
Payments.js
front/src/containers/Payments/Payments.js
+58
-52
Registry.css
front/src/containers/Registry/Registry.css
+25
-8
RegistryForAccountant.css
...ontainers/RegistryForAccountant/RegistryForAccountant.css
+29
-26
RegistryForAccountant.js
...containers/RegistryForAccountant/RegistryForAccountant.js
+20
-83
RegistryForApprove.css
.../src/containers/RegistryForApprove/RegistryForApprove.css
+43
-8
RegistryForApprove.js
...t/src/containers/RegistryForApprove/RegistryForApprove.js
+8
-27
paymentAction.js
front/src/store/actions/paymentAction.js
+10
-2
paymentReducer.js
front/src/store/reducers/paymentReducer.js
+4
-1
No files found.
front/src/components/Account/Account.css
View file @
6970c868
...
@@ -2,27 +2,19 @@ h4 {
...
@@ -2,27 +2,19 @@ h4 {
margin
:
2rem
0rem
1rem
;
margin
:
2rem
0rem
1rem
;
}
}
.table-wrap
{
.table-wrap
{
margin-top
:
0
;
padding-top
:
0
;
overflow
:
auto
;
overflow
:
auto
;
position
:
relative
;
position
:
relative
;
box-shadow
:
0
0
20px
rgba
(
0
,
0
,
0
,
0.15
);
box-shadow
:
0
0
20px
rgba
(
0
,
0
,
0
,
0.15
);
max-width
:
100%
;
overflow-y
:
auto
;
overflow-y
:
auto
;
height
:
250px
;
height
:
60vh
;
}
}
.table-image
>
td
,
th
{
.table-image
>
td
,
th
{
vertical-align
:
middle
;
vertical-align
:
middle
;
text-align
:
center
;
text-align
:
center
;
}
}
.table
thead
{
margin-top
:
0
;
padding-top
:
0
;
}
.table
{
.table
{
height
:
100%
;
height
:
100%
;
text-align
:
center
;
margin
:
0
auto
;
font-size
:
0.9em
;
font-size
:
0.9em
;
font-family
:
sans-serif
;
font-family
:
sans-serif
;
display
:
inline-block
;
display
:
inline-block
;
...
@@ -31,13 +23,16 @@ h4 {
...
@@ -31,13 +23,16 @@ h4 {
overflow-x
:
auto
;
overflow-x
:
auto
;
white-space
:
nowrap
;
white-space
:
nowrap
;
-webkit-overflow-scrolling
:
touch
;
-webkit-overflow-scrolling
:
touch
;
border-collapse
:
collapse
;
width
:
100%
;
border-collapse
:
collapse
;
}
}
/* .table>thead{
/* .table>thead{
background-color: #009879;
background-color: #009879;
text-align: left;
text-align: left;
} */
} */
.table
tr
{
max-width
:
100%
;
}
.table
th
{
.table
th
{
position
:
sticky
;
position
:
sticky
;
top
:
0
;
top
:
0
;
...
@@ -64,61 +59,15 @@ h4 {
...
@@ -64,61 +59,15 @@ h4 {
border-radius
:
3px
;
border-radius
:
3px
;
border
:
1px
solid
rgb
(
133
,
131
,
131
);
border
:
1px
solid
rgb
(
133
,
131
,
131
);
padding
:
3px
;
padding
:
3px
;
margin
-top
:
5px
;
margin
:
5px
;
font-size
:
14px
;
font-size
:
14px
;
width
:
100
%
;
width
:
100
px
;
box-shadow
:
0
2px
3px
0
rgba
(
0
,
0
,
0
,
0.2
);
box-shadow
:
0
2px
3px
0
rgba
(
0
,
0
,
0
,
0.2
);
cursor
:
pointer
;
cursor
:
pointer
;
}
}
.Account__btn
:hover
,
.Account__btn
:focus
{
.Account__btn
:hover
,
.Account__btn
:focus
{
background-color
:
#c4c7c7
;
background-color
:
#c4c7c7
;
}
}
.button
{
display
:
inline-block
;
text-decoration
:
none
;
margin
:
2px
;
padding
:
10px
;
background
:
linear-gradient
(
64.35deg
,
#ff7488
9.2%
,
#ff077d
89.76%
);
color
:
white
;
border-radius
:
10px
;
cursor
:
pointer
;
}
.button
:hover
,
.button
:focus
{
box-shadow
:
0
0
0
4px
rgba
(
0
,
0
,
255
,
.2
);
}
.dropdown-content
{
position
:
absolute
;
background-color
:
#f1f1f1
;
min-width
:
160px
;
overflow
:
auto
;
box-shadow
:
0px
8px
16px
0px
rgba
(
0
,
0
,
0
,
0.2
);
z-index
:
1
;
}
.dropdown-content
p
{
color
:
black
;
padding
:
12px
16px
;
text-decoration
:
none
;
display
:
block
;
}
.dropdown
a
:hover
{
background-color
:
#ddd
;}
*/
.show
{
display
:
block
;}
.show
{
display
:
block
;}
/* @media screen and (max-width: 600px){
.table-wrap {
overflow: auto;
position: relative;
}
.table{
display: inline-block;
vertical-align: top;
max-width: 100%;
overflow-x: auto;
white-space: nowrap;
-webkit-overflow-scrolling: touch;
}
} */
\ No newline at end of file
front/src/components/Account/Account.js
View file @
6970c868
...
@@ -70,10 +70,10 @@ const Account = ({ registry, payments, approve, cancelApprove, pay, cancelPay, s
...
@@ -70,10 +70,10 @@ const Account = ({ registry, payments, approve, cancelApprove, pay, cancelPay, s
<
/td
>
<
/td
>
{
registry
&&
user
&&
(
user
.
_id
===
payment
.
user
.
_id
||
user
.
role
.
includes
(
'approvePayment'
))?
<
td
>
{
registry
&&
user
&&
(
user
.
_id
===
payment
.
user
.
_id
||
user
.
role
.
includes
(
'approvePayment'
))?
<
td
>
{
payment
.
repeatability
?
(
{
payment
.
repeatability
?
(
<>
<
div
className
=
"flex-space"
>
<
span
>
да
<
/span
>
<
span
>
да
<
/span
>
<
button
className
=
"Account__btn"
onClick
=
{()
=>
stopRepeatability
(
payment
.
_id
)}
>
Отменить
<
/button
>
<
button
className
=
"Account__btn"
onClick
=
{()
=>
stopRepeatability
(
payment
.
_id
)}
>
Отменить
<
/button
>
<
/
>
<
/
div
>
):
<
span
>
нет
<
/span>
}
):
<
span
>
нет
<
/span>
}
<
/td>:user && user.role.includes
(
'viewAllPayments'
)
&& <td
>
<
/td>:user && user.role.includes
(
'viewAllPayments'
)
&& <td
>
{
!
payment
.
repeatability
?
<
span
>
нет
<
/span> : <span >да</
span
>
}
<
/td>
}
{
!
payment
.
repeatability
?
<
span
>
нет
<
/span> : <span >да</
span
>
}
<
/td>
}
...
@@ -83,15 +83,15 @@ const Account = ({ registry, payments, approve, cancelApprove, pay, cancelPay, s
...
@@ -83,15 +83,15 @@ const Account = ({ registry, payments, approve, cancelApprove, pay, cancelPay, s
{
payment
.
approved
&&
payment
.
paided
&&
<
span
style
=
{{
color
:
'green'
}}
>
Оплачен
<
/span>}</
td
>
}
{
payment
.
approved
&&
payment
.
paided
&&
<
span
style
=
{{
color
:
'green'
}}
>
Оплачен
<
/span>}</
td
>
}
{
registry
&&
user
&&
user
.
role
.
includes
(
'approvePayment'
)
&&
<
td
>
{
registry
&&
user
&&
user
.
role
.
includes
(
'approvePayment'
)
&&
<
td
>
{
!
payment
.
approved
?
(
{
!
payment
.
approved
?
(
<>
<
div
className
=
"flex-space"
>
<
span
style
=
{{
color
:
'red'
}}
>
Не
подтвержден
<
/span
>
<
span
style
=
{{
color
:
'red'
}}
>
Не
подтвержден
<
/span
>
<
button
className
=
"Account__btn"
onClick
=
{()
=>
approve
(
payment
.
_id
)}
>
Подтвердить
<
/button
>
<
button
className
=
"Account__btn"
onClick
=
{()
=>
approve
(
payment
.
_id
)}
>
Подтвердить
<
/button
>
<
/
>
<
/
div
>
):
(
):
(
<>
<
div
className
=
"flex-space"
>
<
span
style
=
{{
color
:
'orange'
}}
>
Подтвержден
<
/span
>
<
span
style
=
{{
color
:
'orange'
}}
>
Подтвержден
<
/span
>
<
button
className
=
"Account__btn"
onClick
=
{()
=>
cancelApprove
(
payment
.
_id
)}
>
Отменить
<
/button
>
<
button
className
=
"Account__btn"
onClick
=
{()
=>
cancelApprove
(
payment
.
_id
)}
>
Отменить
<
/button
>
<
/>
)
}
<
/
div
>
)
}
<
/td>
}
<
/td>
}
{
registry
&&
user
&&
user
.
role
.
includes
(
'payPayment'
)
&&
!
user
.
role
.
includes
(
'approvePayment'
)
&&
payment
.
approved
&&
<
td
>
{
registry
&&
user
&&
user
.
role
.
includes
(
'payPayment'
)
&&
!
user
.
role
.
includes
(
'approvePayment'
)
&&
payment
.
approved
&&
<
td
>
{
!
payment
.
paided
?
(
{
!
payment
.
paided
?
(
...
...
front/src/components/Header/Header.css
View file @
6970c868
...
@@ -76,7 +76,7 @@
...
@@ -76,7 +76,7 @@
margin-bottom
:
0
;
margin-bottom
:
0
;
}
}
}
}
@media
screen
and
(
min-width
:
1
5
00px
)
{
@media
screen
and
(
min-width
:
1
2
00px
)
{
.Header__menu
{
.Header__menu
{
position
:
unset
;
position
:
unset
;
display
:
flex
;
display
:
flex
;
...
...
front/src/components/Total/Total.css
0 → 100644
View file @
6970c868
.Total
{
text-align
:
center
;
margin
:
10px
auto
;
color
:
#363636
;
display
:
flex
;
flex-direction
:
column
;
}
.Total__title
{
margin
:
10px
;
}
.Total__company
{
color
:
#363636
;
font-size
:
16px
;
font-weight
:
500
;
border
:
1px
solid
#f52284
;
border-radius
:
5px
;
padding
:
5px
;
margin
:
5px
;
width
:
95%
;
}
@media
screen
and
(
min-width
:
600px
)
{
.Total__company
{
font-size
:
20px
;
width
:
320px
;
}
}
@media
screen
and
(
min-width
:
1200px
)
{
.Total
{
flex-direction
:
row
;
}
}
\ No newline at end of file
front/src/components/Total/Total.js
0 → 100644
View file @
6970c868
import
React
from
'react'
import
'./Total.css'
const
Total
=
({
payments
})
=>
{
let
totalAsia
=
0
payments
.
filter
((
payment
)
=>
{
if
(
payment
.
payer
===
"Froot_Middle_Asia"
){
totalAsia
+=
Number
(
payment
.
sum
)
}
return
totalAsia
});
let
totalBusiness
=
0
payments
.
filter
((
payment
)
=>
{
if
(
payment
.
payer
===
"Froot_Бизнес"
){
totalBusiness
+=
Number
(
payment
.
sum
)
}
return
totalBusiness
});
return
(
<
div
className
=
"Total"
>
<
h3
className
=
"Total__title"
>
C
умма
платежей
по
компаниям
:
<
/h3
>
<
span
className
=
"Total__company"
>
"Froot_Middle_Asia"
:
<
strong
>
{
totalAsia
}
<
/strong> KZT</
span
>
<
span
className
=
"Total__company"
>
"Froot_Бизнес"
:
<
strong
>
{
totalBusiness
}
<
/strong> KZT</
span
>
<
/div
>
)
}
export
default
Total
front/src/components/UI/Buttons/ButtonPink/ButtonPink.css
View file @
6970c868
.ButtonPink
{
.ButtonPink
{
width
:
20
0px
;
min-width
:
15
0px
;
height
:
40
px
;
height
:
35
px
;
font-size
:
16px
;
font-size
:
16px
;
font-weight
:
bold
;
font-weight
:
bold
;
background-color
:
#ff067c
;
background-color
:
#ff067c
;
border
:
none
;
border
:
none
;
margin-left
:
35px
;
margin-left
:
35px
;
color
:
#fff
;
color
:
#fff
;
border-radius
:
8
px
;
border-radius
:
5
px
;
box-shadow
:
0
0
3px
2px
;
box-shadow
:
0
0
3px
2px
;
outline
:
none
;
outline
:
none
;
cursor
:
pointer
;
cursor
:
pointer
;
...
...
front/src/components/UI/Buttons/ButtonWhite/ButtonWhite.css
View file @
6970c868
.ButtonWhite
{
.ButtonWhite
{
outline
:
none
;
outline
:
0
;
margin-left
:
10px
;
margin-left
:
10px
;
color
:
#ff067c
;
color
:
#ff067c
;
background-color
:
#fff
;
background-color
:
#fff
;
border-radius
:
8
px
;
border-radius
:
5
px
;
font-size
:
16px
;
font-size
:
16px
;
font-weight
:
bold
;
font-weight
:
bold
;
cursor
:
pointer
;
cursor
:
pointer
;
width
:
20
0px
;
min-width
:
15
0px
;
height
:
40
px
;
height
:
35
px
;
border
:
1px
solid
#ff067c
;
border
:
1px
solid
#ff067c
;
}
}
.ButtonWhite
:hover
{
.ButtonWhite
:hover
{
...
...
front/src/components/UI/Modal/Modal.css
View file @
6970c868
.Modal
{
.Modal
{
width
:
80%
;
width
:
70%
;
padding
:
20px
;
max-height
:
90%
;
padding
:
10px
;
z-index
:
500
;
z-index
:
500
;
border
:
1px
solid
#ccc
;
border
:
1px
solid
#ccc
;
background-color
:
white
;
background-color
:
white
;
box-shadow
:
1px
1px
1px
black
;
box-shadow
:
1px
1px
100px
black
;
margin
:
50px
0
;
text-align
:
center
;
text-align
:
center
;
transition
:
all
0.3s
ease-out
;
transition
:
all
0.3s
ease-out
;
position
:
absolute
;
position
:
absolute
;
...
@@ -14,15 +14,18 @@
...
@@ -14,15 +14,18 @@
transform
:
translate
(
-50%
,
-50%
);
transform
:
translate
(
-50%
,
-50%
);
}
}
.Modal__container
{
.Modal__container
{
padding
:
10px
;
display
:
flex
;
display
:
flex
;
justify-content
:
space-between
;
justify-content
:
space-between
;
align-items
:
start
;
align-items
:
flex-
start
;
}
}
.Modal__img
{
.Modal__img
{
width
:
10
0%
;
width
:
9
0%
;
display
:
block
;
display
:
block
;
}
}
.filter
{
left
:
53%
;
top
:
85px
;
}
@media
screen
and
(
max-width
:
900px
){
@media
screen
and
(
max-width
:
900px
){
.Modal
,
.Modal__img
{
.Modal
,
.Modal__img
{
width
:
100%
;
width
:
100%
;
...
...
front/src/components/UI/Modal/Modal.js
View file @
6970c868
...
@@ -4,11 +4,11 @@ import Backdrop from "../Backdrop/Backdrop";
...
@@ -4,11 +4,11 @@ import Backdrop from "../Backdrop/Backdrop";
import
ButtonClose
from
"../Buttons/ButtonClose/ButtonClose"
import
ButtonClose
from
"../Buttons/ButtonClose/ButtonClose"
import
"./Modal.css"
;
import
"./Modal.css"
;
const
Modal
=
({
src
,
body
,
close
})
=>
{
const
Modal
=
({
src
,
body
,
name
,
close
})
=>
{
return
(
return
(
<
Fragment
>
<
Fragment
>
<
Backdrop
close
=
{
close
}
/
>
{
!
body
&&
<
Backdrop
close
=
{
close
}
/>
}
<
div
className
=
"Modal"
>
<
div
className
=
{
name
===
'filter'
?
"Modal filter"
:
"Modal"
}
>
<
div
className
=
"Modal__container"
>
<
div
className
=
"Modal__container"
>
{
src
?
<
img
className
=
"Modal__img"
src
=
{
src
}
/> : body
}
{
src
?
<
img
className
=
"Modal__img"
src
=
{
src
}
/> : body
}
<
ButtonClose
onClickHandler
=
{
close
}
/
>
<
ButtonClose
onClickHandler
=
{
close
}
/
>
...
...
front/src/containers/Payments/Payments.css
View file @
6970c868
.Payments
{
.Payments
{
margin
:
0
auto
;
display
:
flex
;
padding
:
15px
;
flex-direction
:
column
;
}
align-items
:
center
;
.Payments__close
{
padding
:
5px
;
margin-left
:
auto
;
padding
:
3px
3px
0
3px
;
border-radius
:
3px
;
background
:
white
;
}
.Payments__btn
{
padding
:
5px
10px
;
font-size
:
18px
;
font-weight
:
bold
;
background
:
#f52284
;
border
:
none
;
margin
:
20px
0
;
color
:
white
;
border-radius
:
5px
;
box-shadow
:
0
0
3px
2px
;
outline
:
none
;
cursor
:
pointer
;
}
.Payments__btn
:hover
{
background
:
#762c80
;
}
}
.Payments__btn
:active
{
.Payments__header
{
box-shadow
:
none
;
border-bottom
:
2px
solid
#e5e5ea
;
padding-bottom
:
10px
;
text-align
:
center
;
}
}
.Payments__title
{
.Payments__title
{
color
:
#b1b0b0
;
color
:
#b1b0b0
;
font-size
:
30px
;
font-size
:
30px
;
text-align
:
center
;
text-align
:
center
;
text-shadow
:
1px
1px
2px
black
;
text-shadow
:
1px
1px
2px
black
;
margin
:
0
;
margin
:
0
auto
;
margin-bottom
:
10px
;
}
}
.Payments__total
{
.Payments__content
,
.Payments__header
{
color
:
#363636
;
width
:
100%
;
text-align
:
center
;
display
:
flex
;
width
:
50%
;
justify-content
:
space-around
;
margin
:
0
auto
10px
;
align-items
:
center
;
}
flex-wrap
:
wrap
;
.Payments__total-company
{
color
:
#363636
;
font-size
:
20px
;
font-weight
:
500
;
border
:
2px
solid
grey
;
border-radius
:
5px
;
padding
:
5px
;
margin
:
5px
;
width
:
50%
;
}
}
/* filter */
.Payments__filter
{
.Payments__filter
{
text-align
:
right
;
}
.Payments__filter-input
{
display
:
flex
;
display
:
flex
;
align-items
:
center
;
justify-content
:
space-around
;
width
:
70%
;
align-items
:
flex-start
;
margin
:
0
auto
;
}
.Payments__filter-title
{
margin
:
5px
;
}
.mb
{
margin-bottom
:
14px
;
width
:
150px
;
}
.Payments__filter-item
{
margin
:
0
30px
;
}
}
select
,
input
{
select
,
input
{
height
:
35px
;
box-sizing
:
border-box
;
padding
:
5px
;
padding
:
5px
;
margin
:
0
10px
;
margin
:
0
10px
;
font-size
:
14px
;
font-size
:
14px
;
border-radius
:
0
;
border
:
1px
solid
gray
;
}
}
.dropdown
{
.dropdown
{
position
:
relative
;
position
:
relative
;
display
:
inline-block
;
display
:
inline-block
;
margin
:
0
10px
;
}
}
.dropdown__title
{
.dropdown__title
{
padding
:
5
px
10px
;
padding
:
8
px
10px
;
min-
width
:
150px
;
width
:
150px
;
border
:
1px
solid
gray
;
border
:
1px
solid
gray
;
cursor
:
pointer
;
cursor
:
pointer
;
}
}
...
@@ -80,7 +68,7 @@ select, input {
...
@@ -80,7 +68,7 @@ select, input {
margin-top
:
5px
;
margin-top
:
5px
;
list-style
:
none
;
list-style
:
none
;
background
:
white
;
background
:
white
;
min-
width
:
144px
;
width
:
144px
;
border
:
1px
solid
gray
;
border
:
1px
solid
gray
;
z-index
:
1
;
z-index
:
1
;
}
}
...
@@ -93,3 +81,19 @@ select, input {
...
@@ -93,3 +81,19 @@ select, input {
.dropdown__content-item
:hover
{
.dropdown__content-item
:hover
{
background
:
#bbb9b9
;
background
:
#bbb9b9
;
}
}
.Payments__filter-control
{
margin
:
20px
0
10px
;
}
@media
screen
and
(
min-width
:
600px
)
{
.Payments
{
padding
:
15px
;
}
.Payments__header
{
justify-content
:
space-between
;
}
.Payments__title
{
text-align
:
left
;
margin
:
0
;
}
}
front/src/containers/Payments/Payments.js
View file @
6970c868
...
@@ -3,6 +3,10 @@ import React, { Fragment, useEffect, useState } from "react";
...
@@ -3,6 +3,10 @@ import React, { Fragment, useEffect, useState } from "react";
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
Account
from
"../../components/Account/Account"
;
import
Account
from
"../../components/Account/Account"
;
import
RedirectToAuth
from
"../../components/RedirectToAuth/RedirectToAuth"
;
import
RedirectToAuth
from
"../../components/RedirectToAuth/RedirectToAuth"
;
import
Total
from
"../../components/Total/Total"
;
import
ButtonPink
from
"../../components/UI/Buttons/ButtonPink/ButtonPink"
;
import
ButtonWhite
from
"../../components/UI/Buttons/ButtonWhite/ButtonWhite"
;
import
Modal
from
"../../components/UI/Modal/Modal"
;
import
UsersPermission
from
"../../components/UsersPermission/UsersPermission"
;
import
UsersPermission
from
"../../components/UsersPermission/UsersPermission"
;
import
{
import
{
fetchPayments
,
fetchPayments
,
...
@@ -40,21 +44,6 @@ const Payments = () => {
...
@@ -40,21 +44,6 @@ const Payments = () => {
dispatch
(
fetchPayments
());
dispatch
(
fetchPayments
());
return
return
};
};
let
totalAsia
=
0
payments
.
filter
((
payment
)
=>
{
if
(
payment
.
payer
===
"Froot_Middle_Asia"
){
totalAsia
+=
Number
(
payment
.
sum
)
}
return
totalAsia
});
let
totalBusiness
=
0
payments
.
filter
((
payment
)
=>
{
if
(
payment
.
payer
===
"Froot_Бизнес"
){
totalBusiness
+=
Number
(
payment
.
sum
)
}
return
totalBusiness
});
const
inputChangeHandler
=
(
event
)
=>
{
const
inputChangeHandler
=
(
event
)
=>
{
const
{
name
,
value
}
=
event
.
target
;
const
{
name
,
value
}
=
event
.
target
;
setState
((
prevState
)
=>
{
setState
((
prevState
)
=>
{
...
@@ -118,22 +107,21 @@ const Payments = () => {
...
@@ -118,22 +107,21 @@ const Payments = () => {
}
}
dispatch
(
fetchSortedData
(
stateCopy
));
dispatch
(
fetchSortedData
(
stateCopy
));
};
};
// --для модалки--
return
(
const
[
showModal
,
setShowModal
]
=
useState
({
<
Fragment
>
show
:
false
{
user
?
<
div
className
=
"Payments"
>
});
{
user
.
role
.
includes
(
'viewAllPayments'
)
?
(
const
openModal
=
()
=>
{
<
Fragment
>
setShowModal
({
show
:
true
});
<
h2
className
=
"Payments__title"
>
Все
платежи
<
/h2
>
}
<
div
className
=
"Payments__total"
>
const
closeModal
=
()
=>
{
<
h3
>
Общая
сумма
платежей
по
компаниям
:
<
/h3
>
setShowModal
({
show
:
false
})
<
div
className
=
"flex-space"
>
}
<
span
className
=
"Payments__total-company"
>
"Froot_Middle_Asia"
:
<
strong
>
{
totalAsia
}
<
/strong> KZT</
span
>
const
body
=
(
<
span
className
=
"Payments__total-company"
>
"Froot_Бизнес"
:
<
strong
>
{
totalBusiness
}
<
/strong> KZT</
span
>
<
/div
>
<
/div
>
<
div
className
=
"Payments__filter"
>
<
form
>
<
form
>
<
div
className
=
"Payments__filter-input"
>
<
div
className
=
"Payments__filter-item"
>
<
h3
className
=
"Payments__filter-title"
>
По
компании
:
<
/h3
>
<
select
<
select
className
=
"toClear"
className
=
"toClear"
name
=
"payer"
name
=
"payer"
...
@@ -144,9 +132,10 @@ const Payments = () => {
...
@@ -144,9 +132,10 @@ const Payments = () => {
<
option
value
=
"Froot_Middle_Asia"
>
Froot_Middle_Asia
<
/option
>
<
option
value
=
"Froot_Middle_Asia"
>
Froot_Middle_Asia
<
/option
>
<
option
value
=
"Froot_Бизнес"
>
Froot_
Бизнес
<
/option
>
<
option
value
=
"Froot_Бизнес"
>
Froot_
Бизнес
<
/option
>
<
/select
>
<
/select
>
<
/div
>
<
div
className
=
"Payments__filter-item"
>
<
h3
className
=
"Payments__filter-title"
>
По
дате
:
<
/h3
>
<
span
>
с
<
/span
>
<
span
>
с
<
/span
>
<
input
<
input
className
=
"inputToClear"
className
=
"inputToClear"
type
=
"date"
type
=
"date"
...
@@ -154,27 +143,44 @@ const Payments = () => {
...
@@ -154,27 +143,44 @@ const Payments = () => {
name
=
"fromDate"
name
=
"fromDate"
/>
/>
<
span
>
до
<
/span
>
<
span
>
до
<
/span
>
<
input
<
input
className
=
"toClear"
className
=
"toClear"
type
=
"date"
type
=
"date"
onChange
=
{(
e
)
=>
inputDateChangeHandler
(
e
)}
onChange
=
{(
e
)
=>
inputDateChangeHandler
(
e
)}
name
=
"toDate"
name
=
"toDate"
/>
/>
<
div
className
=
"dropdown"
>
<
/div
>
<
div
className
=
"Payments__filter-item dropdown"
>
<
h3
className
=
"Payments__filter-title mb"
>
По
статусу
:
<
/h3
>
<
span
id
=
"dropdown"
className
=
"dropdown__title"
>
Статусы
платежей
<
/span
>
<
span
id
=
"dropdown"
className
=
"dropdown__title"
>
Статусы
платежей
<
/span
>
<
div
className
=
"dropdown__content"
>
<
div
className
=
"dropdown__content"
>
<
div
className
=
"dropdown__content-item"
onClick
=
{
e
=>
statusChangeHandler
(
e
)}
>
Подтвержден
<
/div
>
<
div
className
=
"dropdown__content-item"
onClick
=
{
e
=>
statusChangeHandler
(
e
)}
>
Подтвержден
<
/div
>
<
div
className
=
"dropdown__content-item"
onClick
=
{
e
=>
statusChangeHandler
(
e
)}
>
Не
подтвержден
<
/div
>
<
div
className
=
"dropdown__content-item"
onClick
=
{
e
=>
statusChangeHandler
(
e
)}
>
Не
подтвержден
<
/div
>
<
div
className
=
"dropdown__content-item"
onClick
=
{
e
=>
statusChangeHandler
(
e
)}
>
Оплачен
<
/div
>
<
div
className
=
"dropdown__content-item"
onClick
=
{
e
=>
statusChangeHandler
(
e
)}
>
Оплачен
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
button
className
=
"Payments__btn"
type
=
'button'
onClick
=
{()
=>
postData
()}
>
Применить
<
/button
>
<
/div
>
<
button
className
=
"Payments__btn"
type
=
'reset'
onClick
=
{()
=>
clearData
()}
>
Сброс
<
/button
>
<
div
className
=
"Payments__filter-control"
>
<
ButtonPink
type
=
'button'
text
=
'Применить'
onClickHandler
=
{
postData
}
/
>
<
ButtonWhite
type
=
'reset'
text
=
'Сброс'
onClickHandler
=
{
clearData
}
/
>
<
/div
>
<
/form>
<
/form>
)
return
(
<
Fragment
>
{
user
&&
payments
.
length
?
<
div
className
=
"Payments"
>
{
user
.
role
.
includes
(
'viewAllPayments'
)
?
(
<
Fragment
>
<
div
className
=
"Payments__content"
>
<
div
className
=
"Payments__header"
>
<
h2
className
=
"Payments__title"
>
Все
платежи
<
/h2
>
<
div
className
=
"Payments__filter"
>
<
ButtonPink
type
=
'button'
text
=
'Фильтры'
onClickHandler
=
{
openModal
}
/
>
{
showModal
.
show
&&
<
Modal
body
=
{
body
}
name
=
{
'filter'
}
close
=
{
closeModal
}
/>
}
<
/div
>
<
/div
>
<
Total
payments
=
{
payments
}
/
>
<
/div
>
<
/div
>
<
Account
payments
=
{
payments
}
<
Account
payments
=
{
payments
}
statusDateChange
=
{
statusChangeHandler
}
statusDateChange
=
{
statusChangeHandler
}
...
...
front/src/containers/Registry/Registry.css
View file @
6970c868
.Registry__title
{
.Registry__title
{
color
:
#b1b0b0
;
color
:
#b1b0b0
;
font-size
:
30px
;
font-size
:
30px
;
text-align
:
center
;
text-align
:
left
;
text-shadow
:
1px
1px
2px
black
;
text-shadow
:
1px
1px
2px
black
;
margin
:
0
;
margin
:
0
;
margin-bottom
:
10px
;
}
}
.Registry__total
{
.Registry__total
{
color
:
#363636
;
text-align
:
center
;
text-align
:
center
;
width
:
50%
;
margin
:
10px
auto
;
margin
:
0
auto
10px
;
color
:
#363636
;
display
:
flex
;
flex-direction
:
column
;
}
.Registry__total-title
{
margin
:
10px
;
}
}
.Registry__total-company
{
.Registry__total-company
{
color
:
#363636
;
color
:
#363636
;
font-size
:
20
px
;
font-size
:
16
px
;
font-weight
:
500
;
font-weight
:
500
;
border
:
2px
solid
grey
;
border
:
1px
solid
#f52284
;
border-radius
:
5px
;
border-radius
:
5px
;
padding
:
5px
;
padding
:
5px
;
margin
:
5px
;
margin
:
5px
;
width
:
50%
;
width
:
95%
;
}
@media
screen
and
(
min-width
:
600px
)
{
.Registry
{
padding
:
15px
;
}
.Registry__total-company
{
font-size
:
20px
;
width
:
320px
;
}
}
@media
screen
and
(
min-width
:
1200px
)
{
.Registry__total
{
flex-direction
:
row
;
}
}
}
\ No newline at end of file
front/src/containers/RegistryForAccountant/RegistryForAccountant.css
View file @
6970c868
.RegistryForAccountant
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
padding
:
5px
;
}
.RegistryForAccountant__header
{
border-bottom
:
2px
solid
#e5e5ea
;
padding-bottom
:
10px
;
}
.RegistryForAccountant__title
{
.RegistryForAccountant__title
{
color
:
#b1b0b0
;
color
:
#b1b0b0
;
font-size
:
30px
;
font-size
:
30px
;
text-align
:
center
;
text-align
:
left
;
text-shadow
:
1px
1px
2px
black
;
text-shadow
:
1px
1px
2px
black
;
margin
:
0
;
margin
:
0
;
margin-bottom
:
10px
;
}
}
.RegistryForAccountant__content
{
.RegistryForAccountant__content
,
.RegistryForAccountant__header
{
width
:
100%
;
display
:
flex
;
display
:
flex
;
justify-content
:
space-between
;
justify-content
:
space-between
;
align-items
:
flex-end
;
align-items
:
center
;
flex-wrap
:
wrap
;
flex-wrap
:
wrap
;
margin-bottom
:
10px
;
}
.RegistryForAccountant__total-title
{
margin-bottom
:
0
;
}
.RegistryForAccountant__total
{
color
:
#363636
;
}
}
.RegistryForAccountant__total-company
{
.RegistryForAccountant__downloads
{
color
:
#363636
;
display
:
flex
;
font-size
:
20px
;
flex-wrap
:
wrap
;
font-weight
:
500
;
border
:
2px
solid
grey
;
border-radius
:
5px
;
padding
:
5px
;
margin-top
:
5px
;
}
}
.RegistryForAccountant__downloads-btn
{
.RegistryForAccountant__downloads-btn
{
display
:
block
;
text-align
:
center
;
text-align
:
center
;
text-decoration
:
none
;
text-decoration
:
none
;
background-color
:
#e3e6e6
;
padding
:
6px
10px
;
color
:
#5e5d5d
;
outline
:
none
;
border-radius
:
3
px
;
margin
:
10
px
;
border
:
1px
solid
rgb
(
133
,
131
,
131
)
;
color
:
#fff
;
padding
:
3px
;
background-color
:
#ff067c
;
margin-top
:
5px
;
border-radius
:
5px
;
font-size
:
16px
;
font-size
:
16px
;
box-shadow
:
0
2px
3px
0
rgba
(
0
,
0
,
0
,
0.2
)
;
font-weight
:
bold
;
cursor
:
pointer
;
cursor
:
pointer
;
border
:
none
;
}
.RegistryForAccountant__downloads-btn
:hover
{
box-shadow
:
0
0
10px
1px
#9d9ea0
;
}
}
\ No newline at end of file
front/src/containers/RegistryForAccountant/RegistryForAccountant.js
View file @
6970c868
...
@@ -15,6 +15,7 @@ import { apiURL } from "../../config";
...
@@ -15,6 +15,7 @@ import { apiURL } from "../../config";
import
{
download
}
from
"../../../src/functions"
;
import
{
download
}
from
"../../../src/functions"
;
import
JSZipUtils
from
"jszip-utils"
;
import
JSZipUtils
from
"jszip-utils"
;
import
{
saveAs
}
from
"file-saver"
;
import
{
saveAs
}
from
"file-saver"
;
import
Total
from
"../../components/Total/Total"
;
const
RegistryForAccountant
=
()
=>
{
const
RegistryForAccountant
=
()
=>
{
const
todaysPayments
=
useSelector
((
state
)
=>
state
.
payments
.
todaysPayments
);
const
todaysPayments
=
useSelector
((
state
)
=>
state
.
payments
.
todaysPayments
);
...
@@ -22,20 +23,6 @@ const RegistryForAccountant = () => {
...
@@ -22,20 +23,6 @@ const RegistryForAccountant = () => {
const
approvedPayments
=
todaysPayments
.
filter
((
p
)
=>
p
.
approved
===
true
);
const
approvedPayments
=
todaysPayments
.
filter
((
p
)
=>
p
.
approved
===
true
);
const
today
=
moment
().
format
(
"YYYY-MM-DD"
);
const
today
=
moment
().
format
(
"YYYY-MM-DD"
);
let
totalAsia
=
0
;
approvedPayments
.
filter
((
payment
)
=>
{
if
(
payment
.
payer
===
"Froot_Middle_Asia"
)
{
totalAsia
+=
Number
(
payment
.
sum
);
}
return
totalAsia
;
});
let
totalBusiness
=
0
;
approvedPayments
.
filter
((
payment
)
=>
{
if
(
payment
.
payer
===
"Froot_Бизнес"
)
{
totalBusiness
+=
Number
(
payment
.
sum
);
}
return
totalBusiness
;
});
const
registry
=
true
;
const
registry
=
true
;
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -76,61 +63,12 @@ const RegistryForAccountant = () => {
...
@@ -76,61 +63,12 @@ const RegistryForAccountant = () => {
});
});
};
};
// -- 1 вариант скачивание файлов одним архивом--
// const downloadFiles = () =>{
// let zip = new JSZip();
// for (let i=0; i < todayFiles.length; i++) {
// const fileName = todayFiles[i].substring(0, todayFiles[i].lastIndexOf('g')+1);
// const encodedString = btoa(todayFiles[i]);
// console.log('encodedString', encodedString)
// // добавим файл
// zip.file(fileName, encodedString, {base64: true});
// }
// // асинхронно получаем готовый архив
// zip.generateAsync({type: "blob"}).then(function(content) {
// FileSaver.saveAs(content, "download.zip");
// });
// }
// ----2вариант обычного скачивания файлов из массива--
// const downloadFiles = () =>{
// const fileURLs = [];
// approvedPayments.map(p=>{
// fileURLs.push(p.image)
// })
// fileURLs.map(f=>{
// download(apiURL + "/uploads/" + f, "file.jpg")
// })
// }
// ---вариант 3 данные с бэка--
// const downloadFiles = () => {
// todayFiles.map((f) => {
// download(apiURL + "/uploads/" + f, "file.jpg");
// });
// };
return
(
return
(
<
div
className
=
"RegistryForAccountant"
>
<
div
className
=
"RegistryForAccountant"
>
<
h2
className
=
"RegistryForAccountant__title"
>
Платежи
на
сегодня
:
{
today
}{
" "
}
<
/h2
>
<
div
className
=
"RegistryForAccountant__content"
>
<
div
className
=
"RegistryForAccountant__content"
>
<
div
className
=
"RegistryForAccountant__total"
>
<
div
className
=
"RegistryForAccountant__header"
>
<
h3
className
=
"RegistryForAccountant__total-title"
>
<
h2
className
=
"RegistryForAccountant__title"
>
Платежи
для
оплаты
на
сегодня
:
{
today
}
<
/h2
>
Общая
сумма
платежей
по
компаниям
:
<
div
className
=
"RegistryForAccountant__downloads"
>
<
/h3
>
<
div
className
=
"flex-column"
>
<
span
className
=
"RegistryForAccountant__total-company"
>
"Froot_Middle_Asia"
:
<
strong
>
{
totalAsia
}
<
/strong> KZ
T
<
/span
>
<
span
className
=
"RegistryForAccountant__total-company"
>
"Froot_Бизнес"
:
<
strong
>
{
totalBusiness
}
<
/strong> KZ
T
<
/span
>
<
/div
>
<
/div
>
<
div
className
=
"RegistryForAccountant__downloads flex-column"
>
<
a
<
a
className
=
"RegistryForAccountant__downloads-btn"
className
=
"RegistryForAccountant__downloads-btn"
download
download
...
@@ -146,8 +84,8 @@ const RegistryForAccountant = () => {
...
@@ -146,8 +84,8 @@ const RegistryForAccountant = () => {
<
/a
>
<
/a
>
<
/div>
<
/div>
<
/div
>
<
/div
>
<
Total
payments
=
{
approvedPayments
}
/
>
<
div
>
<
/
div
>
<
Account
<
Account
registry
=
{
registry
}
registry
=
{
registry
}
pay
=
{
payHandler
}
pay
=
{
payHandler
}
...
@@ -155,7 +93,6 @@ const RegistryForAccountant = () => {
...
@@ -155,7 +93,6 @@ const RegistryForAccountant = () => {
payments
=
{
approvedPayments
}
payments
=
{
approvedPayments
}
/
>
/
>
<
/div
>
<
/div
>
<
/div
>
);
);
};
};
...
...
front/src/containers/RegistryForApprove/RegistryForApprove.css
View file @
6970c868
.Registry
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
padding
:
5px
;
}
.Registry__header
{
border-bottom
:
2px
solid
#e5e5ea
;
padding-bottom
:
10px
;
}
.Registry__title
{
.Registry__title
{
color
:
#b1b0b0
;
color
:
#b1b0b0
;
font-size
:
30px
;
font-size
:
30px
;
text-align
:
center
;
text-align
:
left
;
text-shadow
:
1px
1px
2px
black
;
text-shadow
:
1px
1px
2px
black
;
margin
:
0
;
margin
:
0
;
margin-bottom
:
10px
;
}
}
.Registry__content
,
.Registry__header
{
width
:
100%
;
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
flex-wrap
:
wrap
;
}
/* total */
.Registry__total
{
.Registry__total
{
color
:
#363636
;
text-align
:
center
;
text-align
:
center
;
width
:
50%
;
margin
:
10px
auto
;
margin
:
0
auto
10px
;
color
:
#363636
;
display
:
flex
;
flex-direction
:
column
;
}
.Registry__total-title
{
margin
:
10px
;
}
}
.Registry__total-company
{
.Registry__total-company
{
color
:
#363636
;
color
:
#363636
;
font-size
:
20
px
;
font-size
:
16
px
;
font-weight
:
500
;
font-weight
:
500
;
border
:
2px
solid
grey
;
border
:
1px
solid
#f52284
;
border-radius
:
5px
;
border-radius
:
5px
;
padding
:
5px
;
padding
:
5px
;
margin
:
5px
;
margin
:
5px
;
width
:
50%
;
width
:
95%
;
}
@media
screen
and
(
min-width
:
600px
)
{
.Registry
{
padding
:
15px
;
}
.Registry__total-company
{
font-size
:
20px
;
width
:
320px
;
}
}
@media
screen
and
(
min-width
:
1200px
)
{
.Registry__total
{
flex-direction
:
row
;
}
}
}
\ No newline at end of file
front/src/containers/RegistryForApprove/RegistryForApprove.js
View file @
6970c868
...
@@ -4,26 +4,13 @@ import Account from '../../components/Account/Account';
...
@@ -4,26 +4,13 @@ import Account from '../../components/Account/Account';
import
{
fetchApprove
,
fetchCancelApprove
,
fetchStopRepeatability
,
fetchTodaysPayments
}
from
'../../store/actions/paymentAction'
;
import
{
fetchApprove
,
fetchCancelApprove
,
fetchStopRepeatability
,
fetchTodaysPayments
}
from
'../../store/actions/paymentAction'
;
import
moment
from
'moment'
import
moment
from
'moment'
import
'./RegistryForApprove.css'
import
'./RegistryForApprove.css'
import
Total
from
'../../components/Total/Total'
;
const
RegistryForApprove
=
()
=>
{
const
RegistryForApprove
=
()
=>
{
const
todaysPayments
=
useSelector
(
state
=>
state
.
payments
.
todaysPayments
);
const
todaysPayments
=
useSelector
(
state
=>
state
.
payments
.
todaysPayments
);
const
today
=
moment
().
format
(
'YYYY-MM-DD'
)
const
today
=
moment
().
format
(
'YYYY-MM-DD'
)
let
totalAsia
=
0
todaysPayments
.
filter
((
payment
)
=>
{
if
(
payment
.
payer
===
"Froot_Middle_Asia"
){
totalAsia
+=
Number
(
payment
.
sum
)
}
return
totalAsia
});
let
totalBusiness
=
0
todaysPayments
.
filter
((
payment
)
=>
{
if
(
payment
.
payer
===
"Froot_Бизнес"
){
totalBusiness
+=
Number
(
payment
.
sum
)
}
return
totalBusiness
});
const
registry
=
true
const
registry
=
true
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -42,16 +29,13 @@ const RegistryForApprove = () => {
...
@@ -42,16 +29,13 @@ const RegistryForApprove = () => {
return
(
return
(
<
div
className
=
"Registry"
>
<
div
className
=
"Registry"
>
<
div
className
=
"Registry__content"
>
<
div
className
=
"Registry__header"
>
<
h2
className
=
"Registry__title"
>
Платежи
на
сегодня
:
{
today
}
<
/h2
>
<
h2
className
=
"Registry__title"
>
Платежи
на
сегодня
:
{
today
}
<
/h2
>
<
div
className
=
"Registry__total"
>
<
h3
>
Общая
сумма
платежей
по
компаниям
:
<
/h3
>
<
div
className
=
"flex-space"
>
<
span
className
=
"Registry__total-company"
>
"Froot_Middle_Asia"
:
<
strong
>
{
totalAsia
}
<
/strong> KZT</
span
>
<
span
className
=
"Registry__total-company"
>
"Froot_Бизнес"
:
<
strong
>
{
totalBusiness
}
<
/strong> KZT</
span
>
<
/div
>
<
/div
>
<
Total
payments
=
{
todaysPayments
}
/
>
<
/div
>
<
/div
>
<
div
>
<
Account
<
Account
registry
=
{
registry
}
registry
=
{
registry
}
approve
=
{
approveHandler
}
approve
=
{
approveHandler
}
...
@@ -59,9 +43,6 @@ const RegistryForApprove = () => {
...
@@ -59,9 +43,6 @@ const RegistryForApprove = () => {
stopRepeatability
=
{
stopRepeatabilityHandler
}
stopRepeatability
=
{
stopRepeatabilityHandler
}
payments
=
{
todaysPayments
}
/
>
payments
=
{
todaysPayments
}
/
>
<
/div
>
<
/div
>
<
/div
>
)
)
};
};
...
...
front/src/store/actions/paymentAction.js
View file @
6970c868
...
@@ -2,6 +2,7 @@ import { push } from "connected-react-router";
...
@@ -2,6 +2,7 @@ import { push } from "connected-react-router";
import
axiosApi
from
"../../axiosApi"
;
import
axiosApi
from
"../../axiosApi"
;
export
const
FETCH_PAYMENTS_SUCCESS
=
"FETCH_PAYMENTS_SUCCESS"
;
export
const
FETCH_PAYMENTS_SUCCESS
=
"FETCH_PAYMENTS_SUCCESS"
;
export
const
FETCH_PAYMENTS_FAILURE
=
"FETCH_PAYMENTS_FAILURE"
;
export
const
FETCH_PAYMENT_BY_ID_SUCCESS
=
"FETCH_PAYMENT_BY_ID_SUCCESS"
;
export
const
FETCH_PAYMENT_BY_ID_SUCCESS
=
"FETCH_PAYMENT_BY_ID_SUCCESS"
;
export
const
CREATE_PAYMENT_SUCCESS
=
"CREATE_PAYMENT_SUCCESS"
;
export
const
CREATE_PAYMENT_SUCCESS
=
"CREATE_PAYMENT_SUCCESS"
;
export
const
FETCH_TODAYS_PAYMENTS_SUCCESS
=
"FETCH_TODAYS_PAYMENTS_SUCCESS"
;
export
const
FETCH_TODAYS_PAYMENTS_SUCCESS
=
"FETCH_TODAYS_PAYMENTS_SUCCESS"
;
...
@@ -12,6 +13,9 @@ export const EDIT_DATA_SUCCESS = "EDIT_DATA_SUCCESS";
...
@@ -12,6 +13,9 @@ export const EDIT_DATA_SUCCESS = "EDIT_DATA_SUCCESS";
export
const
fetchPaymentsSuccess
=
(
payments
)
=>
{
export
const
fetchPaymentsSuccess
=
(
payments
)
=>
{
return
{
type
:
FETCH_PAYMENTS_SUCCESS
,
payments
};
return
{
type
:
FETCH_PAYMENTS_SUCCESS
,
payments
};
};
};
export
const
fetchPaymentsFailure
=
(
error
)
=>
{
return
{
type
:
FETCH_PAYMENTS_FAILURE
,
error
};
};
export
const
fetchPaymentByIdSuccess
=
(
payment
)
=>
{
export
const
fetchPaymentByIdSuccess
=
(
payment
)
=>
{
return
{
type
:
FETCH_PAYMENT_BY_ID_SUCCESS
,
payment
}
return
{
type
:
FETCH_PAYMENT_BY_ID_SUCCESS
,
payment
}
}
}
...
@@ -86,7 +90,11 @@ export const fetchPayments = () => {
...
@@ -86,7 +90,11 @@ export const fetchPayments = () => {
const
response
=
await
axiosApi
.
get
(
"/payments"
);
const
response
=
await
axiosApi
.
get
(
"/payments"
);
dispatch
(
fetchPaymentsSuccess
(
response
.
data
));
dispatch
(
fetchPaymentsSuccess
(
response
.
data
));
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
error
(
e
);
if
(
e
.
response
&&
e
.
response
.
data
)
{
dispatch
(
fetchPaymentsFailure
(
e
.
response
.
data
))
}
else
{
dispatch
(
fetchPaymentsFailure
({
global
:
'No internet'
}))
}
}
}
};
};
};
};
...
...
front/src/store/reducers/paymentReducer.js
View file @
6970c868
const
{
FETCH_PAYMENTS_SUCCESS
,
FETCH_TODAYS_PAYMENTS_SUCCESS
,
FETCH_STATUS_SUCCESS
,
FETCH_PAYMENT_BY_ID_SUCCESS
,
FETCH_TODAYS_FILES_SUCCESS
}
=
require
(
"../actions/paymentAction"
);
const
{
FETCH_PAYMENTS_SUCCESS
,
FETCH_TODAYS_PAYMENTS_SUCCESS
,
FETCH_STATUS_SUCCESS
,
FETCH_PAYMENT_BY_ID_SUCCESS
,
FETCH_TODAYS_FILES_SUCCESS
,
FETCH_PAYMENTS_FAILURE
}
=
require
(
"../actions/paymentAction"
);
const
initialState
=
{
const
initialState
=
{
payments
:
[],
payments
:
[],
paymentsError
:
null
,
paymentById
:
{},
paymentById
:
{},
todaysPayments
:
[],
todaysPayments
:
[],
todayFiles
:
[]
todayFiles
:
[]
...
@@ -11,6 +12,8 @@ const paymentReducer = (state = initialState, action) => {
...
@@ -11,6 +12,8 @@ const paymentReducer = (state = initialState, action) => {
switch
(
action
.
type
)
{
switch
(
action
.
type
)
{
case
FETCH_PAYMENTS_SUCCESS
:
case
FETCH_PAYMENTS_SUCCESS
:
return
{
...
state
,
payments
:
action
.
payments
};
return
{
...
state
,
payments
:
action
.
payments
};
case
FETCH_PAYMENTS_FAILURE
:
return
{
...
state
,
paymentsError
:
action
.
error
};
case
FETCH_PAYMENT_BY_ID_SUCCESS
:
case
FETCH_PAYMENT_BY_ID_SUCCESS
:
return
{
...
state
,
paymentById
:
action
.
payment
};
return
{
...
state
,
paymentById
:
action
.
payment
};
case
FETCH_TODAYS_PAYMENTS_SUCCESS
:
case
FETCH_TODAYS_PAYMENTS_SUCCESS
:
...
...
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