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
29ffc9df
Commit
29ffc9df
authored
Jul 14, 2022
by
muhammad ridwan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ENV-DEV-CR-CAFRM' into 'ENV-DEPLOYMENT'
Env dev cr cafrm See merge request
!1589
parents
b6567423
3c445104
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
90 deletions
+16
-90
CarfmDocument.js
src/container/CRFM/CarfmDocument.js
+5
-48
CreateCarfmDoc.js
src/container/CRFM/CreateCarfmDoc.js
+11
-41
CreateDocumentManagement.js
src/container/DocumentManagement/CreateDocumentManagement.js
+0
-1
No files found.
src/container/CRFM/CarfmDocument.js
View file @
29ffc9df
...
@@ -8,7 +8,6 @@ import ReactTooltip from 'react-tooltip';
...
@@ -8,7 +8,6 @@ import ReactTooltip from 'react-tooltip';
import
api
from
'../../api'
;
import
api
from
'../../api'
;
import
PropagateLoader
from
"react-spinners/PropagateLoader"
import
PropagateLoader
from
"react-spinners/PropagateLoader"
import
TableDocument
from
"./TableDocument"
;
import
TableDocument
from
"./TableDocument"
;
import
PopUpKonfirmasi
from
"../DocumentManagement/PopUpKonfirmasi"
;
import
CreateCarfmDoc
from
"./CreateCarfmDoc"
;
import
CreateCarfmDoc
from
"./CreateCarfmDoc"
;
const
Alert
=
withStyles
({})((
props
)
=>
<
MuiAlert
elevation
=
{
6
}
variant
=
"filled"
{...
props
}
/>
)
;
const
Alert
=
withStyles
({})((
props
)
=>
<
MuiAlert
elevation
=
{
6
}
variant
=
"filled"
{...
props
}
/>
)
;
...
@@ -198,53 +197,18 @@ export default class CarfmDocument extends Component {
...
@@ -198,53 +197,18 @@ export default class CarfmDocument extends Component {
})
})
}
}
async
createUploadDocument
()
{
this
.
setState
({
visibleCreate
:
false
,
konfirmasi
:
false
})
const
formData
=
this
.
state
.
formData
formData
.
append
(
"documentId"
,
this
.
state
.
docId
)
formData
.
append
(
"updated"
,
1
)
this
.
setState
({
loading
:
true
})
await
api
.
create
().
updateDocument
(
formData
).
then
(
response
=>
{
// console.log(response)
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
getDataDocument
(
this
.
state
.
settingID
,
this
.
state
.
menuName
)
this
.
setState
({
konfirmasi
:
false
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
,
visibleCreate
:
false
,
loading
:
false
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
,
loading
:
false
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
}
})
}
async
createDocument
(
payload
)
{
//upload apinya disini
async
createDocument
(
payload
)
{
//upload apinya disini
this
.
setState
({
loading
:
true
})
this
.
setState
({
loading
:
true
})
await
api
.
create
().
uploadCarfmDocument
(
payload
).
then
(
response
=>
{
await
api
.
create
().
uploadCarfmDocument
(
payload
).
then
(
response
=>
{
// console.log(response)
// console.log(response)
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
message
===
"The Document Already Exists in The System, Do You Want to Overwrite It?"
)
{
if
(
response
.
data
.
message
===
"Data was Saved Successfully"
)
{
this
.
setState
({
konfirmasi
:
true
,
formData
:
payload
,
docId
:
response
.
data
.
data
.
document_id
,
loading
:
false
})
}
else
if
(
response
.
data
.
message
===
"Data was Saved Successfully"
)
{
this
.
getDataCarfm
(
'create'
)
this
.
setState
({
visibleCreate
:
false
,
loading
:
false
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
this
.
setState
({
visibleCreate
:
false
,
loading
:
false
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
this
.
getDataCarfm
(
'create'
)
}
}
else
{
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
this
.
setState
({
visibleCreate
:
false
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
localStorage
.
removeItem
(
Constant
.
TOKEN
)
...
@@ -254,10 +218,10 @@ export default class CarfmDocument extends Component {
...
@@ -254,10 +218,10 @@ export default class CarfmDocument extends Component {
})
})
}
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
,
loading
:
false
})
this
.
setState
({
visibleCreate
:
false
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
,
loading
:
false
})
}
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
this
.
setState
({
visibleCreate
:
false
,
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
}
}
})
})
}
}
...
@@ -359,19 +323,12 @@ export default class CarfmDocument extends Component {
...
@@ -359,19 +323,12 @@ export default class CarfmDocument extends Component {
)}
)}
</div>
</div>
{this.state.konfirmasi && (
<PopUpKonfirmasi
onClickClosePopUp={() => this.setState({ konfirmasi: false })}
uploadDocId={this.createUploadDocument.bind(this)}
/>
)}
{this.state.visibleCreate && (
{this.state.visibleCreate && (
<CreateCarfmDoc
<CreateCarfmDoc
onClickClose={() => this.setState({ visibleCreate: false })}
onClickClose={() => this.setState({ visibleCreate: false })}
// getDataDocument={this.getDataDocument.bind(this)}
// getDataDocument={this.getDataDocument.bind(this)}
createDocument={this.createDocument.bind(this)}
createDocument={this.createDocument.bind(this)}
handleLoading={this.handleLoading.bind(this)}
handleLoading={this.handleLoading.bind(this)}
allsubcoCreate={this.state.btnadd}
submenu_id={this.state.submenu_id}
submenu_id={this.state.submenu_id}
/>
/>
)}
)}
...
...
src/container/CRFM/CreateCarfmDoc.js
View file @
29ffc9df
...
@@ -19,7 +19,6 @@ export default class CreateCarfmDoc extends Component {
...
@@ -19,7 +19,6 @@ export default class CreateCarfmDoc extends Component {
super
(
props
)
super
(
props
)
this
.
state
=
{
this
.
state
=
{
perusahaan
:
null
,
perusahaan
:
null
,
perusahaanData
:
null
,
getPerusahaan
:
null
,
getPerusahaan
:
null
,
errorPerusahaan
:
false
,
errorPerusahaan
:
false
,
msgErrorPerusahaan
:
''
,
msgErrorPerusahaan
:
''
,
...
@@ -44,12 +43,11 @@ export default class CreateCarfmDoc extends Component {
...
@@ -44,12 +43,11 @@ export default class CreateCarfmDoc extends Component {
tipeAlert
:
''
,
tipeAlert
:
''
,
messageAlert
:
''
,
messageAlert
:
''
,
fileType
:
''
,
fileType
:
''
,
konfirmasi
:
false
,
docId
:
''
,
docId
:
''
,
sizeUpload
:
"1"
,
sizeUpload
:
"1"
,
disabledPeriode
:
false
,
menuName
:
null
,
menuName
:
null
,
saveDisable
:
false
saveDisable
:
false
,
submitVal
:
0
}
}
}
}
...
@@ -111,10 +109,10 @@ export default class CreateCarfmDoc extends Component {
...
@@ -111,10 +109,10 @@ export default class CreateCarfmDoc extends Component {
// company_name: 'Default'
// company_name: 'Default'
// })
// })
let
typeProps
=
{
let
typeProps
=
{
options
:
typeData
.
sort
((
a
,
b
)
=>
a
.
company_name
-
b
.
company_name
),
options
:
typeData
.
sort
((
a
,
b
)
=>
a
.
company_name
.
localeCompare
(
b
.
company_name
)
),
getOptionLabel
:
(
option
)
=>
option
.
company_name
,
getOptionLabel
:
(
option
)
=>
option
.
company_name
,
};
};
this
.
setState
({
perusahaan
:
typeProps
,
perusahaanData
:
response
.
data
.
data
}
)
this
.
setState
({
perusahaan
:
typeProps
},
()
=>
console
.
log
(
this
.
state
.
perusahaan
)
)
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
...
@@ -252,30 +250,6 @@ export default class CreateCarfmDoc extends Component {
...
@@ -252,30 +250,6 @@ export default class CreateCarfmDoc extends Component {
}
}
validasi
()
{
validasi
()
{
if
(
this
.
state
.
disabledPeriode
===
true
)
{
if
(
R
.
isNil
(
this
.
state
.
file
))
{
this
.
setState
({
alert
:
true
,
messageAlert
:
'File Cannot be Empty'
,
tipeAlert
:
'warning'
,
saveDisable
:
false
})
}
else
{
const
formData
=
new
FormData
();
formData
.
append
(
"file"
,
this
.
state
.
file
);
formData
.
append
(
"companyId"
,
1
);
formData
.
append
(
"submenuId"
,
this
.
props
.
submenu_id
);
formData
.
append
(
"description"
,
this
.
state
.
description
);
formData
.
append
(
"extension"
,
this
.
state
.
fileType
);
formData
.
append
(
"documentPeriode"
,
null
);
formData
.
append
(
"documentMonth"
,
null
);
this
.
setState
({
formData
},
()
=>
{
this
.
props
.
createDocument
(
this
.
state
.
formData
)
})
var
object
=
{};
formData
.
forEach
(
function
(
value
,
key
)
{
object
[
key
]
=
value
;
});
var
json
=
JSON
.
stringify
(
object
);
// console.log(object)
}
}
else
{
if
(
R
.
isNil
(
this
.
state
.
getPerusahaan
))
{
if
(
R
.
isNil
(
this
.
state
.
getPerusahaan
))
{
this
.
setState
({
errorPerusahaan
:
true
,
msgErrorPerusahaan
:
'Company Cannot be Empty'
,
saveDisable
:
false
})
this
.
setState
({
errorPerusahaan
:
true
,
msgErrorPerusahaan
:
'Company Cannot be Empty'
,
saveDisable
:
false
})
}
else
if
(
R
.
isNil
(
this
.
state
.
periode
))
{
}
else
if
(
R
.
isNil
(
this
.
state
.
periode
))
{
...
@@ -285,7 +259,7 @@ export default class CreateCarfmDoc extends Component {
...
@@ -285,7 +259,7 @@ export default class CreateCarfmDoc extends Component {
}
}
else
if
(
R
.
isNil
(
this
.
state
.
file
))
{
else
if
(
R
.
isNil
(
this
.
state
.
file
))
{
this
.
setState
({
alert
:
true
,
messageAlert
:
'File Cannot be Empty'
,
tipeAlert
:
'warning'
,
saveDisable
:
false
})
this
.
setState
({
alert
:
true
,
messageAlert
:
'File Cannot be Empty'
,
tipeAlert
:
'warning'
,
saveDisable
:
false
})
}
else
{
}
else
if
(
this
.
state
.
submitVal
===
1
)
{
const
formData
=
new
FormData
();
const
formData
=
new
FormData
();
formData
.
append
(
"file"
,
this
.
state
.
file
);
formData
.
append
(
"file"
,
this
.
state
.
file
);
formData
.
append
(
"companyId"
,
this
.
state
.
getPerusahaan
.
company_id
);
formData
.
append
(
"companyId"
,
this
.
state
.
getPerusahaan
.
company_id
);
...
@@ -298,7 +272,6 @@ export default class CreateCarfmDoc extends Component {
...
@@ -298,7 +272,6 @@ export default class CreateCarfmDoc extends Component {
this
.
props
.
createDocument
(
this
.
state
.
formData
,
)
this
.
props
.
createDocument
(
this
.
state
.
formData
,
)
})
})
}
}
}
this
.
props
.
handleLoading
(
0
)
this
.
props
.
handleLoading
(
0
)
}
}
...
@@ -343,7 +316,6 @@ export default class CreateCarfmDoc extends Component {
...
@@ -343,7 +316,6 @@ export default class CreateCarfmDoc extends Component {
<
/div
>
<
/div
>
<
div
className
=
"grid grid-2x grid-mobile-none gap-15px"
style
=
{{
paddingLeft
:
20
,
paddingRight
:
20
,
paddingTop
:
20
}}
>
<
div
className
=
"grid grid-2x grid-mobile-none gap-15px"
style
=
{{
paddingLeft
:
20
,
paddingRight
:
20
,
paddingTop
:
20
}}
>
{
this
.
state
.
disabledPeriode
===
false
?
<
div
className
=
"column-1"
>
<
div
className
=
"column-1"
>
<
div
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
div
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
Autocomplete
<
Autocomplete
...
@@ -363,7 +335,6 @@ export default class CreateCarfmDoc extends Component {
...
@@ -363,7 +335,6 @@ export default class CreateCarfmDoc extends Component {
/
>
/
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
:
true
}
<
div
className
=
"column-2"
>
<
div
className
=
"column-2"
>
<
div
style
=
{{
padding
:
10
,
borderRadius
:
5
,
marginTop
:
"1.2em"
}}
>
<
div
style
=
{{
padding
:
10
,
borderRadius
:
5
,
marginTop
:
"1.2em"
}}
>
...
@@ -379,7 +350,6 @@ export default class CreateCarfmDoc extends Component {
...
@@ -379,7 +350,6 @@ export default class CreateCarfmDoc extends Component {
<
/div
>
<
/div
>
<
/div
>
<
/div
>
{
this
.
state
.
disabledPeriode
===
false
?
<
div
className
=
"column-1"
>
<
div
className
=
"column-1"
>
<
div
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
div
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
Autocomplete
<
Autocomplete
...
@@ -400,8 +370,7 @@ export default class CreateCarfmDoc extends Component {
...
@@ -400,8 +370,7 @@ export default class CreateCarfmDoc extends Component {
/
>
/
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
:
true
}
{
this
.
state
.
disabledPeriode
===
false
?
<
div
className
=
"column-2"
>
<
div
className
=
"column-2"
>
<
div
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
div
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
Autocomplete
<
Autocomplete
...
@@ -422,7 +391,6 @@ export default class CreateCarfmDoc extends Component {
...
@@ -422,7 +391,6 @@ export default class CreateCarfmDoc extends Component {
/
>
/
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
:
true
}
<
/div
>
<
/div
>
<
div
style
=
{{
paddingLeft
:
30
,
paddingRight
:
30
,
paddingTop
:
10
}}
>
<
div
style
=
{{
paddingLeft
:
30
,
paddingRight
:
30
,
paddingTop
:
10
}}
>
<
UploadFile
<
UploadFile
...
@@ -491,10 +459,12 @@ export default class CreateCarfmDoc extends Component {
...
@@ -491,10 +459,12 @@ export default class CreateCarfmDoc extends Component {
type
=
"button"
type
=
"button"
onClick
=
{()
=>
onClick
=
{()
=>
{
{
this
.
props
.
handleLoading
(
1
);
this
.
setState
({
this
.
setState
({
saveDisable
:
true
saveDisable
:
true
,
});
submitVal
:
this
.
state
.
submitVal
+
1
},
console
.
log
());
this
.
props
.
handleLoading
(
1
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
validasi
()
this
.
validasi
()
console
.
log
(
"vlidasi "
+
this
.
validasi
());
console
.
log
(
"vlidasi "
+
this
.
validasi
());
...
...
src/container/DocumentManagement/CreateDocumentManagement.js
View file @
29ffc9df
...
@@ -44,7 +44,6 @@ export default class CreateManagementDoc extends Component {
...
@@ -44,7 +44,6 @@ export default class CreateManagementDoc extends Component {
tipeAlert
:
''
,
tipeAlert
:
''
,
messageAlert
:
''
,
messageAlert
:
''
,
fileType
:
''
,
fileType
:
''
,
konfirmasi
:
false
,
docId
:
''
,
docId
:
''
,
sizeUpload
:
"1"
,
sizeUpload
:
"1"
,
disabledPeriode
:
false
disabledPeriode
:
false
...
...
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