Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
Tia-dev
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
Dida Adams Arizona
Tia-dev
Commits
dff087f3
Commit
dff087f3
authored
Sep 22, 2020
by
d.arizona
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apdet gan
parent
fcc1a02e
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
214 deletions
+100
-214
index.js
src/api/index.js
+6
-1
CorporateAnnualTarget.js
src/container/BudgetTahunan/CorporateAnnualTarget.js
+40
-83
OperatingIndicator.js
src/container/OprIndicator/OperatingIndicator.js
+16
-69
OperatingIndicatorDetail.js
src/container/OprIndicator/OperatingIndicatorDetail.js
+38
-61
No files found.
src/api/index.js
View file @
dff087f3
...
@@ -201,6 +201,9 @@ const create = (type = "") => {
...
@@ -201,6 +201,9 @@ const create = (type = "") => {
const
getAllOperatingInd
=
(
body
)
=>
api
.
post
(
'transaction/get_all_operating_indicator_report'
,
body
)
const
getAllOperatingInd
=
(
body
)
=>
api
.
post
(
'transaction/get_all_operating_indicator_report'
,
body
)
const
getOperatingIndDetail
=
(
body
)
=>
api
.
post
(
'transaction/operating_indicator/get_operating_indicator_report_hierarki'
,
body
)
const
getOperatingIndDetail
=
(
body
)
=>
api
.
post
(
'transaction/operating_indicator/get_operating_indicator_report_hierarki'
,
body
)
const
createOpetaingInd
=
(
body
)
=>
api
.
post
(
'transaction/operating_indicator/create_submission_report'
,
body
)
const
createOpetaingInd
=
(
body
)
=>
api
.
post
(
'transaction/operating_indicator/create_submission_report'
,
body
)
const
checkUploadOperatingInd
=
(
body
)
=>
api
.
post
(
'transaction/operating_indicator/check_import'
,
body
)
const
uploadOperatingInd
=
(
body
)
=>
api
.
post
(
'transaction/operating_indicator/import_operating_indicator'
,
body
)
//Template
//Template
const
downloadTemplate
=
(
fileName
,
fileType
)
=>
api
.
get
(
`attachment/download_file?fileName=
${
fileName
}
&&fileType=
${
fileType
}
`
)
const
downloadTemplate
=
(
fileName
,
fileType
)
=>
api
.
get
(
`attachment/download_file?fileName=
${
fileName
}
&&fileType=
${
fileType
}
`
)
...
@@ -341,7 +344,9 @@ const create = (type = "") => {
...
@@ -341,7 +344,9 @@ const create = (type = "") => {
getOpetratingIndID
,
getOpetratingIndID
,
createAllItemReport
,
createAllItemReport
,
deleteAllItemReport
,
deleteAllItemReport
,
validateSubmitReport
validateSubmitReport
,
checkUploadOperatingInd
,
uploadOperatingInd
}
}
}
}
...
...
src/container/BudgetTahunan/CorporateAnnualTarget.js
View file @
dff087f3
...
@@ -60,8 +60,9 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -60,8 +60,9 @@ export default class CorporateAnnualTarget extends Component {
kpiTypeList
:
[],
kpiTypeList
:
[],
maxAchList
:
[],
maxAchList
:
[],
visibleCAT
:
true
,
visibleCAT
:
true
,
buttonError
:
false
buttonError
:
false
,
// formulaYTDList: null,
// formulaYTDList: null,,
dataDelete
:
[]
}
}
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
...
@@ -390,7 +391,8 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -390,7 +391,8 @@ export default class CorporateAnnualTarget extends Component {
// console.log(i[9] == null? "" : i[9].value)
// console.log(i[9] == null? "" : i[9].value)
data
.
push
({
data
.
push
({
"item_report_id"
:
i
[
1
],
"item_report_id"
:
i
[
1
],
"item_report"
:
String
(
i
[
6
]),
"item_name"
:
i
[
1
]
!==
""
?
null
:
String
(
i
[
6
]),
"parent"
:
i
[
1
]
!==
""
?
null
:
i
[
2
],
"weight"
:
String
(
i
[
7
]),
"weight"
:
String
(
i
[
7
]),
"uom"
:
String
(
i
[
8
]),
"uom"
:
String
(
i
[
8
]),
"kpi_type"
:
i
[
9
]
==
null
?
""
:
i
[
9
].
value
,
"kpi_type"
:
i
[
9
]
==
null
?
""
:
i
[
9
].
value
,
...
@@ -426,29 +428,37 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -426,29 +428,37 @@ export default class CorporateAnnualTarget extends Component {
"cat"
:
data
"cat"
:
data
}
}
console
.
log
(
JSON
.
stringify
(
payload
));
console
.
log
(
JSON
.
stringify
(
payload
));
this
.
addNew
Report
(
payload
)
this
.
delete
Report
(
payload
)
}
}
addNewReport
(
payloadBro
)
{
deleteReport
(
payloadBro
)
{
let
data
=
this
.
state
.
dataTable
.
map
((
item
,
index
)
=>
{
let
payload
=
{
"item_report_id"
:
this
.
state
.
dataDelete
}
if
(
item
[
1
]
==
""
)
{
return
{
if
(
this
.
state
.
dataDelete
.
length
>
0
)
{
"item_name"
:
item
[
6
],
api
.
create
().
deleteAllItemReport
(
payload
).
then
((
response
)
=>
{
"parent"
:
item
[
2
]
console
.
log
(
response
)
}
}
})
let
payload
=
{
// api.create().validateSubmitReport(payloadBro).then((response) => {
"company_id"
:
1
,
// console.log(response)
"item_report"
:
data
// if (response.data.data.result) {
}
this
.
props
.
saveToMasterBudget
(
payloadBro
)
this
.
props
.
onClickClose
()
// } else {
// }
// })
})
}
else
{
// api.create().validateSubmitReport(payloadBro).then((response) => {
// console.log(response)
// if (response.data.data.result) {
this
.
props
.
saveToMasterBudget
(
payloadBro
)
this
.
props
.
onClickClose
()
// } else {
api
.
create
().
createAllItemReport
(
payload
).
then
((
response
)
=>
{
// }
this
.
props
.
saveToMasterBudget
(
payloadBro
)
// })
this
.
props
.
onClickClose
()
}
})
}
}
getKPIType
()
{
getKPIType
()
{
...
@@ -536,6 +546,7 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -536,6 +546,7 @@ export default class CorporateAnnualTarget extends Component {
render
()
{
render
()
{
let
dataTable2
=
this
.
state
.
dataTable
let
dataTable2
=
this
.
state
.
dataTable
let
dataDelete
=
this
.
state
.
dataDelete
const
handleChange
=
(
value
,
tableMeta
)
=>
{
const
handleChange
=
(
value
,
tableMeta
)
=>
{
let
val
=
String
(
value
).
split
(
","
).
join
(
""
)
let
val
=
String
(
value
).
split
(
","
).
join
(
""
)
let
total
=
0
let
total
=
0
...
@@ -563,63 +574,6 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -563,63 +574,6 @@ export default class CorporateAnnualTarget extends Component {
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
value
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
value
// this.setState({dataTable: dataTable2})
// this.setState({dataTable: dataTable2})
}
}
const
handleValue
=
(
data
)
=>
{
let
total
=
0
dataTable2
.
map
((
item
,
index
)
=>
{
if
(
data
.
rowData
[
1
]
==
item
[
2
])
{
total
=
item
[
data
.
columnIndex
]
==
undefined
?
(
Number
(
total
)
+
0
)
:
(
Number
(
total
)
+
Number
(
item
[
data
.
columnIndex
]))
}
})
let
indexParent
=
dataTable2
.
findIndex
((
val
)
=>
val
[
1
]
==
dataTable2
[
data
.
rowIndex
][
2
])
let
a
=
dataTable2
[
data
.
rowIndex
][
data
.
columnIndex
]
=
Number
(
total
)
// console.log(indexParent);
return
a
}
const
handleFormula
=
(
data
,
tableMeta
)
=>
{
let
arrayFormula
=
tableMeta
.
rowData
[
3
].
match
(
/
[
a-zA-Z
]
+|
[
0-9
]
+|
[
-!$%^&*()_+|~=`{}
\[\]
:";'<>?,.
\/]
+
(?:\.[
0-9
]
+@|
)
/g
)
let
arrayJumlah
=
[]
arrayFormula
.
map
((
item
,
indexs
)
=>
{
let
index
=
dataTable2
.
findIndex
((
val
)
=>
val
[
1
]
==
item
)
if
(
index
>
0
)
{
arrayJumlah
.
push
(
dataTable2
[
index
][
tableMeta
.
columnIndex
])
}
else
{
arrayJumlah
.
push
(
item
)
}
// if (indexs % 2 !== 0) {
// operator.push(item)
// }
})
let
array
=
arrayJumlah
let
total
=
0
let
opt
=
""
array
.
map
((
item
,
index
)
=>
{
if
(
item
==
"+"
)
{
opt
=
"tambah"
}
else
if
(
item
==
"-"
)
{
opt
=
"kurang"
}
else
if
(
item
==
"*"
)
{
opt
=
"kali"
}
else
if
(
item
==
"/"
)
{
opt
=
"bagi"
}
else
{
if
(
opt
==
"tambah"
)
{
total
=
Number
(
total
)
+
Number
(
item
)
}
else
if
(
opt
==
"kurang"
)
{
total
=
Number
(
total
)
-
Number
(
item
)
}
else
if
(
opt
==
"kali"
)
{
total
=
Number
(
total
)
*
Number
(
item
)
}
else
if
(
opt
==
"bagi"
)
{
total
=
Number
(
total
)
/
Number
(
item
)
}
else
{
total
+=
item
}
}
})
let
a
=
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
Number
(
total
)
return
a
}
const
handleAction
=
(
idParent
)
=>
{
const
handleAction
=
(
idParent
)
=>
{
if
(
idParent
!==
null
)
{
if
(
idParent
!==
null
)
{
...
@@ -634,12 +588,12 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -634,12 +588,12 @@ export default class CorporateAnnualTarget extends Component {
}
}
}
}
const
handleTambah
=
(
data
)
=>
{
const
handleTambah
=
(
data
,
rowIndex
)
=>
{
console
.
log
(
dataTable2
)
console
.
log
(
dataTable2
)
let
newData
=
[]
let
newData
=
[]
dataTable2
.
map
((
item
,
index
)
=>
{
dataTable2
.
map
((
item
,
index
)
=>
{
newData
.
push
(
item
)
newData
.
push
(
item
)
if
(
i
tem
[
1
]
==
data
)
{
if
(
i
ndex
==
rowIndex
)
{
newData
.
push
([
newData
.
push
([
3
,
3
,
""
,
""
,
...
@@ -683,8 +637,11 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -683,8 +637,11 @@ export default class CorporateAnnualTarget extends Component {
}
}
const
handleDelete
=
(
index
)
=>
{
const
handleDelete
=
(
index
)
=>
{
if
(
dataTable2
[
index
][
1
]
!==
""
)
{
dataDelete
.
push
(
dataTable2
[
index
][
1
])
}
dataTable2
.
splice
(
index
,
1
)
dataTable2
.
splice
(
index
,
1
)
this
.
setState
({
dataTable
:
dataTable2
},
()
=>
{
this
.
setState
({
dataTable
:
dataTable2
,
dataDelete
},
()
=>
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
setState
({
loading
:
false
})
this
.
setState
({
loading
:
false
})
},
500
)
},
500
)
...
@@ -742,7 +699,7 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -742,7 +699,7 @@ export default class CorporateAnnualTarget extends Component {
// onClick={() => console.log(tableMeta.rowData[1])}
// onClick={() => console.log(tableMeta.rowData[1])}
onClick
=
{()
=>
{
onClick
=
{()
=>
{
this
.
setState
({
loading
:
true
})
this
.
setState
({
loading
:
true
})
handleTambah
(
tableMeta
.
rowData
[
1
])
handleTambah
(
tableMeta
.
rowData
[
1
]
,
tableMeta
.
rowIndex
)
}}
}}
>
>
<
img
src
=
{
Images
.
add
}
/
>
<
img
src
=
{
Images
.
add
}
/
>
...
...
src/container/OprIndicator/OperatingIndicator.js
View file @
dff087f3
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
}
from
'react'
;
import
{
Typography
,
Paper
,
TextField
,
MenuItem
,
Select
,
FormControlLabel
}
from
'@material-ui/core'
;
import
{
Typography
,
Paper
,
TextField
,
MenuItem
,
Select
,
FormControlLabel
,
createMuiTheme
,
MuiThemeProvider
}
from
'@material-ui/core'
;
import
MUIDataTable
from
'mui-datatables'
;
import
MUIDataTable
from
'mui-datatables'
;
import
Images
from
'../../assets/Images'
;
import
Images
from
'../../assets/Images'
;
import
OperatingIndicatorDetail
from
'./OperatingIndicatorDetail'
import
OperatingIndicatorDetail
from
'./OperatingIndicatorDetail'
...
@@ -10,6 +10,9 @@ import { ExcelRenderer } from 'react-excel-renderer';
...
@@ -10,6 +10,9 @@ import { ExcelRenderer } from 'react-excel-renderer';
import
UploadFile
from
"../../library/Upload"
;
import
UploadFile
from
"../../library/Upload"
;
import
{
format
}
from
'date-fns'
;
import
{
format
}
from
'date-fns'
;
var
ct
=
require
(
"../../library/CustomTable"
);
const
getMuiTheme
=
()
=>
createMuiTheme
(
ct
.
customTable
());
export
default
class
OperatingIndicator
extends
Component
{
export
default
class
OperatingIndicator
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
)
super
(
props
)
...
@@ -121,7 +124,7 @@ export default class OperatingIndicator extends Component {
...
@@ -121,7 +124,7 @@ export default class OperatingIndicator extends Component {
let
index
=
data
.
sort
((
a
,
b
)
=>
a
-
b
).
findIndex
((
val
)
=>
val
==
year
)
let
index
=
data
.
sort
((
a
,
b
)
=>
a
-
b
).
findIndex
((
val
)
=>
val
==
year
)
this
.
setState
({
listPeriode
:
defaultProps
,
periode
:
index
==
-
1
?
periodeData
[
0
]
:
periodeData
[
index
]
},
()
=>
{
this
.
setState
({
listPeriode
:
defaultProps
,
periode
:
index
==
-
1
?
periodeData
[
0
]
:
periodeData
[
index
]
},
()
=>
{
this
.
getReport
()
this
.
getReport
()
this
.
get
Submission
()
this
.
get
OperatingID
()
})
})
}
}
}
}
...
@@ -156,7 +159,7 @@ export default class OperatingIndicator extends Component {
...
@@ -156,7 +159,7 @@ export default class OperatingIndicator extends Component {
})
})
}
}
get
Submission
()
{
get
OperatingID
()
{
let
payload
=
{
let
payload
=
{
"company_id"
:
this
.
state
.
company
.
company_id
,
"company_id"
:
this
.
state
.
company
.
company_id
,
"periode"
:
this
.
state
.
periode
.
periode
"periode"
:
this
.
state
.
periode
.
periode
...
@@ -353,7 +356,7 @@ export default class OperatingIndicator extends Component {
...
@@ -353,7 +356,7 @@ export default class OperatingIndicator extends Component {
id
=
"periode"
id
=
"periode"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
periode
:
newInputValue
},
()
=>
{
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
periode
:
newInputValue
},
()
=>
{
this
.
getReport
()
this
.
getReport
()
this
.
get
Submission
()
this
.
get
OperatingID
()
// this.getReportAttachment()
// this.getReportAttachment()
})}
})}
debug
debug
...
@@ -369,7 +372,7 @@ export default class OperatingIndicator extends Component {
...
@@ -369,7 +372,7 @@ export default class OperatingIndicator extends Component {
id
=
"company"
id
=
"company"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
company
:
newInputValue
},
()
=>
{
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
company
:
newInputValue
},
()
=>
{
this
.
getReport
()
this
.
getReport
()
this
.
get
Submission
()
this
.
get
OperatingID
()
// this.getReportAttachment()
// this.getReportAttachment()
})}
})}
debug
debug
...
@@ -379,72 +382,15 @@ export default class OperatingIndicator extends Component {
...
@@ -379,72 +382,15 @@ export default class OperatingIndicator extends Component {
value
=
{
this
.
state
.
company
}
value
=
{
this
.
state
.
company
}
/
>
/
>
<
/div
>
<
/div
>
{
/* <div style={{ marginTop: 20 }}>
<Autocomplete
{...this.state.listRevision}
id="revision"
onChange={(event, newInputValue) => this.setState({ revision: newInputValue }, () => {
this.getReport()
this.getReportAttachment()
})}
debug
disableClearable
style={{ width: 250 }}
renderInput={(params) => <TextField {...params} label="Revision" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.revision}
/>
</div> */
}
<
div
style
=
{{
marginTop
:
20
}}
>
<
div
style
=
{{
marginTop
:
20
}}
>
<
MUIDataTable
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
data
=
{
this
.
state
.
dataTable
}
<
MUIDataTable
columns
=
{
columns
}
data
=
{
this
.
state
.
dataTable
}
options
=
{
options
}
columns
=
{
columns
}
open
=
{
this
.
props
.
open
}
options
=
{
options
}
height
=
{
this
.
props
.
height
}
/
>
width
=
{
this
.
props
.
width
}
<
/MuiThemeProvider
>
/
>
<
/div
>
{
/* <div style={{ display: 'flex', marginTop: 20 }}>
<div style={{ width: '50%' }}>
<Typography style={{ fontSize: '16px', color: '#4b4b4b', fontWeight: 'bold' }}>Attachment: </Typography>
</div>
<div style={{ width: '50%' }}>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none'
}}
onClick={() => this.setState({ visibleUpload: true })}
>
<Typography style={{ fontSize: '16px', color: '#5198ea' }}>Upload File</Typography>
</button>
</div>
<
/div
>
<
/div
>
<div style={{ display: 'flex', marginTop: 10 }}>
<div style={{ width: '50%', paddingLeft: 20 }}>
{this.state.listAttachment.length > 0 ?
this.state.listAttachment.map((item) => {
return (
<Typography style={{ fontSize: '16px', color: '#4b4b4b' }}>{item.attachment_name}</Typography>
)
})
: null
}
</div>
<div style={{ width: '50%' }}>
{this.state.listAttachment.length > 0 ?
this.state.listAttachment.map((item) => {
return (
<Typography style={{ fontSize: '16px', color: '#ff3939' }}>Delete</Typography>
)
})
: null
}
</div>
</div> */
}
<
/div
>
<
/div
>
<
div
style
=
{{
borderTop
:
'solid 1px #c4c4c4'
,
padding
:
10
,
backgroundColor
:
'#f5f5f5'
,
width
:
'100%'
,
display
:
'flex'
,
justifyContent
:
'flex-end'
}}
>
<
div
style
=
{{
borderTop
:
'solid 1px #c4c4c4'
,
padding
:
10
,
backgroundColor
:
'#f5f5f5'
,
width
:
'100%'
,
display
:
'flex'
,
justifyContent
:
'flex-end'
}}
>
<
div
style
=
{{
backgroundColor
:
'#354960'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
div
style
=
{{
backgroundColor
:
'#354960'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
...
@@ -459,6 +405,7 @@ export default class OperatingIndicator extends Component {
...
@@ -459,6 +405,7 @@ export default class OperatingIndicator extends Component {
{
this
.
state
.
visibleDetailOpt
&&
{
this
.
state
.
visibleDetailOpt
&&
<
OperatingIndicatorDetail
<
OperatingIndicatorDetail
open
=
{
this
.
props
.
open
}
data
=
{
this
.
state
.
dataDetail
}
data
=
{
this
.
state
.
dataDetail
}
height
=
{
this
.
props
.
height
}
height
=
{
this
.
props
.
height
}
width
=
{
this
.
props
.
width
}
width
=
{
this
.
props
.
width
}
...
...
src/container/OprIndicator/OperatingIndicatorDetail.js
View file @
dff087f3
This diff is collapsed.
Click to expand it.
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