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';
import
api
from
'../../api'
;
import
PropagateLoader
from
"react-spinners/PropagateLoader"
import
TableDocument
from
"./TableDocument"
;
import
PopUpKonfirmasi
from
"../DocumentManagement/PopUpKonfirmasi"
;
import
CreateCarfmDoc
from
"./CreateCarfmDoc"
;
const
Alert
=
withStyles
({})((
props
)
=>
<
MuiAlert
elevation
=
{
6
}
variant
=
"filled"
{...
props
}
/>
)
;
...
...
@@ -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
this
.
setState
({
loading
:
true
})
await
api
.
create
().
uploadCarfmDocument
(
payload
).
then
(
response
=>
{
// console.log(response)
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
message
===
"The Document Already Exists in The System, Do You Want to Overwrite It?"
)
{
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'
)
if
(
response
.
data
.
message
===
"Data was Saved Successfully"
)
{
this
.
setState
({
visibleCreate
:
false
,
loading
:
false
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
this
.
getDataCarfm
(
'create'
)
}
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"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
...
...
@@ -254,10 +218,10 @@ export default class CarfmDocument extends Component {
})
}
}
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
{
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 {
)}
</div>
{this.state.konfirmasi && (
<PopUpKonfirmasi
onClickClosePopUp={() => this.setState({ konfirmasi: false })}
uploadDocId={this.createUploadDocument.bind(this)}
/>
)}
{this.state.visibleCreate && (
<CreateCarfmDoc
onClickClose={() => this.setState({ visibleCreate: false })}
// getDataDocument={this.getDataDocument.bind(this)}
createDocument={this.createDocument.bind(this)}
handleLoading={this.handleLoading.bind(this)}
allsubcoCreate={this.state.btnadd}
submenu_id={this.state.submenu_id}
/>
)}
...
...
src/container/CRFM/CreateCarfmDoc.js
View file @
29ffc9df
...
...
@@ -19,7 +19,6 @@ export default class CreateCarfmDoc extends Component {
super
(
props
)
this
.
state
=
{
perusahaan
:
null
,
perusahaanData
:
null
,
getPerusahaan
:
null
,
errorPerusahaan
:
false
,
msgErrorPerusahaan
:
''
,
...
...
@@ -44,12 +43,11 @@ export default class CreateCarfmDoc extends Component {
tipeAlert
:
''
,
messageAlert
:
''
,
fileType
:
''
,
konfirmasi
:
false
,
docId
:
''
,
sizeUpload
:
"1"
,
disabledPeriode
:
false
,
menuName
:
null
,
saveDisable
:
false
saveDisable
:
false
,
submitVal
:
0
}
}
...
...
@@ -111,10 +109,10 @@ export default class CreateCarfmDoc extends Component {
// company_name: 'Default'
// })
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
,
};
this
.
setState
({
perusahaan
:
typeProps
,
perusahaanData
:
response
.
data
.
data
}
)
this
.
setState
({
perusahaan
:
typeProps
},
()
=>
console
.
log
(
this
.
state
.
perusahaan
)
)
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
...
...
@@ -252,30 +250,6 @@ export default class CreateCarfmDoc extends Component {
}
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
))
{
this
.
setState
({
errorPerusahaan
:
true
,
msgErrorPerusahaan
:
'Company Cannot be Empty'
,
saveDisable
:
false
})
}
else
if
(
R
.
isNil
(
this
.
state
.
periode
))
{
...
...
@@ -285,7 +259,7 @@ export default class CreateCarfmDoc extends Component {
}
else
if
(
R
.
isNil
(
this
.
state
.
file
))
{
this
.
setState
({
alert
:
true
,
messageAlert
:
'File Cannot be Empty'
,
tipeAlert
:
'warning'
,
saveDisable
:
false
})
}
else
{
}
else
if
(
this
.
state
.
submitVal
===
1
)
{
const
formData
=
new
FormData
();
formData
.
append
(
"file"
,
this
.
state
.
file
);
formData
.
append
(
"companyId"
,
this
.
state
.
getPerusahaan
.
company_id
);
...
...
@@ -298,7 +272,6 @@ export default class CreateCarfmDoc extends Component {
this
.
props
.
createDocument
(
this
.
state
.
formData
,
)
})
}
}
this
.
props
.
handleLoading
(
0
)
}
...
...
@@ -343,7 +316,6 @@ export default class CreateCarfmDoc extends Component {
<
/div
>
<
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
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
Autocomplete
...
...
@@ -363,7 +335,6 @@ export default class CreateCarfmDoc extends Component {
/
>
<
/div
>
<
/div
>
:
true
}
<
div
className
=
"column-2"
>
<
div
style
=
{{
padding
:
10
,
borderRadius
:
5
,
marginTop
:
"1.2em"
}}
>
...
...
@@ -379,7 +350,6 @@ export default class CreateCarfmDoc extends Component {
<
/div
>
<
/div
>
{
this
.
state
.
disabledPeriode
===
false
?
<
div
className
=
"column-1"
>
<
div
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
Autocomplete
...
...
@@ -400,8 +370,7 @@ export default class CreateCarfmDoc extends Component {
/
>
<
/div
>
<
/div
>
:
true
}
{
this
.
state
.
disabledPeriode
===
false
?
<
div
className
=
"column-2"
>
<
div
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
Autocomplete
...
...
@@ -422,7 +391,6 @@ export default class CreateCarfmDoc extends Component {
/
>
<
/div
>
<
/div
>
:
true
}
<
/div
>
<
div
style
=
{{
paddingLeft
:
30
,
paddingRight
:
30
,
paddingTop
:
10
}}
>
<
UploadFile
...
...
@@ -491,10 +459,12 @@ export default class CreateCarfmDoc extends Component {
type
=
"button"
onClick
=
{()
=>
{
this
.
props
.
handleLoading
(
1
);
this
.
setState
({
saveDisable
:
true
});
saveDisable
:
true
,
submitVal
:
this
.
state
.
submitVal
+
1
},
console
.
log
());
this
.
props
.
handleLoading
(
1
);
setTimeout
(()
=>
{
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 {
tipeAlert
:
''
,
messageAlert
:
''
,
fileType
:
''
,
konfirmasi
:
false
,
docId
:
''
,
sizeUpload
:
"1"
,
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