Commit 72e78932 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 f351a69f c2cd6553
...@@ -45,6 +45,7 @@ export default class ApprovalMatrix extends Component { ...@@ -45,6 +45,7 @@ export default class ApprovalMatrix extends Component {
messageAlert: '', messageAlert: '',
btncreate: false, btncreate: false,
btnedit: false, btnedit: false,
btndelete: false,
load: false, load: false,
judul: '', judul: '',
popupDel: false, popupDel: false,
...@@ -68,7 +69,7 @@ export default class ApprovalMatrix extends Component { ...@@ -68,7 +69,7 @@ export default class ApprovalMatrix extends Component {
payload.push({ payload.push({
id: index + 1, id: index + 1,
approval_type_name: item[0] === undefined ? "" : item[0], approval_type_name: item[0] === undefined ? "" : item[0],
orders: item[1] === undefined ? "" : item[1], orders: item[1] === undefined ? null: item[1],
email: item[2] === undefined ? "" : item[2], email: item[2] === undefined ? "" : item[2],
// fullname: item[2] === undefined ? "" : item[2], // fullname: item[2] === undefined ? "" : item[2],
operator_type_name: item[3] === undefined ? "" : item[3], operator_type_name: item[3] === undefined ? "" : item[3],
...@@ -146,9 +147,9 @@ export default class ApprovalMatrix extends Component { ...@@ -146,9 +147,9 @@ export default class ApprovalMatrix extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[7] != null && check > -1 ? {tableMeta.rowData[7] != null && check > -1 ?
<a data-tip={tableMeta.rowData[7][check].message} data-for="order"> <a data-tip={tableMeta.rowData[7][check].message} data-for="order">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === null ? "Empty" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === null ? "Empty" : val}</span>
} }
<ReactTooltip border={true} id="order" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="order" place="bottom" type="light" effect="solid" />
</div > </div >
...@@ -334,6 +335,7 @@ export default class ApprovalMatrix extends Component { ...@@ -334,6 +335,7 @@ export default class ApprovalMatrix extends Component {
this.setState({ this.setState({
btncreate: response.data.data.create, btncreate: response.data.data.create,
btnedit: response.data.data.edit, btnedit: response.data.data.edit,
btndelete: response.data.data.delete,
load: true load: true
}) })
} else { } else {
...@@ -610,39 +612,41 @@ export default class ApprovalMatrix extends Component { ...@@ -610,39 +612,41 @@ export default class ApprovalMatrix extends Component {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
console.log(tableMeta) console.log(tableMeta)
return ( return (
this.state.btnedit && ( <div style={{ display: 'flex' }}>
<div style={{ display: 'flex' }}> {this.state.btnedit && <span>
<a data-tip={'Edit'} data-for="edit"> <a data-tip={'Edit'} data-for="edit">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
marginRight: 15 marginRight: 15
}} }}
// onClick={() => console.log(tableMeta)} // onClick={() => console.log(tableMeta)}
onClick={() => this.openPopUp(tableMeta.rowData, 'edit')} onClick={() => this.openPopUp(tableMeta.rowData, 'edit')}
> >
<img src={Images.editCopy} /> <img src={Images.editCopy} />
</button> </button>
</a> </a>
<ReactTooltip border={true} id="edit" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="edit" place="bottom" type="light" effect="solid" />
</span>}
{this.state.btndelete && <span>
<a data-tip={'Delete'} data-for="delete"> <a data-tip={'Delete'} data-for="delete">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
}} }}
// onClick={() => console.log(tableMeta)} // onClick={() => console.log(tableMeta)}
onClick={() => this.openPopUp(tableMeta.rowData, 'delete')} onClick={() => this.openPopUp(tableMeta.rowData, 'delete')}
> >
<img src={Images.delete} /> <img src={Images.delete} />
</button> </button>
</a> </a>
<ReactTooltip border={true} id="delete" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="delete" place="bottom" type="light" effect="solid" />
</div > </span>}
) </div >
); );
} }
} }
......
...@@ -85,7 +85,7 @@ class ForgotPassword extends Component { ...@@ -85,7 +85,7 @@ class ForgotPassword extends Component {
{this.state.messageAlert} {this.state.messageAlert}
</Alert> </Alert>
</Snackbar> </Snackbar>
<div style={{padding: 60, display: 'flex', flexDirection: 'column', width: (this.state.msgEmail.length > 45 ? 403 : 378), height: 351, borderRadius: 12, boxShadow: '0 2 4 0 rgba(0, 0, 0, 0.2)', backgroundColor: '#ffffff', justifyContent: 'center', alignItems: 'center' }}> <div style={{padding: 60, display: 'flex', flexDirection: 'column', width: (this.state.msgEmail.length > 45 ? 423 : 378), height: 351, borderRadius: 12, boxShadow: '0 2 4 0 rgba(0, 0, 0, 0.2)', backgroundColor: '#ffffff', justifyContent: 'center', alignItems: 'center' }}>
<img src={Images.triputraBlack} style={{ height: 59, width: 175, alignSelf: 'center'}} /> <img src={Images.triputraBlack} style={{ height: 59, width: 175, alignSelf: 'center'}} />
<TextField <TextField
...@@ -106,7 +106,7 @@ class ForgotPassword extends Component { ...@@ -106,7 +106,7 @@ class ForgotPassword extends Component {
}} }}
/> />
<Button name="submit" variant="contained" disabled={this.state.email.trim() === '' ? true : false} onClick={() => this.validateEmail()} style={{ marginTop: this.state.errorEmail ? (this.state.msgEmail.length > 45 ? 60 : 35) : 23, width: '100%', height: 30, borderRadius: 4, color: this.state.email.trim() === '' ? '#4b4b4b' : '#fff', backgroundColor: this.state.email.trim() === '' ? '#d8d8d8' : '#51c6ea' }}> <Button name="submit" variant="contained" disabled={this.state.email.trim() === '' ? true : false} onClick={() => this.validateEmail()} style={{ marginTop: this.state.errorEmail ? (this.state.msgEmail.length > 45 ? 80 : 35) : 23, width: '100%', height: 30, borderRadius: 4, color: this.state.email.trim() === '' ? '#4b4b4b' : '#fff', backgroundColor: this.state.email.trim() === '' ? '#d8d8d8' : '#51c6ea' }}>
<Typography style={{fontSize: 12, fontFamily: 'Nunito Sans, sans-serif'}}>Reset Password</Typography> <Typography style={{fontSize: 12, fontFamily: 'Nunito Sans, sans-serif'}}>Reset Password</Typography>
</Button> </Button>
......
...@@ -157,7 +157,7 @@ class Login extends Component { ...@@ -157,7 +157,7 @@ class Login extends Component {
this.validateLogin() this.validateLogin()
}} }}
> >
<div style={{ maxWidth: 397, paddingTop: 56, padding: 65, display: 'flex', flexDirection: 'column', height: (this.state.msgEmail.length > 45 ? 475 : 441), borderRadius: 12, boxShadow: '0 2 4 0 rgba(0, 0, 0, 0.2)', backgroundColor: '#ffffff' }}> <div style={{ maxWidth: 397, paddingTop: 56, padding: 65, display: 'flex', flexDirection: 'column', height: (this.state.msgEmail.length > 45 ? 485 : 441), borderRadius: 12, boxShadow: '0 2 4 0 rgba(0, 0, 0, 0.2)', backgroundColor: '#ffffff' }}>
<img src={Images.triputraBlack} style={{ height: 59, width: 175, alignSelf: 'center'}} /> <img src={Images.triputraBlack} style={{ height: 59, width: 175, alignSelf: 'center'}} />
<TextField <TextField
...@@ -189,7 +189,7 @@ class Login extends Component { ...@@ -189,7 +189,7 @@ class Login extends Component {
}} }}
variant="outlined" variant="outlined"
error={this.state.errorPassword} error={this.state.errorPassword}
style={{ width: '100%', height: 51, marginTop: this.state.errorEmail ? (this.state.msgEmail.length > 45 ? 70 : 35) : 20 }} style={{ width: '100%', height: 51, marginTop: this.state.errorEmail ? (this.state.msgEmail.length > 45 ? 80 : 35) : 20 }}
helperText={this.state.msgPassword} helperText={this.state.msgPassword}
onSubmit={() => this.validateLogin()} onSubmit={() => this.validateLogin()}
InputProps={{ InputProps={{
......
...@@ -167,7 +167,7 @@ export default class CreateParameter extends Component { ...@@ -167,7 +167,7 @@ export default class CreateParameter extends Component {
options: perusahaanData, options: perusahaanData,
getOptionLabel: (option) => option.company_name, getOptionLabel: (option) => option.company_name,
}; };
this.setState({ perusahaan: typeProps, perusahaanData: response.data.data, getPerusahaan: index == -1 ? null : perusahaanData[index], msgErrorPerusahaan: index === -1 ? 'Company has been inactive' : "", errorPerusahaan: index === -1 ? true : false }) this.setState({ perusahaan: typeProps, perusahaanData: response.data.data, getPerusahaan: index == -1 ? null : perusahaanData[index], msgErrorPerusahaan: index === -1 ? 'Company has been Inactive' : "", errorPerusahaan: index === -1 ? true : false })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) { if (response.data.message.includes("Someone Logged In")) {
......
...@@ -36,6 +36,7 @@ export default class Parameter extends Component { ...@@ -36,6 +36,7 @@ export default class Parameter extends Component {
messageAlert: '', messageAlert: '',
create: false, create: false,
edit: false, edit: false,
delete: false,
load: false, load: false,
judul: '' judul: ''
} }
...@@ -58,6 +59,7 @@ export default class Parameter extends Component { ...@@ -58,6 +59,7 @@ export default class Parameter extends Component {
this.setState({ this.setState({
create: response.data.data.create, create: response.data.data.create,
edit: response.data.data.edit, edit: response.data.data.edit,
delete: response.data.data.delete,
load: true load: true
}) })
} else { } else {
...@@ -682,39 +684,46 @@ export default class Parameter extends Component { ...@@ -682,39 +684,46 @@ export default class Parameter extends Component {
filter: false, filter: false,
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
this.state.edit && ( <div style={{ display: 'flex' }}>
<div style={{ display: 'flex' }}> {this.state.edit &&
<a data-tip={'Edit'} data-for="edit"> <span>
<button <a data-tip={'Edit'} data-for="edit">
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
marginRight: 15 borderColor: 'transparent',
}} marginRight: 15
// onClick={() => console.log(tableMeta)} }}
onClick={() => this.openPopUp(tableMeta.rowData, 'edit')} // onClick={() => console.log(tableMeta)}
> onClick={() => this.openPopUp(tableMeta.rowData, 'edit')}
<img src={Images.editCopy} /> >
</button> <img src={Images.editCopy} />
</a> </button>
<ReactTooltip border={true} id="edit" place="bottom" type="light" effect="solid" /> </a>
<a data-tip={'Delete'} data-for="delete"> <ReactTooltip border={true} id="edit" place="bottom" type="light" effect="solid" />
<button </span>
style={{ }
backgroundColor: 'transparent', {this.state.delete &&
cursor: 'pointer', <span>
borderColor: 'transparent', <a data-tip={'Delete'} data-for="delete">
}} <button
// onClick={() => console.log(tableMeta)} style={{
onClick={() => this.openPopUp(tableMeta.rowData, 'delete')} backgroundColor: 'transparent',
> cursor: 'pointer',
<img src={Images.delete} /> borderColor: 'transparent',
</button> }}
</a> // onClick={() => console.log(tableMeta)}
<ReactTooltip border={true} id="delete" place="bottom" type="light" effect="solid" /> onClick={() => this.openPopUp(tableMeta.rowData, 'delete')}
</div > >
) <img src={Images.delete} />
</button>
</a>
<ReactTooltip border={true} id="delete" place="bottom" type="light" effect="solid" />
</span>
}
</div >
); );
} }
} }
......
...@@ -143,7 +143,7 @@ export default class CreatePerusahaan extends Component { ...@@ -143,7 +143,7 @@ export default class CreatePerusahaan extends Component {
options: perusahaanData, options: perusahaanData,
getOptionLabel: (option) => option.company_name, getOptionLabel: (option) => option.company_name,
}; };
this.setState({ perusahaan: typeProps, perusahaanData: response.data.data, getPerusahaan: index == -1 ? null : perusahaanData[index] }) this.setState({ perusahaan: typeProps, perusahaanData: response.data.data, getPerusahaan: index == -1 ? null : perusahaanData[index], msgErrorPC: index === -1 ? 'Company has been Inactive' : "", errorPC: index === -1 ? true : false })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) { if (response.data.message.includes("Someone Logged In")) {
...@@ -183,7 +183,7 @@ export default class CreatePerusahaan extends Component { ...@@ -183,7 +183,7 @@ export default class CreatePerusahaan extends Component {
options: typeData, options: typeData,
getOptionLabel: (option) => option.business_unit_name, getOptionLabel: (option) => option.business_unit_name,
}; };
this.setState({ types: typeProps, typeData: response.data.data, getTypes: index == -1 ? null : typeData[index] }) this.setState({ types: typeProps, typeData: response.data.data, getTypes: index == -1 ? null : typeData[index], msgErrorUB: index === -1 ? 'Business Unit has been Inactive' : "", errorUB: index === -1 ? true : false })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) { if (response.data.message.includes("Someone Logged In")) {
......
...@@ -49,6 +49,7 @@ export default class Perusahaan extends Component { ...@@ -49,6 +49,7 @@ export default class Perusahaan extends Component {
messageAlert: '', messageAlert: '',
create: false, create: false,
edit: false, edit: false,
delete: false,
load: false, load: false,
judul: '', judul: '',
rowData: [], rowData: [],
...@@ -281,6 +282,7 @@ export default class Perusahaan extends Component { ...@@ -281,6 +282,7 @@ export default class Perusahaan extends Component {
this.setState({ this.setState({
create: response.data.data.create, create: response.data.data.create,
edit: response.data.data.edit, edit: response.data.data.edit,
delete: response.data.data.delete,
load: true load: true
}) })
} else { } else {
...@@ -525,49 +527,55 @@ export default class Perusahaan extends Component { ...@@ -525,49 +527,55 @@ export default class Perusahaan extends Component {
sort: false, sort: false,
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
this.state.edit && ( <div style={{ display: 'flex' }}>
<div style={{ display: 'flex' }}> {this.state.edit &&
<a data-tip={'Edit'} data-for="edit"> <span>
<button <a data-tip={'Edit'} data-for="edit">
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent' cursor: 'pointer',
}} borderColor: 'transparent'
// onClick={() => this.setState({ visibleEdit: true, data: tableMeta.rowData })} }}
onClick={() => this.openPopUp(tableMeta.rowData, 'edit')} // onClick={() => this.setState({ visibleEdit: true, data: tableMeta.rowData })}
> onClick={() => this.openPopUp(tableMeta.rowData, 'edit')}
<div style={{ display: 'flex' }}> >
{!tableMeta.rowData[2].includes("TIA") ? <div style={{ display: 'flex' }}>
<img src={Images.editCopy} /> : {!tableMeta.rowData[2].includes("TIA") ?
null <img src={Images.editCopy} /> :
} null
</div > }
</button> </div >
</a> </button>
<ReactTooltip border={true} id="edit" place="bottom" type="light" effect="solid" /> </a>
<a data-tip={'Delete'} data-for="delete"> <ReactTooltip border={true} id="edit" place="bottom" type="light" effect="solid" />
<button </span>
style={{ }
backgroundColor: 'transparent', {this.state.delete &&
cursor: 'pointer', <span>
borderColor: 'transparent', <a data-tip={'Delete'} data-for="delete">
marginLeft: 10 <button
}} style={{
// onClick={() => this.setState({ visibleEdit: true, data: tableMeta.rowData })} backgroundColor: 'transparent',
onClick={() => this.openPopUp(tableMeta.rowData, 'delete')} cursor: 'pointer',
> borderColor: 'transparent',
<div style={{ display: 'flex' }}> marginLeft: 10
{!tableMeta.rowData[2].includes("TIA") ? }}
<img src={Images.delete} /> : // onClick={() => this.setState({ visibleEdit: true, data: tableMeta.rowData })}
null onClick={() => this.openPopUp(tableMeta.rowData, 'delete')}
} >
</div > <div style={{ display: 'flex' }}>
</button> {!tableMeta.rowData[2].includes("TIA") ?
</a> <img src={Images.delete} /> :
<ReactTooltip border={true} id="delete" place="bottom" type="light" effect="solid" /> null
</div> }
) </div >
</button>
</a>
<ReactTooltip border={true} id="delete" place="bottom" type="light" effect="solid" />
</span>
}
</div>
); );
} }
} }
......
...@@ -44,6 +44,7 @@ export default class ReportItems extends Component { ...@@ -44,6 +44,7 @@ export default class ReportItems extends Component {
messageAlert: '', messageAlert: '',
buttonCreate: false, buttonCreate: false,
buttonEdit: false, buttonEdit: false,
buttonDelete: false,
load: false, load: false,
judul: '', judul: '',
reportNameDelete: '', reportNameDelete: '',
...@@ -585,6 +586,7 @@ export default class ReportItems extends Component { ...@@ -585,6 +586,7 @@ export default class ReportItems extends Component {
this.setState({ this.setState({
buttonCreate: response.data.data.create, buttonCreate: response.data.data.create,
buttonEdit: response.data.data.edit, buttonEdit: response.data.data.edit,
buttonDelete: response.data.data.delete,
load: true load: true
}) })
} else { } else {
...@@ -829,39 +831,45 @@ export default class ReportItems extends Component { ...@@ -829,39 +831,45 @@ export default class ReportItems extends Component {
sort: false, sort: false,
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
this.state.buttonEdit && ( <div style={{ display: 'flex' }}>
<div style={{ display: 'flex' }}> {this.state.buttonEdit &&
<a data-tip={'Edit'} data-for="edit"> <span>
<button <a data-tip={'Edit'} data-for="edit">
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent' cursor: 'pointer',
}} borderColor: 'transparent'
onClick={() => this.openPopUp(tableMeta.rowData, 'edit')} }}
onClick={() => this.openPopUp(tableMeta.rowData, 'edit')}
> >
<img src={Images.editCopy} /> <img src={Images.editCopy} />
</button> </button>
</a> </a>
<ReactTooltip border={true} id="edit" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="edit" place="bottom" type="light" effect="solid" />
<a data-tip={'Delete'} data-for="delete"> </span>
<button }
style={{ {this.state.buttonDelete &&
backgroundColor: 'transparent', <span>
cursor: 'pointer', <a data-tip={'Delete'} data-for="delete">
borderColor: 'transparent', <button
marginLeft: 15 style={{
}} backgroundColor: 'transparent',
// onClick={() => console.log(tableMeta)} cursor: 'pointer',
onClick={() => this.openPopUp(tableMeta.rowData, 'delete')} borderColor: 'transparent',
> marginLeft: 15
<img src={Images.delete} /> }}
</button> // onClick={() => console.log(tableMeta)}
</a> onClick={() => this.openPopUp(tableMeta.rowData, 'delete')}
<ReactTooltip border={true} id="delete" place="bottom" type="light" effect="solid" /> >
</div > <img src={Images.delete} />
) </button>
</a>
<ReactTooltip border={true} id="delete" place="bottom" type="light" effect="solid" />
</span>
}
</div >
); );
} }
} }
......
...@@ -45,6 +45,7 @@ export default class UnitBisnis extends Component { ...@@ -45,6 +45,7 @@ export default class UnitBisnis extends Component {
messageAlert: '', messageAlert: '',
create: false, create: false,
edit: false, edit: false,
delete: false,
load: false, load: false,
judul: '', judul: '',
rowData: [], rowData: [],
...@@ -228,6 +229,7 @@ export default class UnitBisnis extends Component { ...@@ -228,6 +229,7 @@ export default class UnitBisnis extends Component {
this.setState({ this.setState({
create: response.data.data.create, create: response.data.data.create,
edit: response.data.data.edit, edit: response.data.data.edit,
delete: response.data.data.delete,
load: true load: true
}) })
} else { } else {
...@@ -477,39 +479,45 @@ export default class UnitBisnis extends Component { ...@@ -477,39 +479,45 @@ export default class UnitBisnis extends Component {
sort: false, sort: false,
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
this.state.edit && ( <div style={{ display: 'flex' }}>
<div style={{ display: 'flex' }}> {this.state.edit &&
<a data-tip={'Edit'} data-for="edit"> <span>
<button <a data-tip={'Edit'} data-for="edit">
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
marginRight: 15 borderColor: 'transparent',
}} marginRight: 15
// onClick={() => console.log(tableMeta)} }}
onClick={() => this.openPopUp(tableMeta.rowData, 'edit')} // onClick={() => console.log(tableMeta)}
> onClick={() => this.openPopUp(tableMeta.rowData, 'edit')}
<img src={Images.editCopy} /> >
</button> <img src={Images.editCopy} />
</a> </button>
<ReactTooltip border={true} id="edit" place="bottom" type="light" effect="solid" /> </a>
<a data-tip={'Delete'} data-for="delete"> <ReactTooltip border={true} id="edit" place="bottom" type="light" effect="solid" />
<button </span>
style={{ }
backgroundColor: 'transparent', {this.state.delete &&
cursor: 'pointer', <span>
borderColor: 'transparent', <a data-tip={'Delete'} data-for="delete">
}} <button
// onClick={() => console.log(tableMeta)} style={{
onClick={() => this.openPopUp(tableMeta.rowData, 'delete')} backgroundColor: 'transparent',
> cursor: 'pointer',
<img src={Images.delete} /> borderColor: 'transparent',
</button> }}
</a> // onClick={() => console.log(tableMeta)}
<ReactTooltip border={true} id="delete" place="bottom" type="light" effect="solid" /> onClick={() => this.openPopUp(tableMeta.rowData, 'delete')}
</div > >
) <img src={Images.delete} />
</button>
</a>
<ReactTooltip border={true} id="delete" place="bottom" type="light" effect="solid" />
</span>
}
</div >
); );
} }
} }
......
...@@ -40,16 +40,23 @@ export default class UserRole extends Component { ...@@ -40,16 +40,23 @@ export default class UserRole extends Component {
messageAlert: '', messageAlert: '',
buttonCreate: false, buttonCreate: false,
buttonEdit: false, buttonEdit: false,
buttonDelete: false,
load: false, load: false,
judul: '' judul: ''
} }
} }
componentDidMount() { componentDidMount() {
this.daskdkas()
this.getUser() this.getUser()
this.getPermission() this.getPermission()
} }
async daskdkas() {
let res = await localStorage.getItem(Constant.TOKEN)
console.log(res)
}
closeEdit() { closeEdit() {
this.setState({ edit: false }) this.setState({ edit: false })
} }
...@@ -99,6 +106,7 @@ export default class UserRole extends Component { ...@@ -99,6 +106,7 @@ export default class UserRole extends Component {
this.setState({ this.setState({
buttonCreate: response.data.data.create, buttonCreate: response.data.data.create,
buttonEdit: response.data.data.edit, buttonEdit: response.data.data.edit,
buttonDelete: response.data.data.delete,
load: true load: true
}) })
} else { } else {
...@@ -176,7 +184,27 @@ export default class UserRole extends Component { ...@@ -176,7 +184,27 @@ export default class UserRole extends Component {
let data = this.state.rowData let data = this.state.rowData
api.create().deleteUser(data[1]).then((response) => { api.create().deleteUser(data[1]).then((response) => {
this.setState({popupDel: false}) this.setState({popupDel: false})
this.getUser() if (response.data) {
if (response.ok) {
if (response.data.status == 'success') {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
this.getUser()
}) })
} }
...@@ -401,6 +429,7 @@ export default class UserRole extends Component { ...@@ -401,6 +429,7 @@ export default class UserRole extends Component {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
this.getUser() this.getUser()
this.closeEdit() this.closeEdit()
window.location.reload();
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) { if (response.data.message.includes("Someone Logged In")) {
...@@ -430,6 +459,7 @@ export default class UserRole extends Component { ...@@ -430,6 +459,7 @@ export default class UserRole extends Component {
if (response.data.status === 'Success') { if (response.data.status === 'Success') {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success', add: false }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success', add: false })
this.getUser() this.getUser()
window.location.reload();
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) { if (response.data.message.includes("Someone Logged In")) {
...@@ -472,9 +502,9 @@ export default class UserRole extends Component { ...@@ -472,9 +502,9 @@ export default class UserRole extends Component {
if (response.ok) { if (response.ok) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.getUser() this.getUser()
this.setState({ visibleUser: true, alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) this.setState({ visibleUser: true, alert: true, messageAlert: response.data.message, tipeAlert: 'success', payload: [], rows: [], judul: '' })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', payload: [], rows: [], judul: '' }, () => {
if (response.data.message.includes("Someone Logged In")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
...@@ -484,10 +514,10 @@ export default class UserRole extends Component { ...@@ -484,10 +514,10 @@ export default class UserRole extends Component {
}) })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', payload: [], rows: [], judul: '' })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', payload: [], rows: [], judul: '' })
} }
}) })
} }
...@@ -506,30 +536,40 @@ export default class UserRole extends Component { ...@@ -506,30 +536,40 @@ export default class UserRole extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{/* {tableMeta.rowData[6] === "Active" ? */} {/* {tableMeta.rowData[6] === "Active" ? */}
{this.state.buttonEdit && ( {this.state.buttonEdit && (
<button <span>
style={{ <a data-tip={'Edit'} data-for="edit">
backgroundColor: 'transparent', <button
cursor: 'pointer', style={{
borderColor: 'transparent', backgroundColor: 'transparent',
}} cursor: 'pointer',
// onClick={() => console.log(tableMeta.rowData[1])} borderColor: 'transparent',
onClick={() => this.setState({ edit: true, indexData: tableMeta.rowData[1] })} }}
> // onClick={() => console.log(tableMeta.rowData[1])}
<img src={Images.editCopy} /> onClick={() => this.setState({ edit: true, indexData: tableMeta.rowData[1] })}
</button> >
<img src={Images.editCopy} />
</button>
</a>
<ReactTooltip border={true} id="edit" place="bottom" type="light" effect="solid" />
</span>
)} )}
{this.state.buttonEdit && ( {this.state.buttonDelete && (
<button <span>
style={{ <a data-tip={'Delete'} data-for="delete">
backgroundColor: 'transparent', <button
cursor: 'pointer', style={{
borderColor: 'transparent', backgroundColor: 'transparent',
marginLeft: 10 cursor: 'pointer',
}} borderColor: 'transparent',
onClick={() => this.setState({popupDel: true, rowData: tableMeta.rowData})} marginLeft: 10
> }}
<img src={Images.delete} /> onClick={() => this.setState({popupDel: true, rowData: tableMeta.rowData})}
</button> >
<img src={Images.delete} />
</button>
</a>
<ReactTooltip border={true} id="delete" place="bottom" type="light" effect="solid" />
</span>
)} )}
{/* : {/* :
null null
...@@ -799,35 +839,69 @@ export default class UserRole extends Component { ...@@ -799,35 +839,69 @@ export default class UserRole extends Component {
)} )}
{this.state.popupDel && ( {this.state.popupDel && (
<div className="test app-popup-show"> <div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8, padding: 50 }}> <div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
<div style={{ display: 'flex', justifyContent: 'center' }}> <div style={{ display: 'flex', justifyContent: 'center', paddingTop: 20 }}>
<img src={Images.failedCopy} /> <img src={Images.failed} />
</div> </div>
<div style={{ display: 'grid', justifyContent: 'center', marginTop: 20 }}> <div style={{ display: 'grid', justifyContent: 'center', marginTop: 20, paddingBottom: 20 }}>
<span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}> <span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold', fontFamily: 'Nunito Sans, sans-serif' }}>
Delete {this.state.rowData[2]} ? Delete {titleCase(this.state.rowData[2])} ?
</span> </span>
{/* <span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}> </div>
{`Please try again later.`} <div className="border-top grid grid-2x" style={{ height: 56, backgroundColor: '#f5f5f5', paddingLeft: 20, paddingRight: 20 }}>
</span> */} <div className="column-1" style={{ alignSelf: 'center' }}>
</div> <button
<div style={{ display: 'flex', justifyContent: 'center', marginTop: 24 }}> type="button"
<button onClick={()=> this.setState({popupDel: false})}
className={"btn-save"} >
onClick={()=> this.setState({popupDel: false})} <div style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
> <span style={{ color: '#354960', fontSize: 11 }}>Cancel</span>
<span style={{ color: 'white' }}>Cancel</span> </div>
</button> </button>
<button </div>
className={"btn-save"} <div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
style={{ marginLeft: 50}} <button
onClick={()=> this.deleteUser()} type="button"
> onClick={()=> this.deleteUser()}
<span style={{ color: 'white' }}>Delete</span> >
</button> <div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#fff', fontSize: 11 }}>Delete</span>
</div>
</button>
</div>
</div>
</div> </div>
</div>
</div> </div>
// <div className="test app-popup-show">
// <div className="popup-content background-white border-radius" style={{ borderRadius: 8, padding: 50 }}>
// <div style={{ display: 'flex', justifyContent: 'center' }}>
// <img src={Images.failed} />
// </div>
// <div style={{ display: 'grid', justifyContent: 'center', marginTop: 20 }}>
// <span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}>
// Delete {titleCase(this.state.rowData[2])} ?
// </span>
// {/* <span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}>
// {`Please try again later.`}
// </span> */}
// </div>
// <div style={{ display: 'flex', justifyContent: 'center', marginTop: 24 }}>
// <button
// className={"btn-save"}
// onClick={()=> this.setState({popupDel: false})}
// >
// <span style={{ color: 'white' }}>Cancel</span>
// </button>
// <button
// className={"btn-save"}
// style={{ marginLeft: 50}}
// onClick={()=> this.deleteUser()}
// >
// <span style={{ color: 'white' }}>Delete</span>
// </button>
// </div>
// </div>
// </div>
)} )}
{this.state.popupError && ( {this.state.popupError && (
<PopUpFailedSave onClickClose={() => this.setState({ popupError: false })} /> <PopUpFailedSave onClickClose={() => this.setState({ popupError: false })} />
......
...@@ -254,7 +254,7 @@ export default class EditUser extends Component { ...@@ -254,7 +254,7 @@ export default class EditUser extends Component {
let index = roleData.findIndex((val) => val.role_id === id) let index = roleData.findIndex((val) => val.role_id === id)
console.log(index) console.log(index)
this.setState({ listRole: defaultProps, role: index === -1 ? null : roleData[index], msgErrorRN: index === -1 ? 'Role has been inactive' : '', errorRoleName: index === -1 ? true : false }) this.setState({ listRole: defaultProps, role: index === -1 ? null : roleData[index], msgErrorRN: index === -1 ? 'Role has been Inactive' : '', errorRoleName: index === -1 ? true : false })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) { if (response.data.message.includes("Someone Logged In")) {
......
...@@ -36,6 +36,7 @@ class UserRole extends Component { ...@@ -36,6 +36,7 @@ class UserRole extends Component {
messageAlert: '', messageAlert: '',
buttonCreate: false, buttonCreate: false,
buttonEdit: false, buttonEdit: false,
buttonDelete: false,
load: false load: false
} }
} }
...@@ -98,6 +99,7 @@ class UserRole extends Component { ...@@ -98,6 +99,7 @@ class UserRole extends Component {
this.setState({ this.setState({
buttonCreate: response.data.data.create, buttonCreate: response.data.data.create,
buttonEdit: response.data.data.edit, buttonEdit: response.data.data.edit,
buttonDelete: response.data.data.delete,
load: true load: true
}) })
} else { } else {
...@@ -215,7 +217,7 @@ class UserRole extends Component { ...@@ -215,7 +217,7 @@ class UserRole extends Component {
</div > </div >
</button> </button>
)} )}
{this.state.buttonEdit && ( {this.state.buttonDelete && (
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -361,35 +363,69 @@ class UserRole extends Component { ...@@ -361,35 +363,69 @@ class UserRole extends Component {
)} )}
{this.state.popupDel && ( {this.state.popupDel && (
<div className="test app-popup-show"> <div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8, padding: 50 }}> <div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
<div style={{ display: 'flex', justifyContent: 'center' }}> <div style={{ display: 'flex', justifyContent: 'center', paddingTop: 20 }}>
<img src={Images.failedCopy} /> <img src={Images.failed} />
</div> </div>
<div style={{ display: 'grid', justifyContent: 'center', marginTop: 20 }}> <div style={{ display: 'grid', justifyContent: 'center', marginTop: 20, paddingBottom: 20 }}>
<span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}> <span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold', fontFamily: 'Nunito Sans, sans-serif' }}>
Delete {this.state.rowData[2]} ? Delete {titleCase(this.state.rowData[2])} ?
</span> </span>
{/* <span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}> </div>
{`Please try again later.`} <div className="border-top grid grid-2x" style={{ height: 56, backgroundColor: '#f5f5f5', paddingLeft: 20, paddingRight: 20 }}>
</span> */} <div className="column-1" style={{ alignSelf: 'center' }}>
</div> <button
<div style={{ display: 'flex', justifyContent: 'center', marginTop: 24 }}> type="button"
<button onClick={()=> this.setState({popupDel: false})}
className={"btn-save"} >
onClick={()=> this.setState({popupDel: false})} <div style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
> <span style={{ color: '#354960', fontSize: 11 }}>Cancel</span>
<span style={{ color: 'white' }}>Cancel</span> </div>
</button> </button>
<button </div>
className={"btn-save"} <div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
style={{ marginLeft: 50}} <button
onClick={()=> this.deleteRole()} type="button"
> onClick={()=> this.deleteRole()}
<span style={{ color: 'white' }}>Delete</span> >
</button> <div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#fff', fontSize: 11 }}>Delete</span>
</div>
</button>
</div>
</div>
</div> </div>
</div>
</div> </div>
// <div className="test app-popup-show">
// <div className="popup-content background-white border-radius" style={{ borderRadius: 8, padding: 50 }}>
// <div style={{ display: 'flex', justifyContent: 'center' }}>
// <img src={Images.failed} />
// </div>
// <div style={{ display: 'grid', justifyContent: 'center', marginTop: 20 }}>
// <span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}>
// Delete {titleCase(this.state.rowData[2])} ?
// </span>
// {/* <span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}>
// {`Please try again later.`}
// </span> */}
// </div>
// <div style={{ display: 'flex', justifyContent: 'center', marginTop: 24 }}>
// <button
// className={"btn-save"}
// onClick={()=> this.setState({popupDel: false})}
// >
// <span style={{ color: 'white' }}>Cancel</span>
// </button>
// <button
// className={"btn-save"}
// style={{ marginLeft: 50}}
// onClick={()=> this.deleteRole()}
// >
// <span style={{ color: 'white' }}>Delete</span>
// </button>
// </div>
// </div>
// </div>
)} )}
</div> </div>
); );
......
...@@ -142,6 +142,7 @@ export default class AddRole extends Component { ...@@ -142,6 +142,7 @@ export default class AddRole extends Component {
setTimeout(() => { setTimeout(() => {
this.props.onClickClose() this.props.onClickClose()
this.props.refresh() this.props.refresh()
window.location.reload();
}, 750); }, 750);
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
......
...@@ -168,6 +168,7 @@ export default class EditRole extends Component { ...@@ -168,6 +168,7 @@ export default class EditRole extends Component {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
setTimeout(() => { setTimeout(() => {
this.props.onClickClose() this.props.onClickClose()
window.location.reload();
this.props.refresh() this.props.refresh()
}, 750); }, 750);
} else { } else {
...@@ -621,6 +622,9 @@ export default class EditRole extends Component { ...@@ -621,6 +622,9 @@ export default class EditRole extends Component {
<div className="column 3"> <div className="column 3">
<Typography style={{ fontSize: 12, color: 'white' }}>Edit</Typography> <Typography style={{ fontSize: 12, color: 'white' }}>Edit</Typography>
</div> </div>
<div className="column 4">
<Typography style={{ fontSize: 12, color: 'white' }}>Delete</Typography>
</div>
</div> </div>
</div> </div>
......
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