Commit 5b8a2fc8 authored by a.bairuha's avatar a.bairuha

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into syadziy

parents fffcb591 f29298c1
...@@ -52,7 +52,7 @@ export default class PopUpDeleteAM extends Component { ...@@ -52,7 +52,7 @@ export default class PopUpDeleteAM extends Component {
} }
onClickDelete() { onClickDelete() {
if (this.props.type == 'delete') { if (this.props.type === 'delete') {
let payload = this.state.id let payload = this.state.id
this.props.deleteAM(payload) this.props.deleteAM(payload)
} }
......
...@@ -149,8 +149,8 @@ export default class BudgetTahunan extends Component { ...@@ -149,8 +149,8 @@ export default class BudgetTahunan extends Component {
options: periodeData, options: periodeData,
getOptionLabel: (option) => option.periode, getOptionLabel: (option) => option.periode,
}; };
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.getRevision() this.getRevision()
this.getSubmission() this.getSubmission()
}) })
......
...@@ -146,11 +146,11 @@ export default class BalanceSheet extends Component { ...@@ -146,11 +146,11 @@ export default class BalanceSheet extends Component {
handleValue(data) { handleValue(data) {
let total = 0 let total = 0
this.state.dataTable.map((item, index) => { this.state.dataTable.map((item, index) => {
if (data.rowData[1] == item[2]) { if (data.rowData[1] === item[2]) {
total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex])) total = item[data.columnIndex] === undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex]))
} }
}) })
let indexParent = this.state.dataTable.findIndex((val) => val[1] == this.state.dataTable[data.rowIndex][2]) let indexParent = this.state.dataTable.findIndex((val) => val[1] === this.state.dataTable[data.rowIndex][2])
let a = this.state.dataTable[data.rowIndex][data.columnIndex] = total let a = this.state.dataTable[data.rowIndex][data.columnIndex] = total
// console.log(indexParent); // console.log(indexParent);
return a return a
...@@ -159,12 +159,12 @@ export default class BalanceSheet extends Component { ...@@ -159,12 +159,12 @@ export default class BalanceSheet extends Component {
handleChange(value, tableMeta) { handleChange(value, tableMeta) {
let val = String(value).split(",").join("") let val = String(value).split(",").join("")
let data = this.state.dataTable let data = this.state.dataTable
let indexParent = data.findIndex((val) => val[1] == data[tableMeta.rowIndex][2]) let indexParent = data.findIndex((val) => val[1] === data[tableMeta.rowIndex][2])
if (indexParent > 0) { if (indexParent > 0) {
// console.log(indexParent) // console.log(indexParent)
let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
let jagain = data[indexParent][tableMeta.columnIndex] let jagain = data[indexParent][tableMeta.columnIndex]
a = data[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val)) a = data[indexParent][tableMeta.columnIndex] = jagain === undefined ? (0 + Number(val)) : (jagain + Number(val))
} else { } else {
data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
} }
...@@ -304,10 +304,14 @@ export default class BalanceSheet extends Component { ...@@ -304,10 +304,14 @@ export default class BalanceSheet extends Component {
] ]
}) })
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false }, () => { this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false }, () => {
if (this.state.dataTable[22].length > 0) { this.state.dataTable.map(item => {
if (item[22].length > 0) {
console.log('masuk')
this.setState({ buttonError: true, errorPreview: true }) this.setState({ buttonError: true, errorPreview: true })
} }
}) })
// console.log(this.state.dataTable);
})
} }
} }
}) })
...@@ -378,12 +382,12 @@ export default class BalanceSheet extends Component { ...@@ -378,12 +382,12 @@ export default class BalanceSheet extends Component {
const handleChange = (value, tableMeta) => { const handleChange = (value, tableMeta) => {
let val = String(value).split(",").join("") let val = String(value).split(",").join("")
// let data = this.state.dataTable2 // let data = this.state.dataTable2
let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[tableMeta.rowIndex][2]) let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[tableMeta.rowIndex][2])
if (indexParent > 0) { if (indexParent > 0) {
// console.log(indexParent) // console.log(indexParent)
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
let jagain = dataTable2[indexParent][tableMeta.columnIndex] let jagain = dataTable2[indexParent][tableMeta.columnIndex]
a = dataTable2[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val)) a = dataTable2[indexParent][tableMeta.columnIndex] = jagain === undefined ? (0 + Number(val)) : (jagain + Number(val))
} else { } else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
} }
...@@ -391,11 +395,11 @@ export default class BalanceSheet extends Component { ...@@ -391,11 +395,11 @@ export default class BalanceSheet extends Component {
const handleValue = (data) => { const handleValue = (data) => {
let total = 0 let total = 0
dataTable2.map((item, index) => { dataTable2.map((item, index) => {
if (data.rowData[1] == item[2]) { if (data.rowData[1] === item[2]) {
total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex])) 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 indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[data.rowIndex][2])
let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total) let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total)
// console.log(indexParent); // console.log(indexParent);
return a return a
...@@ -2004,7 +2008,17 @@ export default class BalanceSheet extends Component { ...@@ -2004,7 +2008,17 @@ export default class BalanceSheet extends Component {
<div className="col-1"> <div className="col-1">
<button <button
type="button" type="button"
onClick={() => this.state.editable === true ? this.backToMasterBudget('draft') : this.props.onClickClose()} onClick={() => this.state.editable === true ?
this.setState({ loading: true }, () => {
setTimeout(() => {
this.backToMasterBudget('draft')
}, 100);
}) :
this.setState({ loading: true }, () => {
setTimeout(() => {
this.props.onClickClose()
}, 100);
})}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: 'pointer',
...@@ -2028,9 +2042,11 @@ export default class BalanceSheet extends Component { ...@@ -2028,9 +2042,11 @@ export default class BalanceSheet extends Component {
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
}} }}
onClick={() => { onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.props.onClickClose() this.props.onClickClose()
}} }, 100);
})}
> >
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}> <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Cancel</Typography> <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Cancel</Typography>
...@@ -2100,7 +2116,11 @@ export default class BalanceSheet extends Component { ...@@ -2100,7 +2116,11 @@ export default class BalanceSheet extends Component {
<div style={{ display: 'flex', width: '100%', placeContent: 'flex-end', padding: 20 }}> <div style={{ display: 'flex', width: '100%', placeContent: 'flex-end', padding: 20 }}>
<button <button
type="button" type="button"
onClick={() => this.setState({ visibleBalanceSheet: true }, () => this.getItemHierarki())} onClick={() => this.setState({ loading: true, visibleBalanceSheet: true }, () => {
setTimeout(() => {
this.getItemHierarki()
}, 100);
})}
style={{ marginRight: 20 }} style={{ marginRight: 20 }}
> >
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}> <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
...@@ -2110,6 +2130,7 @@ export default class BalanceSheet extends Component { ...@@ -2110,6 +2130,7 @@ export default class BalanceSheet extends Component {
<button <button
className="button" className="button"
type="button" type="button"
disabled={this.state.buttonError}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer', cursor: this.state.buttonError === true ? 'default' : 'pointer',
......
...@@ -311,7 +311,7 @@ export default function MiniDrawer() { ...@@ -311,7 +311,7 @@ export default function MiniDrawer() {
}) })
React.useEffect(() => { React.useEffect(() => {
if (userFullname == "" && userEmail == "") { if (userFullname === "" && userEmail === "") {
getUserData() getUserData()
getMenuHierarki() getMenuHierarki()
} }
...@@ -365,7 +365,7 @@ export default function MiniDrawer() { ...@@ -365,7 +365,7 @@ export default function MiniDrawer() {
let userId = localStorage.getItem(Constant.USER) let userId = localStorage.getItem(Constant.USER)
api.create().getDetailUser(userId).then((response) => { api.create().getDetailUser(userId).then((response) => {
if (response.data) { if (response.data) {
if (response.data.status == 'success') { if (response.data.status === 'success') {
setUserFullname(response.data.data.fullname === null ? 'Anonym' : response.data.data.fullname) setUserFullname(response.data.data.fullname === null ? 'Anonym' : response.data.data.fullname)
setUserEmail(response.data.data.email === null ? 'Anonym@123.xyz' : response.data.data.email) setUserEmail(response.data.data.email === null ? 'Anonym@123.xyz' : response.data.data.email)
setUserPhoto(response.data.data.photo === null ? "" : response.data.data.photo) setUserPhoto(response.data.data.photo === null ? "" : response.data.data.photo)
...@@ -401,7 +401,7 @@ export default function MiniDrawer() { ...@@ -401,7 +401,7 @@ export default function MiniDrawer() {
const selectIndex = (e) => { const selectIndex = (e) => {
setSelectSub("") setSelectSub("")
setSelectedIndex(e) setSelectedIndex(e)
// if (open == false) { // if (open === false) {
// setOpen(true) // setOpen(true)
// } // }
} }
......
...@@ -21,7 +21,7 @@ class HomePage extends Component { ...@@ -21,7 +21,7 @@ class HomePage extends Component {
let userId = localStorage.getItem(Constant.USER) let userId = localStorage.getItem(Constant.USER)
api.create().getDetailUser(userId).then((response) => { api.create().getDetailUser(userId).then((response) => {
if (response.data) { if (response.data) {
if (response.data.status == 'success') { if (response.data.status === 'success') {
this.setState({userData: response.data.data}, () => { this.setState({userData: response.data.data}, () => {
console.log(this.state.userData) console.log(this.state.userData)
}) })
...@@ -111,7 +111,7 @@ class HomePage extends Component { ...@@ -111,7 +111,7 @@ class HomePage extends Component {
return ( return (
<div style={{ flex: 1, backgroundColor: '#f8f8f8' }}> <div style={{ flex: 1, backgroundColor: '#f8f8f8' }}>
<div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}> <div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
<Typography style={{ fontSize: '24px', color: 'white' }}>{this.state.userData == null? '' : `Selamat Datang, ${this.state.userData.fullname} !`}</Typography> <Typography style={{ fontSize: '24px', color: 'white' }}>{this.state.userData === null? '' : `Selamat Datang, ${this.state.userData.fullname} !`}</Typography>
</div> </div>
<div style={{ flex: 1, padding: 20, width: '100%' }}> <div style={{ flex: 1, padding: 20, width: '100%' }}>
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
......
...@@ -122,7 +122,7 @@ export default class CreatePerusahaan extends Component { ...@@ -122,7 +122,7 @@ export default class CreatePerusahaan extends Component {
console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status == 'success') { if (response.data.status === 'success') {
let data = response.data.data let data = response.data.data
let currentIndex = null let currentIndex = null
let perusahaanData = data.map((item, index) => { let perusahaanData = data.map((item, index) => {
......
...@@ -67,17 +67,17 @@ export default class Profile extends Component { ...@@ -67,17 +67,17 @@ export default class Profile extends Component {
let data = this.state let data = this.state
this.setState({ ...data, [e.target.name]: e.target.value }) this.setState({ ...data, [e.target.name]: e.target.value })
console.log(e.target.name); console.log(e.target.name);
if (e.target.name == "password") { if (e.target.name === "password") {
this.setState({ errorPassword: false, msgPassword: 'Consists of 8 Characters with a Combination of Numbers.' }) this.setState({ errorPassword: false, msgPassword: 'Consists of 8 Characters with a Combination of Numbers.' })
} else if (e.target.name == "confirmPassword") { } else if (e.target.name === "confirmPassword") {
this.setState({ errorConfirmPassword: false, msgConfirmPassword: 'Consists of 8 Characters with a Combination of Numbers.' }) this.setState({ errorConfirmPassword: false, msgConfirmPassword: 'Consists of 8 Characters with a Combination of Numbers.' })
} else if (e.target.name == "oldPassword") { } else if (e.target.name === "oldPassword") {
this.setState({ errorOldPassword: false, msgOldPassword: 'Consists of 8 Characters with a Combination of Numbers.' }) this.setState({ errorOldPassword: false, msgOldPassword: 'Consists of 8 Characters with a Combination of Numbers.' })
} }
} }
validasi() { validasi() {
if (this.state.oldPassword == "") { if (this.state.oldPassword === "") {
this.setState({ errorOldPassword: true, msgOldPassword: 'Old Password Cannot be Empty.' }) this.setState({ errorOldPassword: true, msgOldPassword: 'Old Password Cannot be Empty.' })
} else if (this.state.oldPassword.length < 8) { } else if (this.state.oldPassword.length < 8) {
this.setState({ errorOldPassword: true, msgOldPassword: 'Old Password Minimum 8 Characters.' }) this.setState({ errorOldPassword: true, msgOldPassword: 'Old Password Minimum 8 Characters.' })
...@@ -85,7 +85,7 @@ export default class Profile extends Component { ...@@ -85,7 +85,7 @@ export default class Profile extends Component {
this.setState({ errorOldPassword: true, msgOldPassword: 'Old Password Format Should Not Use Email.' }) this.setState({ errorOldPassword: true, msgOldPassword: 'Old Password Format Should Not Use Email.' })
} else if (!this.isRegex(this.state.oldPassword)) { } else if (!this.isRegex(this.state.oldPassword)) {
this.setState({ errorOldPassword: true, msgOldPassword: 'Old Password Must be a Combination of Characters, Letters and Numbers.' }) this.setState({ errorOldPassword: true, msgOldPassword: 'Old Password Must be a Combination of Characters, Letters and Numbers.' })
} else if (this.state.password.trim() == "") { } else if (this.state.password.trim() === "") {
this.setState({ errorPassword: true, msgPassword: 'Password Cannot be Empty.' }) this.setState({ errorPassword: true, msgPassword: 'Password Cannot be Empty.' })
} else if (this.state.password.length < 8) { } else if (this.state.password.length < 8) {
this.setState({ errorPassword: true, msgPassword: 'Password Minimum 8 Characters.' }) this.setState({ errorPassword: true, msgPassword: 'Password Minimum 8 Characters.' })
...@@ -93,7 +93,7 @@ export default class Profile extends Component { ...@@ -93,7 +93,7 @@ export default class Profile extends Component {
this.setState({ errorPassword: true, msgPassword: 'Password Format Should Not Use Email.' }) this.setState({ errorPassword: true, msgPassword: 'Password Format Should Not Use Email.' })
} else if (!this.isRegex(this.state.password)) { } else if (!this.isRegex(this.state.password)) {
this.setState({ errorPassword: true, msgPassword: 'Password Must be a Combination of Characters, Letters and Numbers.' }) this.setState({ errorPassword: true, msgPassword: 'Password Must be a Combination of Characters, Letters and Numbers.' })
} else if (this.state.confirmPassword.trim() == "") { } else if (this.state.confirmPassword.trim() === "") {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Repeat Password Cannot be Empty.' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Repeat Password Cannot be Empty.' })
} else if (this.state.password !== this.state.confirmPassword) { } else if (this.state.password !== this.state.confirmPassword) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Does Not Match.' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Does Not Match.' })
...@@ -157,7 +157,7 @@ export default class Profile extends Component { ...@@ -157,7 +157,7 @@ export default class Profile extends Component {
console.log(response); console.log(response);
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status == 'success') { if (response.data.status === 'success') {
this.setState({ company: response.data.data.company, photo: response.data.data.photo, name: response.data.data.fullname }) this.setState({ company: response.data.data.company, photo: response.data.data.photo, name: response.data.data.fullname })
console.log(response) console.log(response)
} else { } else {
...@@ -184,7 +184,7 @@ export default class Profile extends Component { ...@@ -184,7 +184,7 @@ export default class Profile extends Component {
// console.log(response); // console.log(response);
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status == 'success') { if (response.data.status === 'success') {
this.setState({ listCompany: response.data.data }) this.setState({ listCompany: response.data.data })
console.log(response.data.data) console.log(response.data.data)
} else { } else {
...@@ -207,8 +207,8 @@ export default class Profile extends Component { ...@@ -207,8 +207,8 @@ export default class Profile extends Component {
} }
handleItemChecked(item) { handleItemChecked(item) {
let indexID = this.state.company.findIndex((val) => val == item.id) let indexID = this.state.company.findIndex((val) => val === item.id)
return indexID == -1 ? false : true return indexID === -1 ? false : true
} }
renderChildren = (item, pad) => { renderChildren = (item, pad) => {
...@@ -269,19 +269,19 @@ export default class Profile extends Component { ...@@ -269,19 +269,19 @@ export default class Profile extends Component {
} }
let pathSelect = null let pathSelect = null
if (arrayPath.length == 1) { if (arrayPath.length === 1) {
pathSelect = listCompany[arrayPath[0]] pathSelect = listCompany[arrayPath[0]]
} else if (arrayPath.length == 2) { } else if (arrayPath.length === 2) {
pathSelect = listCompany[arrayPath[0]].children[arrayPath[1]] pathSelect = listCompany[arrayPath[0]].children[arrayPath[1]]
} else if (arrayPath.length == 3) { } else if (arrayPath.length === 3) {
pathSelect = listCompany[arrayPath[0]].children[arrayPath[1]].children[arrayPath[2]] pathSelect = listCompany[arrayPath[0]].children[arrayPath[1]].children[arrayPath[2]]
} else if (arrayPath.length == 4) { } else if (arrayPath.length === 4) {
pathSelect = listCompany[arrayPath[0]].children[arrayPath[1]].children[arrayPath[2]].children[arrayPath[3]] pathSelect = listCompany[arrayPath[0]].children[arrayPath[1]].children[arrayPath[2]].children[arrayPath[3]]
} else if (arrayPath.length == 5) { } else if (arrayPath.length === 5) {
pathSelect = listCompany[arrayPath[0]].children[arrayPath[1]].children[arrayPath[2]].children[arrayPath[3]].children[arrayPath[4]] pathSelect = listCompany[arrayPath[0]].children[arrayPath[1]].children[arrayPath[2]].children[arrayPath[3]].children[arrayPath[4]]
} else if (arrayPath.length == 6) { } else if (arrayPath.length === 6) {
pathSelect = listCompany[arrayPath[0]].children[arrayPath[1]].children[arrayPath[2]].children[arrayPath[3]].children[arrayPath[4]].children[arrayPath[5]] pathSelect = listCompany[arrayPath[0]].children[arrayPath[1]].children[arrayPath[2]].children[arrayPath[3]].children[arrayPath[4]].children[arrayPath[5]]
} else if (arrayPath.length == 7) { } else if (arrayPath.length === 7) {
pathSelect = listCompany[arrayPath[0]].children[arrayPath[1]].children[arrayPath[2]].children[arrayPath[3]].children[arrayPath[4]].children[arrayPath[5]].children[arrayPath[6]] pathSelect = listCompany[arrayPath[0]].children[arrayPath[1]].children[arrayPath[2]].children[arrayPath[3]].children[arrayPath[4]].children[arrayPath[5]].children[arrayPath[6]]
} }
...@@ -399,7 +399,7 @@ export default class Profile extends Component { ...@@ -399,7 +399,7 @@ export default class Profile extends Component {
<Tab label="AUTHORIZATION" style={{ color: '#4b4b4b', fontSize: 11 }} /> <Tab label="AUTHORIZATION" style={{ color: '#4b4b4b', fontSize: 11 }} />
</Tabs> </Tabs>
</AppBar> </AppBar>
{this.state.tab == 0 ? {this.state.tab === 0 ?
<form onSubmit={(e) => { <form onSubmit={(e) => {
e.preventDefault() e.preventDefault()
this.validasi() this.validasi()
......
...@@ -26,7 +26,7 @@ class Upload extends Component { ...@@ -26,7 +26,7 @@ class Upload extends Component {
completed: '0', completed: '0',
alert: false, alert: false,
alertMessage: '', alertMessage: '',
sizeUpload: this.props.sizeUpload === undefined ? 0 : this.props.sizeUpload sizeUpload: this.props.sizeUpload === undefined ? 1 : this.props.sizeUpload
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment