Commit 9d215966 authored by Deni Rinaldi's avatar Deni Rinaldi

rapihin

parent d6a7e902
......@@ -52,7 +52,7 @@ export default class PopUpDeleteAM extends Component {
}
onClickDelete() {
if (this.props.type == 'delete') {
if (this.props.type === 'delete') {
let payload = this.state.id
this.props.deleteAM(payload)
}
......
......@@ -149,8 +149,8 @@ export default class BudgetTahunan extends Component {
options: periodeData,
getOptionLabel: (option) => option.periode,
};
let index = data.sort((a, b) => a - b).findIndex((val) => val == year)
this.setState({ listPeriode: defaultProps, periode: index == -1 ? periodeData[0] : periodeData[index] }, () => {
let index = data.sort((a, b) => a - b).findIndex((val) => val === year)
this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => {
this.getRevision()
this.getSubmission()
})
......
......@@ -146,11 +146,11 @@ export default class BalanceSheet extends Component {
handleValue(data) {
let total = 0
this.state.dataTable.map((item, index) => {
if (data.rowData[1] == item[2]) {
total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex]))
if (data.rowData[1] === item[2]) {
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
// console.log(indexParent);
return a
......@@ -159,12 +159,12 @@ export default class BalanceSheet extends Component {
handleChange(value, tableMeta) {
let val = String(value).split(",").join("")
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) {
// console.log(indexParent)
let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
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 {
data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
}
......@@ -305,6 +305,7 @@ export default class BalanceSheet extends Component {
})
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false }, () => {
if (this.state.dataTable[22].length > 0) {
console.log('masuk')
this.setState({ buttonError: true, errorPreview: true })
}
})
......@@ -378,12 +379,12 @@ export default class BalanceSheet extends Component {
const handleChange = (value, tableMeta) => {
let val = String(value).split(",").join("")
// 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) {
// console.log(indexParent)
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
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 {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
}
......@@ -391,11 +392,11 @@ export default class BalanceSheet extends Component {
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]))
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 indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[data.rowIndex][2])
let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total)
// console.log(indexParent);
return a
......
......@@ -311,7 +311,7 @@ export default function MiniDrawer() {
})
React.useEffect(() => {
if (userFullname == "" && userEmail == "") {
if (userFullname === "" && userEmail === "") {
getUserData()
getMenuHierarki()
}
......@@ -365,7 +365,7 @@ export default function MiniDrawer() {
let userId = localStorage.getItem(Constant.USER)
api.create().getDetailUser(userId).then((response) => {
if (response.data) {
if (response.data.status == 'success') {
if (response.data.status === 'success') {
setUserFullname(response.data.data.fullname === null ? 'Anonym' : response.data.data.fullname)
setUserEmail(response.data.data.email === null ? 'Anonym@123.xyz' : response.data.data.email)
setUserPhoto(response.data.data.photo === null ? "" : response.data.data.photo)
......@@ -401,7 +401,7 @@ export default function MiniDrawer() {
const selectIndex = (e) => {
setSelectSub("")
setSelectedIndex(e)
// if (open == false) {
// if (open === false) {
// setOpen(true)
// }
}
......
......@@ -21,7 +21,7 @@ class HomePage extends Component {
let userId = localStorage.getItem(Constant.USER)
api.create().getDetailUser(userId).then((response) => {
if (response.data) {
if (response.data.status == 'success') {
if (response.data.status === 'success') {
this.setState({userData: response.data.data}, () => {
console.log(this.state.userData)
})
......@@ -111,7 +111,7 @@ class HomePage extends Component {
return (
<div style={{ flex: 1, backgroundColor: '#f8f8f8' }}>
<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 style={{ flex: 1, padding: 20, width: '100%' }}>
<div style={{ display: 'flex' }}>
......
......@@ -122,7 +122,7 @@ export default class CreatePerusahaan extends Component {
console.log(response)
if (response.data) {
if (response.ok) {
if (response.data.status == 'success') {
if (response.data.status === 'success') {
let data = response.data.data
let currentIndex = null
let perusahaanData = data.map((item, index) => {
......
......@@ -67,17 +67,17 @@ export default class Profile extends Component {
let data = this.state
this.setState({ ...data, [e.target.name]: e.target.value })
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.' })
} 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.' })
} 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.' })
}
}
validasi() {
if (this.state.oldPassword == "") {
if (this.state.oldPassword === "") {
this.setState({ errorOldPassword: true, msgOldPassword: 'Old Password Cannot be Empty.' })
} else if (this.state.oldPassword.length < 8) {
this.setState({ errorOldPassword: true, msgOldPassword: 'Old Password Minimum 8 Characters.' })
......@@ -85,7 +85,7 @@ export default class Profile extends Component {
this.setState({ errorOldPassword: true, msgOldPassword: 'Old Password Format Should Not Use Email.' })
} else if (!this.isRegex(this.state.oldPassword)) {
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.' })
} else if (this.state.password.length < 8) {
this.setState({ errorPassword: true, msgPassword: 'Password Minimum 8 Characters.' })
......@@ -93,7 +93,7 @@ export default class Profile extends Component {
this.setState({ errorPassword: true, msgPassword: 'Password Format Should Not Use Email.' })
} else if (!this.isRegex(this.state.password)) {
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.' })
} else if (this.state.password !== this.state.confirmPassword) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Does Not Match.' })
......@@ -157,7 +157,7 @@ export default class Profile extends Component {
console.log(response);
if (response.data) {
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 })
console.log(response)
} else {
......@@ -184,7 +184,7 @@ export default class Profile extends Component {
// console.log(response);
if (response.data) {
if (response.ok) {
if (response.data.status == 'success') {
if (response.data.status === 'success') {
this.setState({ listCompany: response.data.data })
console.log(response.data.data)
} else {
......@@ -207,8 +207,8 @@ export default class Profile extends Component {
}
handleItemChecked(item) {
let indexID = this.state.company.findIndex((val) => val == item.id)
return indexID == -1 ? false : true
let indexID = this.state.company.findIndex((val) => val === item.id)
return indexID === -1 ? false : true
}
renderChildren = (item, pad) => {
......@@ -269,19 +269,19 @@ export default class Profile extends Component {
}
let pathSelect = null
if (arrayPath.length == 1) {
if (arrayPath.length === 1) {
pathSelect = listCompany[arrayPath[0]]
} else if (arrayPath.length == 2) {
} else if (arrayPath.length === 2) {
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]]
} else if (arrayPath.length == 4) {
} else if (arrayPath.length === 4) {
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]]
} 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]]
} 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]]
}
......@@ -399,7 +399,7 @@ export default class Profile extends Component {
<Tab label="AUTHORIZATION" style={{ color: '#4b4b4b', fontSize: 11 }} />
</Tabs>
</AppBar>
{this.state.tab == 0 ?
{this.state.tab === 0 ?
<form onSubmit={(e) => {
e.preventDefault()
this.validasi()
......
......@@ -26,7 +26,7 @@ class Upload extends Component {
completed: '0',
alert: false,
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