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 {
}
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)
}
......@@ -304,9 +304,13 @@ export default class BalanceSheet extends Component {
]
})
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false }, () => {
if (this.state.dataTable[22].length > 0) {
this.setState({ buttonError: true, errorPreview: true })
}
this.state.dataTable.map(item => {
if (item[22].length > 0) {
console.log('masuk')
this.setState({ buttonError: true, errorPreview: true })
}
})
// console.log(this.state.dataTable);
})
}
}
......@@ -378,12 +382,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 +395,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
......@@ -2004,7 +2008,17 @@ export default class BalanceSheet extends Component {
<div className="col-1">
<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={{
backgroundColor: 'transparent',
cursor: 'pointer',
......@@ -2028,9 +2042,11 @@ export default class BalanceSheet extends Component {
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.props.onClickClose()
}}
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.props.onClickClose()
}, 100);
})}
>
<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>
......@@ -2100,7 +2116,11 @@ export default class BalanceSheet extends Component {
<div style={{ display: 'flex', width: '100%', placeContent: 'flex-end', padding: 20 }}>
<button
type="button"
onClick={() => this.setState({ visibleBalanceSheet: true }, () => this.getItemHierarki())}
onClick={() => this.setState({ loading: true, visibleBalanceSheet: true }, () => {
setTimeout(() => {
this.getItemHierarki()
}, 100);
})}
style={{ marginRight: 20 }}
>
<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 {
<button
className="button"
type="button"
disabled={this.state.buttonError}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
......
......@@ -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