Commit 5dd47d60 authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into deni-dev(pc)

parents afeff22f fbe62400
...@@ -39,6 +39,9 @@ export default class ApprovalMatrix extends Component { ...@@ -39,6 +39,9 @@ export default class ApprovalMatrix extends Component {
rows: null, rows: null,
dataLoaded: false, dataLoaded: false,
popupError: false, popupError: false,
alert: false,
tipeAlert: '',
messageAlert: '',
btncreate: false, btncreate: false,
btnedit: false, btnedit: false,
load: false, load: false,
...@@ -75,10 +78,11 @@ export default class ApprovalMatrix extends Component { ...@@ -75,10 +78,11 @@ export default class ApprovalMatrix extends Component {
this.setState({ payload: body, buttonError: false }) this.setState({ payload: body, buttonError: false })
api.create().checkUploadAM(body).then(response => { api.create().checkUploadAM(body).then(response => {
// console.log(response.data) // console.log(response.data)
let dataRow = []
if(response.data){ if(response.data){
if (response.ok) { if (response.ok) {
if (response.data.status === "success") { if (response.data.status === "success") {
let dataRow = response.data.data.map((item, index) => { dataRow = response.data.data.map((item, index) => {
return [ return [
index + 1, index + 1,
item.approval_type_name, item.approval_type_name,
...@@ -91,7 +95,7 @@ export default class ApprovalMatrix extends Component { ...@@ -91,7 +95,7 @@ export default class ApprovalMatrix extends Component {
] ]
}) })
let columns = [ let columns = [
"ID", "Data",
{ {
name: "Approval Type", name: "Approval Type",
options: { options: {
...@@ -257,7 +261,7 @@ export default class ApprovalMatrix extends Component { ...@@ -257,7 +261,7 @@ export default class ApprovalMatrix extends Component {
rows: dataRow rows: dataRow
}); });
} else { } else {
this.setState({ dataLoaded: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Token")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
...@@ -267,7 +271,7 @@ export default class ApprovalMatrix extends Component { ...@@ -267,7 +271,7 @@ export default class ApprovalMatrix extends Component {
}) })
} }
} else { } else {
this.setState({ dataLoaded: false, alert: true, messageAlert: response.data.message, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
} }
} else { } else {
this.setState({ this.setState({
...@@ -303,6 +307,8 @@ export default class ApprovalMatrix extends Component { ...@@ -303,6 +307,8 @@ export default class ApprovalMatrix extends Component {
load: true load: true
}) })
} }
} else {
this.setState({ load: true })
} }
}) })
} }
...@@ -820,7 +826,7 @@ export default class ApprovalMatrix extends Component { ...@@ -820,7 +826,7 @@ export default class ApprovalMatrix extends Component {
{this.state.visibleUpload && ( {this.state.visibleUpload && (
<div className="test app-popup-show"> <div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}> <div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
<div className="popup-panel grid grid-2x" style={{ backgroundColor: '#51c6ea', height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}> <div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
<div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}> <div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
<div className="popup-title"> <div className="popup-title">
<span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Upload File</span> <span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Upload File</span>
......
...@@ -215,7 +215,6 @@ export default class CreateApprovalMatrix extends Component { ...@@ -215,7 +215,6 @@ export default class CreateApprovalMatrix extends Component {
this.setState({ errorOrder: true, msgErrOrder: 'Order Cannot be Empty.'}) this.setState({ errorOrder: true, msgErrOrder: 'Order Cannot be Empty.'})
} }
else if (R.isNil(this.state.userId)) { else if (R.isNil(this.state.userId)) {
// return alert("Pemberi Persetujuan tidak boleh kosong");
this.setState({ errorApproved: true, msgErrApproved: 'Approver Name Cannot be Empty.' }) this.setState({ errorApproved: true, msgErrApproved: 'Approver Name Cannot be Empty.' })
} }
else if (R.isNil(this.state.operatorId)) { else if (R.isNil(this.state.operatorId)) {
......
...@@ -653,7 +653,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -653,7 +653,7 @@ export default class FixedAssetsMovement extends Component {
<div style={{ flex: 1, padding: 20, width: '100%' }}> <div style={{ flex: 1, padding: 20, width: '100%' }}>
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}> <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} > <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Master Budget - Fixed Assets Movement</Typography> <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Budget Tahunan - Fixed Assets Movement</Typography>
</div> </div>
<div style={{ padding: 20 }}> <div style={{ padding: 20 }}>
<div> <div>
...@@ -685,7 +685,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -685,7 +685,7 @@ export default class FixedAssetsMovement extends Component {
onClick={() => this.props.onClickClose()} onClick={() => this.props.onClickClose()}
> >
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Kembali</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
</div> </div>
</button> </button>
</div> </div>
......
...@@ -38,6 +38,7 @@ export default class ProfitLoss extends Component { ...@@ -38,6 +38,7 @@ export default class ProfitLoss extends Component {
// ["Trade Receivables - Third Party", "142,668", "77,480"], // ["Trade Receivables - Third Party", "142,668", "77,480"],
] ]
} }
this.handleValue = this.handleValue.bind(this)
} }
componentDidMount() { componentDidMount() {
...@@ -61,6 +62,7 @@ export default class ProfitLoss extends Component { ...@@ -61,6 +62,7 @@ export default class ProfitLoss extends Component {
item.type_report_id, item.type_report_id,
item.id, item.id,
item.parent, item.parent,
item.formula,
item.level, item.level,
item.description item.description
]) ])
...@@ -71,23 +73,163 @@ export default class ProfitLoss extends Component { ...@@ -71,23 +73,163 @@ export default class ProfitLoss extends Component {
i.type_report_id, i.type_report_id,
i.id, i.id,
i.parent, i.parent,
i.formula,
i.level, i.level,
i.description i.description
]) ])
i.children.map(val => { i.children.map(val => {
dataTable.push([ if (val.children && val.children.length > 0) {
val.type_report_id, dataTable.push([
val.id, val.type_report_id,
val.parent, val.id,
val.level, val.parent,
val.description val.formula,
]) val.level,
val.description
])
val.children.map(items => {
if (items.children && items.children.length > 0) {
dataTable.push([
items.type_report_id,
items.id,
items.parent,
items.formula,
items.level,
items.description
])
items.children.map(itemss => {
if (itemss.children && itemss.children.length > 0) {
dataTable.push([
itemss.type_report_id,
itemss.id,
itemss.parent,
itemss.formula,
itemss.level,
itemss.description
])
itemss.children.map(item1 => {
if (item1.children && item1.children.length > 0) {
dataTable.push([
item1.type_report_id,
item1.id,
item1.parent,
item1.formula,
item1.level,
item1.description
])
item1.children.map(item2 => {
if (item2.children && item2.children.length > 0) {
dataTable.push([
item2.type_report_id,
item2.id,
item2.parent,
item2.formula,
item2.level,
item2.description
])
item2.children.map(item3 => {
if (item3.children && item3.children.length > 0) {
dataTable.push([
item3.type_report_id,
item3.id,
item3.parent,
item3.formula,
item3.level,
item3.description
])
item3.children.map(item4 => {
if (item4.children && item4.children.length > 0) {
dataTable.push([
item4.type_report_id,
item4.id,
item4.parent,
item4.formula,
item4.level,
item4.description
])
} else {
dataTable.push([
item4.type_report_id,
item4.id,
item4.parent,
item4.formula,
item4.level,
item4.description
])
}
})
} else {
dataTable.push([
item3.type_report_id,
item3.id,
item3.parent,
item3.formula,
item3.level,
item3.description
])
}
})
} else {
dataTable.push([
item2.type_report_id,
item2.id,
item2.parent,
item2.formula,
item2.level,
item2.description
])
}
})
} else {
dataTable.push([
item1.type_report_id,
item1.id,
item1.parent,
item1.formula,
item1.level,
item1.description
])
}
})
} else {
dataTable.push([
itemss.type_report_id,
itemss.id,
itemss.parent,
itemss.formula,
itemss.level,
itemss.description
])
}
})
} else {
dataTable.push([
items.type_report_id,
items.id,
items.parent,
items.formula,
items.level,
items.description
])
}
})
} else {
dataTable.push([
val.type_report_id,
val.id,
val.parent,
val.formula,
val.level,
val.description
])
}
}) })
} else { } else {
dataTable.push([ dataTable.push([
i.type_report_id, i.type_report_id,
i.id, i.id,
i.parent, i.parent,
i.formula,
i.level, i.level,
i.description i.description
]) ])
...@@ -97,6 +239,7 @@ export default class ProfitLoss extends Component { ...@@ -97,6 +239,7 @@ export default class ProfitLoss extends Component {
i.type_report_id, i.type_report_id,
i.id, i.id,
i.parent, i.parent,
i.formula,
i.level, i.level,
i.description i.description
]) ])
...@@ -107,6 +250,7 @@ export default class ProfitLoss extends Component { ...@@ -107,6 +250,7 @@ export default class ProfitLoss extends Component {
item.type_report_id, item.type_report_id,
item.id, item.id,
item.parent, item.parent,
item.formula,
item.level, item.level,
item.description item.description
]) ])
...@@ -137,12 +281,14 @@ export default class ProfitLoss extends Component { ...@@ -137,12 +281,14 @@ export default class ProfitLoss extends Component {
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)
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)
} }
// this.forceUpdate()
// console.log(this.state.dataTable) // console.log(this.state.dataTable)
// this.setState({ // this.setState({
// data: a, // data: a,
...@@ -150,6 +296,32 @@ export default class ProfitLoss extends Component { ...@@ -150,6 +296,32 @@ export default class ProfitLoss extends Component {
} }
render() { render() {
let dataTable2 = this.state.dataTable
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])
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))
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
}
}
const handleValue = (data) => {
let total = 0
dataTable2.map((item, index) => {
if (data.rowData[1] == item[2]) {
total = item[data.columnIndex] == undefined ? (total + 0) : (total + item[data.columnIndex])
}
})
let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[data.rowIndex][2])
let a = dataTable2[data.rowIndex][data.columnIndex] = total
// console.log(indexParent);
return a
}
const columns = [{ const columns = [{
name: "", name: "",
options: { options: {
...@@ -170,11 +342,16 @@ export default class ProfitLoss extends Component { ...@@ -170,11 +342,16 @@ export default class ProfitLoss extends Component {
options: { options: {
display: false display: false
} }
}, {
name: "",
options: {
display: false
}
}, { }, {
name: "Account", name: "Account",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#354960', width: 300 }}> <TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#354960', width: 388 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'left' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'left' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
...@@ -182,69 +359,12 @@ export default class ProfitLoss extends Component { ...@@ -182,69 +359,12 @@ export default class ProfitLoss extends Component {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ width: 388 }}> <div style={{ width: 388 }}>
{tableMeta.rowData[3] == 0 ? {tableMeta.rowData[4] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(val).toUpperCase()}</span> <span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(val).toUpperCase()}</span>
: :
tableMeta.rowData[3] === 1 ? tableMeta.rowData[4] === 1 ?
<span style={{ fontSize: 12, marginLeft: 20 }}>{val}</span> : <span style={{ fontSize: 12, marginLeft: 20 * Number(tableMeta.rowData[4]) }}>{val}</span> :
<span style={{ fontSize: 12, marginLeft: 40 }}>{val}</span> <span style={{ fontSize: 12, marginLeft: 20 * Number(tableMeta.rowData[4]) }}>{val}</span>
}
</div>
)
}
}
}, {
name: "Keterangan",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<TextField
style={{ color: "#5198ea", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
InputProps={{ disableUnderline: true}}
inputProps={{
style: {
fontSize: 12,
color: "#5198ea"
}
}}
onChange={event => {
// console.log(event.target)
updateValue(event.target.value)
this.handleChange(event.target.value, tableMeta)
}}
/>
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<TextField
style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
InputProps={{ disableUnderline: true }}
placeholder=""
disabled={true}
/>
</span>
:
tableMeta.rowData[0] === 1 ?
<span>-</span>
:
<span>validasi</span>
} }
</div> </div>
) )
...@@ -258,23 +378,10 @@ export default class ProfitLoss extends Component { ...@@ -258,23 +378,10 @@ export default class ProfitLoss extends Component {
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
// customHeadRender: (columnMeta) => (
// <TableCell key={columnMeta.index} style={{ ...style2, top: 0, zIndex: 102, backgroundColor: '#354960', width: 96 }}>
// <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
// </TableCell>
// ),
// setCellProps: () => ({
// style: {
// position: "sticky",
// left: 420,
// background: "white",
// zIndex: 101
// }
// }),
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -286,10 +393,10 @@ export default class ProfitLoss extends Component { ...@@ -286,10 +393,10 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
value={value} value={value}
onChange={event => { onBlur={(event) => {
// console.log(event.target) // updateValue(event.target.value)
updateValue(event.target.value) handleChange(event.target.value, tableMeta)
this.handleChange(event.target.value, tableMeta) console.log(dataTable2)
}} }}
/> />
} }
...@@ -303,10 +410,13 @@ export default class ProfitLoss extends Component { ...@@ -303,10 +410,13 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={this.handleValue(tableMeta)} value={handleValue(tableMeta)}
/> />
</span> </span>
: :
tableMeta.rowData[0] === 4 ?
null
:
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
<span>-</span> <span>-</span>
: :
...@@ -327,7 +437,7 @@ export default class ProfitLoss extends Component { ...@@ -327,7 +437,7 @@ export default class ProfitLoss extends Component {
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -339,10 +449,10 @@ export default class ProfitLoss extends Component { ...@@ -339,10 +449,10 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
value={value} value={value}
onChange={event => { onBlur={(event) => {
// console.log(event.target) // updateValue(event.target.value)
updateValue(event.target.value) handleChange(event.target.value, tableMeta)
this.handleChange(event.target.value, tableMeta) console.log(dataTable2)
}} }}
/> />
} }
...@@ -356,7 +466,7 @@ export default class ProfitLoss extends Component { ...@@ -356,7 +466,7 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={this.handleValue(tableMeta)} value={handleValue(tableMeta)}
/> />
</span> </span>
: :
...@@ -380,7 +490,7 @@ export default class ProfitLoss extends Component { ...@@ -380,7 +490,7 @@ export default class ProfitLoss extends Component {
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -392,10 +502,10 @@ export default class ProfitLoss extends Component { ...@@ -392,10 +502,10 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
value={value} value={value}
onChange={event => { onBlur={(event) => {
// console.log(event.target) // updateValue(event.target.value)
updateValue(event.target.value) handleChange(event.target.value, tableMeta)
this.handleChange(event.target.value, tableMeta) console.log(dataTable2)
}} }}
/> />
} }
...@@ -409,7 +519,7 @@ export default class ProfitLoss extends Component { ...@@ -409,7 +519,7 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={this.handleValue(tableMeta)} value={handleValue(tableMeta)}
/> />
</span> </span>
: :
...@@ -433,7 +543,7 @@ export default class ProfitLoss extends Component { ...@@ -433,7 +543,7 @@ export default class ProfitLoss extends Component {
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -445,10 +555,10 @@ export default class ProfitLoss extends Component { ...@@ -445,10 +555,10 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
value={value} value={value}
onChange={event => { onBlur={(event) => {
// console.log(event.target) // updateValue(event.target.value)
updateValue(event.target.value) handleChange(event.target.value, tableMeta)
this.handleChange(event.target.value, tableMeta) console.log(dataTable2)
}} }}
/> />
} }
...@@ -462,7 +572,7 @@ export default class ProfitLoss extends Component { ...@@ -462,7 +572,7 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={this.handleValue(tableMeta)} value={handleValue(tableMeta)}
/> />
</span> </span>
: :
...@@ -486,7 +596,7 @@ export default class ProfitLoss extends Component { ...@@ -486,7 +596,7 @@ export default class ProfitLoss extends Component {
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -498,10 +608,10 @@ export default class ProfitLoss extends Component { ...@@ -498,10 +608,10 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
value={value} value={value}
onChange={event => { onBlur={(event) => {
// console.log(event.target) // updateValue(event.target.value)
updateValue(event.target.value) handleChange(event.target.value, tableMeta)
this.handleChange(event.target.value, tableMeta) console.log(dataTable2)
}} }}
/> />
} }
...@@ -515,7 +625,7 @@ export default class ProfitLoss extends Component { ...@@ -515,7 +625,7 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={this.handleValue(tableMeta)} value={handleValue(tableMeta)}
/> />
</span> </span>
: :
...@@ -539,7 +649,7 @@ export default class ProfitLoss extends Component { ...@@ -539,7 +649,7 @@ export default class ProfitLoss extends Component {
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -551,10 +661,10 @@ export default class ProfitLoss extends Component { ...@@ -551,10 +661,10 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
value={value} value={value}
onChange={event => { onBlur={(event) => {
// console.log(event.target) // updateValue(event.target.value)
updateValue(event.target.value) handleChange(event.target.value, tableMeta)
this.handleChange(event.target.value, tableMeta) console.log(dataTable2)
}} }}
/> />
} }
...@@ -568,7 +678,7 @@ export default class ProfitLoss extends Component { ...@@ -568,7 +678,7 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={this.handleValue(tableMeta)} value={handleValue(tableMeta)}
/> />
</span> </span>
: :
...@@ -592,7 +702,7 @@ export default class ProfitLoss extends Component { ...@@ -592,7 +702,7 @@ export default class ProfitLoss extends Component {
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -604,10 +714,10 @@ export default class ProfitLoss extends Component { ...@@ -604,10 +714,10 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
value={value} value={value}
onChange={event => { onBlur={(event) => {
// console.log(event.target) // updateValue(event.target.value)
updateValue(event.target.value) handleChange(event.target.value, tableMeta)
this.handleChange(event.target.value, tableMeta) console.log(dataTable2)
}} }}
/> />
} }
...@@ -621,7 +731,7 @@ export default class ProfitLoss extends Component { ...@@ -621,7 +731,7 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={this.handleValue(tableMeta)} value={handleValue(tableMeta)}
/> />
</span> </span>
: :
...@@ -705,7 +815,7 @@ export default class ProfitLoss extends Component { ...@@ -705,7 +815,7 @@ export default class ProfitLoss extends Component {
<div style={{ marginTop: 20, width: '100%' }}> <div style={{ marginTop: 20, width: '100%' }}>
<MuiThemeProvider theme={getMuiTheme()}> <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
data={this.state.dataTable} data={dataTable2}
columns={columns} columns={columns}
options={options} options={options}
/> />
......
...@@ -41,7 +41,7 @@ class ForgotPassword extends Component { ...@@ -41,7 +41,7 @@ class ForgotPassword extends Component {
if (this.state.email.trim() == "") { if (this.state.email.trim() == "") {
this.setState({ errorEmail: true, msgEmail: 'Email Cannot be Empty.' }) this.setState({ errorEmail: true, msgEmail: 'Email Cannot be Empty.' })
} else if (!isEmail) { } else if (!isEmail) {
this.setState({ errorEmail: true, msgEmail: 'Email Format is Not Correct.' }) this.setState({ errorEmail: true, msgEmail: 'Please enter a valid email address.' })
} else { } else {
this.verification() this.verification()
} }
......
...@@ -77,7 +77,7 @@ class Login extends Component { ...@@ -77,7 +77,7 @@ class Login extends Component {
if (this.state.email.trim() == "") { if (this.state.email.trim() == "") {
this.setState({ errorEmail: true, msgEmail: 'Email Cannot be Empty.' }) this.setState({ errorEmail: true, msgEmail: 'Email Cannot be Empty.' })
} else if (!isEmail) { } else if (!isEmail) {
this.setState({ errorEmail: true, msgEmail: 'Email Format is Not Correct.' }) this.setState({ errorEmail: true, msgEmail: 'Please enter a valid email address.' })
} 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 { } else {
......
...@@ -249,6 +249,8 @@ export default class CreatePerusahaan extends Component { ...@@ -249,6 +249,8 @@ export default class CreatePerusahaan extends Component {
validasiEdit() { validasiEdit() {
if (R.isEmpty(this.state.company)) { if (R.isEmpty(this.state.company)) {
this.setState({ errorNP: true, msgErrorNP: 'Company Name Cannot be Empty.' }) this.setState({ errorNP: true, msgErrorNP: 'Company Name Cannot be Empty.' })
} else if (R.isNil(this.state.getPerusahaan)) {
this.setState({ errorPC: true, msgErrorPC: 'Parent Company Cannot be Empty.' })
} else if (R.isNil(this.state.getTypes)) { } else if (R.isNil(this.state.getTypes)) {
this.setState({ errorUB: true, msgErrorUB: 'Business Unit Cannot be Empty.' }) this.setState({ errorUB: true, msgErrorUB: 'Business Unit Cannot be Empty.' })
} else if (R.isNil(this.state.startDate)) { } else if (R.isNil(this.state.startDate)) {
...@@ -260,7 +262,8 @@ export default class CreatePerusahaan extends Component { ...@@ -260,7 +262,8 @@ export default class CreatePerusahaan extends Component {
"company_id": this.state.companyID, "company_id": this.state.companyID,
"company_name": this.state.company, "company_name": this.state.company,
"business_unit_id": this.state.getTypes.business_unit_id, "business_unit_id": this.state.getTypes.business_unit_id,
"parent": this.state.getPerusahaan == null ? null : this.state.getPerusahaan.company_id, // "parent": this.state.getPerusahaan == null ? null : this.state.getPerusahaan.company_id,
"parent": this.state.getPerusahaan.company_id,
"start_date": this.state.startDate, "start_date": this.state.startDate,
"end_date": this.state.endDate "end_date": this.state.endDate
} }
...@@ -271,6 +274,8 @@ export default class CreatePerusahaan extends Component { ...@@ -271,6 +274,8 @@ export default class CreatePerusahaan extends Component {
validasi() { validasi() {
if (R.isEmpty(this.state.company)) { if (R.isEmpty(this.state.company)) {
this.setState({ errorNP: true, msgErrorNP: 'Company Name Cannot be Empty.' }) this.setState({ errorNP: true, msgErrorNP: 'Company Name Cannot be Empty.' })
} else if (R.isNil(this.state.getPerusahaan)) {
this.setState({ errorPC: true, msgErrorPC: 'Parent Company Cannot be Empty.' })
} else if (R.isNil(this.state.getTypes)) { } else if (R.isNil(this.state.getTypes)) {
this.setState({ errorUB: true, msgErrorUB: 'Business Unit Cannot be Empty.' }) this.setState({ errorUB: true, msgErrorUB: 'Business Unit Cannot be Empty.' })
} else if (R.isNil(this.state.startDate)) { } else if (R.isNil(this.state.startDate)) {
...@@ -281,7 +286,8 @@ export default class CreatePerusahaan extends Component { ...@@ -281,7 +286,8 @@ export default class CreatePerusahaan extends Component {
else { else {
let payload = { let payload = {
"company_name": this.state.company, "company_name": this.state.company,
"parent": this.state.getPerusahaan == null ? null : this.state.getPerusahaan.company_id, // "parent": this.state.getPerusahaan == null ? null : this.state.getPerusahaan.company_id,
"parent": this.state.getPerusahaan.company_id,
"business_unit_id": this.state.getTypes.business_unit_id, "business_unit_id": this.state.getTypes.business_unit_id,
"start_date": this.state.startDate, "start_date": this.state.startDate,
"end_date": this.state.endDate "end_date": this.state.endDate
...@@ -448,12 +454,21 @@ export default class CreatePerusahaan extends Component { ...@@ -448,12 +454,21 @@ export default class CreatePerusahaan extends Component {
</TextField> </TextField>
</div> </div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete <Autocomplete
{...this.state.perusahaan} {...this.state.perusahaan}
debug debug
id="tipe" id="tipe"
onChange={(event, newInputValue) => this.setState({ getPerusahaan: newInputValue })} onChange={(event, newInputValue) => this.setState({ getPerusahaan: newInputValue }, ()=> this.clearError())}
renderInput={(params) => <TextField {...params} InputProps={{ ...params.InputProps, style: { fontSize: 11 } }} InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }} label="Parent Company" />} renderInput={(params) =>
<TextField
{...params}
label="Parent Company"
error={this.state.errorPC}
helperText={this.state.msgErrorPC}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
/>
}
value={this.state.getPerusahaan} value={this.state.getPerusahaan}
/> />
</div> </div>
...@@ -662,9 +677,18 @@ export default class CreatePerusahaan extends Component { ...@@ -662,9 +677,18 @@ export default class CreatePerusahaan extends Component {
{...this.state.perusahaan} {...this.state.perusahaan}
debug debug
id="tipe" id="tipe"
onChange={(event, newInputValue) => this.setState({ getPerusahaan: newInputValue })} onChange={(event, newInputValue) => this.setState({ getPerusahaan: newInputValue }, ()=> this.clearError())}
renderInput={(params) => <TextField {...params} InputProps={{ ...params.InputProps, style: { fontSize: 11 } }} InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }} label="Parent Company" />} renderInput={(params) =>
value={this.state.getPerusahaan} <TextField
{...params}
label="Parent Company"
error={this.state.errorPC}
helperText={this.state.msgErrorPC}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
/>
}
value={this.state.perusahaan}
/> />
</div> </div>
<div style={{ padding: 10, borderRadius: 5 }}> <div style={{ padding: 10, borderRadius: 5 }}>
......
...@@ -46,7 +46,8 @@ export default class Perusahaan extends Component { ...@@ -46,7 +46,8 @@ export default class Perusahaan extends Component {
messageAlert: '', messageAlert: '',
create: false, create: false,
edit: false, edit: false,
load: false load: false,
judul: ''
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -58,7 +59,6 @@ export default class Perusahaan extends Component { ...@@ -58,7 +59,6 @@ export default class Perusahaan extends Component {
console.log(err); console.log(err);
} }
else { else {
let judul = resp.rows[2]
let isi = resp.rows.slice(3) let isi = resp.rows.slice(3)
let payload = [] let payload = []
isi.map((item, index) => { isi.map((item, index) => {
...@@ -76,185 +76,188 @@ export default class Perusahaan extends Component { ...@@ -76,185 +76,188 @@ export default class Perusahaan extends Component {
let body = { let body = {
company: payload company: payload
} }
this.setState({ payload: body, buttonError: false }) console.log(resp.rows[1])
api.create().checkUploadPerusahaan(body).then(response => { this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0] })
console.log(response); }
if (response.data) { });
if (response.ok) { }
if (response.data.status === "success") {
let dataRow = response.data.data.map((item, index) => { checkUpload() {
return [ api.create().checkUploadPerusahaan(this.state.payload).then(response => {
index + 1, console.log(response);
item.company_name, if (response.data) {
item.company_parent, if (response.ok) {
item.unit_bisnis, if (response.data.status === "success") {
item.start_date, let dataRow = response.data.data.map((item, index) => {
item.end_date, return [
item.error index + 1,
] item.company_name,
}) item.company_parent,
let columns = [ item.unit_bisnis,
"Data", item.start_date,
{ item.end_date,
name: "Company Name", item.error
options: { ]
customBodyRender: (val, tableMeta) => { })
let check = null let columns = [
if (tableMeta.rowData[6] != null) { "Data",
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('company_name')) {
if (check > -1) { name: "Company Name",
this.setState({ buttonError: true }) options: {
} customBodyRender: (val, tableMeta) => {
} let check = null
return ( if (tableMeta.rowData[6] != null) {
<div style={{ display: 'flex' }}> check = tableMeta.rowData[6].findIndex((val) => val.field.includes('company_name'))
{tableMeta.rowData[6] != null && check > -1 ? if (check > -1) {
<a data-tip={tableMeta.rowData[6][check].message} data-for="company_name"> this.setState({ buttonError: true })
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
}
<ReactTooltip border={true} id="company_name" place="bottom" type="light" effect="solid" />
</div >
);
} }
} }
}, return (
{ <div style={{ display: 'flex' }}>
name: "Parent Company", {tableMeta.rowData[6] != null && check > -1 ?
options: { <a data-tip={tableMeta.rowData[6][check].message} data-for="company_name">
customBodyRender: (val, tableMeta) => { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
let check = null </a> :
if (tableMeta.rowData[6] != null) { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('company_parent'))
if (check > -1) {
this.setState({ buttonError: true })
}
} }
return ( <ReactTooltip border={true} id="company_name" place="bottom" type="light" effect="solid" />
<div style={{ display: 'flex' }}> </div >
{tableMeta.rowData[6] != null && check > -1 ? );
<a data-tip={tableMeta.rowData[6][check].message} data-for="company_parent"> }
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> }
</a> : },
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> {
} name: "Parent Company",
<ReactTooltip border={true} id="company_parent" place="bottom" type="light" effect="solid" /> options: {
</div > customBodyRender: (val, tableMeta) => {
); let check = null
if (tableMeta.rowData[6] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('company_parent'))
if (check > -1) {
this.setState({ buttonError: true })
} }
} }
}, return (
{ <div style={{ display: 'flex' }}>
name: "Unit Bisnis", {tableMeta.rowData[6] != null && check > -1 ?
options: { <a data-tip={tableMeta.rowData[6][check].message} data-for="company_parent">
customBodyRender: (val, tableMeta) => { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
let check = null </a> :
if (tableMeta.rowData[6] != null) { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('unit_bisnis'))
if (check > -1) {
this.setState({ buttonError: true })
}
} }
return ( <ReactTooltip border={true} id="company_parent" place="bottom" type="light" effect="solid" />
<div style={{ display: 'flex' }}> </div >
{tableMeta.rowData[6] != null && check > -1 ? );
<a data-tip={tableMeta.rowData[6][check].message} data-for="unit_bisnis"> }
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> }
</a> : },
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> {
} name: "Business Unit",
<ReactTooltip border={true} id="unit_bisnis" place="bottom" type="light" effect="solid" /> options: {
</div > customBodyRender: (val, tableMeta) => {
); let check = null
if (tableMeta.rowData[6] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('unit_bisnis'))
if (check > -1) {
this.setState({ buttonError: true })
} }
} }
}, return (
{ <div style={{ display: 'flex' }}>
name: "Start Date", {tableMeta.rowData[6] != null && check > -1 ?
options: { <a data-tip={tableMeta.rowData[6][check].message} data-for="unit_bisnis">
customBodyRender: (val, tableMeta) => { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
let check = null </a> :
if (tableMeta.rowData[6] != null) { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('start_date'))
if (check > -1) {
this.setState({ buttonError: true })
}
} }
return ( <ReactTooltip border={true} id="unit_bisnis" place="bottom" type="light" effect="solid" />
<div style={{ display: 'flex' }}> </div >
{tableMeta.rowData[6] != null && check > -1 ? );
<a data-tip={tableMeta.rowData[6][check].message} data-for="startdate"> }
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> }
</a> : },
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> {
} name: "Valid From",
<ReactTooltip border={true} id="startdate" place="bottom" type="light" effect="solid" /> options: {
</div > customBodyRender: (val, tableMeta) => {
); let check = null
if (tableMeta.rowData[6] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('start_date'))
if (check > -1) {
this.setState({ buttonError: true })
} }
} }
}, return (
{ <div style={{ display: 'flex' }}>
name: "End Date", {tableMeta.rowData[6] != null && check > -1 ?
options: { <a data-tip={tableMeta.rowData[6][check].message} data-for="startdate">
customBodyRender: (val, tableMeta) => { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
let check = null </a> :
if (tableMeta.rowData[6] != null) { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('end_date'))
if (check > -1) {
this.setState({ buttonError: true })
}
} }
return ( <ReactTooltip border={true} id="startdate" place="bottom" type="light" effect="solid" />
<div style={{ display: 'flex' }}> </div >
{tableMeta.rowData[6] != null && check > -1 ? );
<a data-tip={tableMeta.rowData[6][check].message} data-for="enddate"> }
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> }
</a> : },
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> {
} name: "Valid To",
<ReactTooltip border={true} id="enddate" place="bottom" type="light" effect="solid" /> options: {
</div > customBodyRender: (val, tableMeta) => {
); let check = null
if (tableMeta.rowData[6] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('end_date'))
if (check > -1) {
this.setState({ buttonError: true })
} }
} }
}, return (
{ <div style={{ display: 'flex' }}>
name: "", {tableMeta.rowData[6] != null && check > -1 ?
options: { <a data-tip={tableMeta.rowData[6][check].message} data-for="enddate">
display: false <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
} </a> :
} <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
] }
<ReactTooltip border={true} id="enddate" place="bottom" type="light" effect="solid" />
console.log(dataRow); </div >
this.setState({ );
dataLoaded: true,
cols: columns,
rows: dataRow
});
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
} }
}) }
},
{
name: "",
options: {
display: false
}
} }
} else { ]
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
} // console.log(dataRow);
this.setState({
dataLoaded: true,
cols: columns,
rows: dataRow, visibleUpload: false,
visiblePerusahaan: false
});
} else { } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
} }
console.log(response); } else {
}) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
} }
}); })
} }
componentDidMount() { componentDidMount() {
...@@ -286,7 +289,7 @@ export default class Perusahaan extends Component { ...@@ -286,7 +289,7 @@ export default class Perusahaan extends Component {
getData() { getData() {
api.create().getPerusahaan().then((response) => { api.create().getPerusahaan().then((response) => {
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') {
...@@ -306,10 +309,10 @@ export default class Perusahaan extends Component { ...@@ -306,10 +309,10 @@ export default class Perusahaan extends Component {
}) })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', dataTable: [] }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', dataTable: [] }) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
} }
}) })
} }
...@@ -715,7 +718,9 @@ export default class Perusahaan extends Component { ...@@ -715,7 +718,9 @@ export default class Perusahaan extends Component {
</button> </button>
<button <button
type="button" type="button"
onClick={() => this.state.buttonError ? this.setState({ popupError: true }) : this.uploadPerusahaan()} disabled={this.state.buttonError == true ? true : false}
onClick={() => this.uploadPerusahaan()}
// onClick={() => this.state.buttonError ? this.setState({ popupError: true }) : this.uploadPerusahaan()}
style={{}} style={{}}
> >
<div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}> <div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
...@@ -784,7 +789,11 @@ export default class Perusahaan extends Component { ...@@ -784,7 +789,11 @@ export default class Perusahaan extends Component {
this.fileHandler(dt) this.fileHandler(dt)
this.setState({ uploadStatus: 'idle', percentage: '0' }) this.setState({ uploadStatus: 'idle', percentage: '0' })
}} }}
onUpload={() => this.setState({ visibleUpload: false, visiblePerusahaan: false })} onUpload={() => {
this.state.judul === "MASTER DATA - COMPANY" ?
this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning'})
}}
/> />
</div> </div>
</div> </div>
......
...@@ -111,7 +111,7 @@ export default class AddRole extends Component { ...@@ -111,7 +111,7 @@ export default class AddRole extends Component {
validasi() { validasi() {
if (R.isEmpty(this.state.roleName)) { if (R.isEmpty(this.state.roleName)) {
this.setState({ errorRoleName: true, msgErrorRN: 'Role Name Cannot be Empty.' }) this.setState({ errorRoleName: true, msgErrorRN: 'User Role Cannot be Empty.' })
} else if (R.isNil(this.state.startDate)) { } else if (R.isNil(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorSD: 'Valid From Cannot be Empty.' }) this.setState({ errorStartDate: true, msgErrorSD: 'Valid From Cannot be Empty.' })
} else if (R.isNil(this.state.endDate)) { } else if (R.isNil(this.state.endDate)) {
......
...@@ -124,7 +124,7 @@ export default class EditRole extends Component { ...@@ -124,7 +124,7 @@ export default class EditRole extends Component {
validasi() { validasi() {
if (R.isEmpty(this.state.tempData.role_name)) { if (R.isEmpty(this.state.tempData.role_name)) {
this.setState({ errorRoleName: true, msgErrorRN: 'Role Name Cannot be Empty.' }) this.setState({ errorRoleName: true, msgErrorRN: 'User Role Cannot be Empty.' })
} else if (R.isNil(this.state.tempData.start_date)) { } else if (R.isNil(this.state.tempData.start_date)) {
this.setState({ errorStartDate: true, msgErrorSD: 'Valid From Cannot be Empty.' }) this.setState({ errorStartDate: true, msgErrorSD: 'Valid From Cannot be Empty.' })
} else if (R.isNil(this.state.tempData.end_date)) { } else if (R.isNil(this.state.tempData.end_date)) {
......
...@@ -70,15 +70,15 @@ class ResetPassword extends Component { ...@@ -70,15 +70,15 @@ class ResetPassword extends Component {
if (this.state.password.trim() == "") { if (this.state.password.trim() == "") {
this.setState({ errorPassword: true, msgPassword: 'New Password Cannot be Empty.' }) this.setState({ errorPassword: true, msgPassword: 'New Password Cannot be Empty.' })
} else if (this.state.password.length < 8) { } else if (this.state.password.length < 8) {
this.setState({ errorPassword: true, msgPassword: 'New Password Minimum 8 Characters.' }) this.setState({ errorPassword: true, msgPassword: 'Invalid password. Minimum length : 8.' })
} else if (this.isEmail(this.state.password)) { } else if (this.isEmail(this.state.password)) {
this.setState({ errorPassword: true, msgPassword: 'New Password Format Should Not Use Email.' }) this.setState({ errorPassword: true, msgPassword: 'Invalid password. Should not be same as Email Address.' })
} else if (!this.isRegex(this.state.password)) { } else if (!this.isRegex(this.state.password)) {
this.setState({ errorPassword: true, msgPassword: 'New Password Must be a Combination of Characters, Letters and Numbers.' }) this.setState({ errorPassword: true, msgPassword: 'Invalid password. Must using combination of characters, letters and numbers.' })
} else if (this.state.confirmPassword.trim() == "") { } else if (this.state.confirmPassword.trim() == "") {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Confirmation Cannot be Empty.' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Confirmation 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: 'The password and password confirmation do not match.' })
} else { } else {
this.confirmPassword() this.confirmPassword()
} }
......
...@@ -70,15 +70,15 @@ class SetPassword extends Component { ...@@ -70,15 +70,15 @@ class SetPassword extends Component {
if (this.state.password.trim() == "") { if (this.state.password.trim() == "") {
this.setState({ errorPassword: true, msgPassword: 'New Password Cannot be Empty.' }) this.setState({ errorPassword: true, msgPassword: 'New Password Cannot be Empty.' })
} else if (this.state.password.length < 8) { } else if (this.state.password.length < 8) {
this.setState({ errorPassword: true, msgPassword: 'New Password Minimum 8 Characters.' }) this.setState({ errorPassword: true, msgPassword: 'Invalid password. Minimum length : 8.' })
} else if (this.isEmail(this.state.password)) { } else if (this.isEmail(this.state.password)) {
this.setState({ errorPassword: true, msgPassword: 'New Password Format Should Not Use Email.' }) this.setState({ errorPassword: true, msgPassword: 'Invalid password. Should not be same as Email Address.' })
} else if (!this.isRegex(this.state.password)) { } else if (!this.isRegex(this.state.password)) {
this.setState({ errorPassword: true, msgPassword: 'New Password Must be a Combination of Characters, Letters and Numbers.' }) this.setState({ errorPassword: true, msgPassword: 'Invalid password. Must using combination of characters, letters and numbers.' })
} else if (this.state.confirmPassword.trim() == "") { } else if (this.state.confirmPassword.trim() == "") {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Confirmation Cannot be Empty.' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Confirmation 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: 'The password and password confirmation do not match.' })
} else { } else {
this.confirmPassword() this.confirmPassword()
} }
......
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