Commit feb268d8 authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'deni-dev(pc)' into 'master'

malam2

See merge request !175
parents 81a836e1 97e361fe
...@@ -588,7 +588,7 @@ export default function MiniDrawer() { ...@@ -588,7 +588,7 @@ export default function MiniDrawer() {
))} ))}
</List> </List>
{open && {open &&
<div style={{ marginLeft: 20, marginTop: 5 }}> <div style={{ marginLeft: 20, marginTop: 5, paddingBottom: 20 }}>
<button <button
style={{ style={{
outline: 'none', outline: 'none',
......
...@@ -31,13 +31,37 @@ export default class Parameter extends Component { ...@@ -31,13 +31,37 @@ export default class Parameter extends Component {
dataTable: [], dataTable: [],
alert: false, alert: false,
tipeAlert: '', tipeAlert: '',
messageAlert: '' messageAlert: '',
create: false,
edit: false,
load: false
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
componentDidMount() { componentDidMount() {
this.getAllParameter() this.getAllParameter()
this.getPermission()
}
getPermission() {
let payload = {
menu: "parameters"
}
api.create().getPermission(payload).then(response => {
console.log(response)
if (response.data) {
if (response.data.status === "success") {
this.setState({
create: response.data.data.create,
edit: response.data.data.edit,
load: true
})
} else {
this.setState({ load: true })
}
}
})
} }
getAllParameter() { getAllParameter() {
...@@ -545,22 +569,24 @@ export default class Parameter extends Component { ...@@ -545,22 +569,24 @@ export default class Parameter extends Component {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<button {this.state.edit && (
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent' cursor: 'pointer',
}} borderColor: 'transparent'
onClick={() => this.openPopUp(tableMeta.rowData, 'edit')} }}
// onClick={()=> console.log(tableMeta)} onClick={() => this.openPopUp(tableMeta.rowData, 'edit')}
> // onClick={()=> console.log(tableMeta)}
<img src={Images.editCopy} /> >
</button> <img src={Images.editCopy} />
</button>
)}
</div > </div >
); );
} }
} }
}, { }, {
name: "ID", name: "ID",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
...@@ -571,7 +597,7 @@ export default class Parameter extends Component { ...@@ -571,7 +597,7 @@ export default class Parameter extends Component {
); );
} }
} }
},{ }, {
name: "Group", name: "Group",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
...@@ -689,77 +715,86 @@ export default class Parameter extends Component { ...@@ -689,77 +715,86 @@ export default class Parameter extends Component {
</Snackbar> </Snackbar>
{this.state.visibleParameter === true ? {this.state.visibleParameter === true ?
<div> <div>
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -118 }}> {this.state.load && (
<label style={{ color: 'white', fontSize: 16, alignSelf: 'center', width: '20%', }}>Parameter</label> <div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -118 }}>
<div style={{ color: 'white', width: '50%', height: 37, display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center', borderRadius: 6, paddingLeft: 5, paddingRight: 5, alignSelf: 'center' }}> <label style={{ color: 'white', fontSize: 16, alignSelf: 'center', width: '20%', }}>Parameter</label>
<img src={Images.searchBlack} style={{ marginRight: 10 }} /> <div style={{ color: 'white', width: '50%', height: 37, display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center', borderRadius: 6, paddingLeft: 5, paddingRight: 5, alignSelf: 'center' }}>
<InputBase <img src={Images.searchBlack} style={{ marginRight: 10 }} />
style={{ width: '100%' }} <InputBase
placeholder="Search" style={{ width: '100%' }}
value={this.state.search} placeholder="Search"
onChange={(e) => this.handleInputChange(e.target.value)} value={this.state.search}
inputProps={{ 'aria-label': 'naked' }} onChange={(e) => this.handleInputChange(e.target.value)}
/> inputProps={{ 'aria-label': 'naked' }}
</div> />
<div style={{ width: '30%', justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> </div>
<a data-tip={'Download Template'} data-for="template"> <div style={{ width: '30%', justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<button <a data-tip={'Download Template'} data-for="template">
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
margin: 5 borderColor: 'transparent',
}} margin: 5
onClick={() => this.downloadFile()} }}
> onClick={() => this.downloadFile()}
<img src={Images.template} /> >
</button> <img src={Images.template} />
</a> </button>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" /> </a>
<a data-tip={'Upload'} data-for="upload"> <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
<button {this.state.create && (
style={{ <a data-tip={'Upload'} data-for="upload">
backgroundColor: 'transparent', <button
cursor: 'pointer', style={{
borderColor: 'transparent', backgroundColor: 'transparent',
margin: 5 cursor: 'pointer',
}} borderColor: 'transparent',
onClick={() => this.setState({ visibleUpload: true })} margin: 5
> }}
<img src={Images.upload} /> onClick={() => this.setState({ visibleUpload: true })}
</button> >
</a> <img src={Images.upload} />
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" /> </button>
<a data-tip={'Download'} data-for="download"> </a>
<button )}
style={{ <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
backgroundColor: 'transparent', <a data-tip={'Download'} data-for="download">
cursor: 'pointer', <button
borderColor: 'transparent', style={{
margin: 5 backgroundColor: 'transparent',
}} cursor: 'pointer',
onClick={() => this.downloadDataTable()} borderColor: 'transparent',
> margin: 5
<img src={Images.download} /> }}
</button> onClick={() => this.downloadDataTable()}
</a> >
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" /> <img src={Images.download} />
<a data-tip={'Add New'} data-for="create"> </button>
<button </a>
style={{ <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
backgroundColor: 'transparent', {this.state.create && (
cursor: 'pointer', <a data-tip={'Add New'} data-for="create">
borderColor: 'transparent', <button
margin: 5 style={{
}} backgroundColor: 'transparent',
onClick={() => this.setState({ visibleCreate: true })} cursor: 'pointer',
> borderColor: 'transparent',
<img src={Images.add} /> margin: 5,
</button> marginRight: 20
</a> }}
<ReactTooltip border={true} id="create" place="bottom" type="light" effect="solid" /> onClick={() => this.setState({ visibleCreate: true })}
>
<img src={Images.add} />
</button>
</a>
)}
<ReactTooltip multiline={false} border={true} id="create" place="bottom" type="light" effect="solid" />
</div>
</div> </div>
</div>
)}
<div style={{ padding: 25 }}> <div style={{ padding: 25 }}>
<MuiThemeProvider theme={getMuiTheme()}> <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
......
...@@ -40,8 +40,9 @@ export default class ReportItems extends Component { ...@@ -40,8 +40,9 @@ export default class ReportItems extends Component {
alert: false, alert: false,
tipeAlert: '', tipeAlert: '',
messageAlert: '', messageAlert: '',
create: false, buttonCreate: false,
edit: false buttonEdit: false,
load: false
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -454,7 +455,7 @@ export default class ReportItems extends Component { ...@@ -454,7 +455,7 @@ export default class ReportItems extends Component {
componentDidMount() { componentDidMount() {
this.getData() this.getData()
// this.getPermission() this.getPermission()
} }
getPermission() { getPermission() {
...@@ -466,9 +467,12 @@ export default class ReportItems extends Component { ...@@ -466,9 +467,12 @@ export default class ReportItems extends Component {
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ this.setState({
create: response.data.data.create, buttonCreate: response.data.data.create,
edit: response.data.data.edit buttonEdit: response.data.data.edit,
load: true
}) })
} else {
this.setState({ load: true })
} }
} }
}) })
...@@ -619,7 +623,7 @@ export default class ReportItems extends Component { ...@@ -619,7 +623,7 @@ export default class ReportItems extends Component {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{this.state.edit && ( {this.state.buttonEdit && (
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -777,95 +781,97 @@ export default class ReportItems extends Component { ...@@ -777,95 +781,97 @@ export default class ReportItems extends Component {
</Snackbar> </Snackbar>
{this.state.itemReport === true ? {this.state.itemReport === true ?
<div> <div>
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -118 }}> {this.state.load && (
<label style={{ color: 'white', fontSize: 16, alignSelf: 'center', width: '20%', }}>Master Data - Report Items</label> <div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -118 }}>
<div style={{ color: 'white', width: '50%', height: 37, display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center', borderRadius: 6, paddingLeft: 5, paddingRight: 5, alignSelf: 'center' }}> <label style={{ color: 'white', fontSize: 16, alignSelf: 'center', width: '20%', }}>Master Data - Report Items</label>
<img src={Images.searchBlack} style={{ marginRight: 10 }} /> <div style={{ color: 'white', width: '50%', height: 37, display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center', borderRadius: 6, paddingLeft: 5, paddingRight: 5, alignSelf: 'center' }}>
<InputBase <img src={Images.searchBlack} style={{ marginRight: 10 }} />
style={{ width: '100%' }} <InputBase
placeholder="Search" style={{ width: '100%' }}
value={this.state.search} placeholder="Search"
onChange={(e) => this.handleInputChange(e.target.value)} value={this.state.search}
inputProps={{ 'aria-label': 'naked' }} onChange={(e) => this.handleInputChange(e.target.value)}
/> inputProps={{ 'aria-label': 'naked' }}
</div> />
<div style={{ width: '30%', justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> </div>
<a data-tip={'Download Template'} data-for="template"> <div style={{ width: '30%', justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<button <a data-tip={'Download Template'} data-for="template">
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
margin: 5 borderColor: 'transparent',
}} margin: 5
onClick={() => this.downloadFile()} }}
> onClick={() => this.downloadFile()}
<img src={Images.template} /> >
</button> <img src={Images.template} />
</a> </button>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" /> </a>
{this.state.create && ( <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
<a data-tip={'Upload'} data-for="upload"> {this.state.buttonCreate && (
<button <a data-tip={'Upload'} data-for="upload">
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
margin: 5 borderColor: 'transparent',
}} margin: 5
onClick={() => null} }}
> onClick={() => null}
<img src={Images.upload} onClick={() => this.setState({ visibleUpload: true })} /> >
</button> <img src={Images.upload} onClick={() => this.setState({ visibleUpload: true })} />
</a> </button>
)} </a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" /> )}
<a data-tip={'Download'} data-for="download"> <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<button <a data-tip={'Download'} data-for="download">
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
margin: 5 borderColor: 'transparent',
}} margin: 5
onClick={() => this.downloadDataTable()} }}
> onClick={() => this.downloadDataTable()}
<img src={Images.download} /> >
</button> <img src={Images.download} />
</a> </button>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" /> </a>
<a data-tip={'Visualization'} data-for="visualisasi"> <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
<button <a data-tip={'Visualization'} data-for="visualisasi">
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
margin: 5 borderColor: 'transparent',
}} margin: 5
onClick={() => this.setState({ visualisasi: true, itemReport: false })} }}
> onClick={() => this.setState({ visualisasi: true, itemReport: false })}
<img src={Images.visualisasi} /> >
</button> <img src={Images.visualisasi} />
</a> </button>
<ReactTooltip border={true} id="visualisasi" place="bottom" type="light" effect="solid" /> </a>
{this.state.create && ( <ReactTooltip border={true} id="visualisasi" place="bottom" type="light" effect="solid" />
<a data-tip={'Add New'} data-for="tambah"> {this.state.buttonCreate && (
<button <a data-tip={'Add New'} data-for="tambah">
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
margin: 5 borderColor: 'transparent',
}} margin: 5,
> marginRight: 20
<img src={Images.add} onClick={() => this.setState({ add: true })} /> }}
</button> >
</a> <img src={Images.add} onClick={() => this.setState({ add: true })} />
)} </button>
<ReactTooltip border={true} id="tambah" place="bottom" type="light" effect="solid" /> </a>
)}
<ReactTooltip border={true} id="tambah" place="bottom" type="light" effect="solid" />
</div>
</div> </div>
</div> )}
<div style={{ padding: 25 }}> <div style={{ padding: 25 }}>
<MuiThemeProvider theme={getMuiTheme()}> <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
...@@ -880,47 +886,49 @@ export default class ReportItems extends Component { ...@@ -880,47 +886,49 @@ export default class ReportItems extends Component {
: :
this.state.visualisasi == true ? this.state.visualisasi == true ?
<VisualReportItems <VisualReportItems
buttonCreate={this.state.buttonCreate}
buttonEdit={this.state.buttonEdit}
onClickClose={() => this.setState({ visualisasi: false, itemReport: true })} onClickClose={() => this.setState({ visualisasi: false, itemReport: true })}
height={this.props.height} height={this.props.height}
/> />
: :
<div> <div>
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -150 }}> <div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -150 }}>
<label style={{ color: 'white', fontSize: 16, alignSelf: 'center' }}>Preview Data</label> <label style={{ color: 'white', fontSize: 16, alignSelf: 'center' }}>Preview Data</label>
</div> </div>
<div style={{ padding: 25 }}> <div style={{ padding: 25 }}>
{this.state.dataLoaded && ( {this.state.dataLoaded && (
<MuiThemeProvider theme={getMuiTheme()}> <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
theme={getMuiTheme()} theme={getMuiTheme()}
data={this.state.rows} data={this.state.rows}
columns={this.state.cols} columns={this.state.cols}
options={options} options={options}
/> />
</MuiThemeProvider> </MuiThemeProvider>
)} )}
</div> </div>
<div style={{ display: 'flex', width: '100%', placeContent: 'flex-end', padding: 20 }}> <div style={{ display: 'flex', width: '100%', placeContent: 'flex-end', padding: 20 }}>
<button <button
type="button" type="button"
onClick={() => this.setState({ itemReport: true })} onClick={() => this.setState({ itemReport: true })}
style={{ marginRight: 20 }} style={{ marginRight: 20 }}
> >
<div style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}> <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: '#354960', fontSize: 11 }}>Cancel</span>
</div> </div>
</button> </button>
<button <button
type="button" type="button"
onClick={() => this.state.buttonError ? this.setState({ popupError: true }) : this.uploadReportItems()} onClick={() => this.state.buttonError ? this.setState({ popupError: true }) : this.uploadReportItems()}
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' }}>
<span style={{ color: '#fff', fontSize: 11 }}>Save</span> <span style={{ color: '#fff', fontSize: 11 }}>Save</span>
</div> </div>
</button> </button>
</div>
</div> </div>
</div>
} }
{this.state.add && ( {this.state.add && (
<CreateReportItems <CreateReportItems
......
...@@ -41,7 +41,8 @@ export default class UnitBisnis extends Component { ...@@ -41,7 +41,8 @@ export default class UnitBisnis extends Component {
tipeAlert: '', tipeAlert: '',
messageAlert: '', messageAlert: '',
create: false, create: false,
edit: false edit: false,
load: false
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -202,7 +203,12 @@ export default class UnitBisnis extends Component { ...@@ -202,7 +203,12 @@ export default class UnitBisnis extends Component {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ this.setState({
create: response.data.data.create, create: response.data.data.create,
edit: response.data.data.edit edit: response.data.data.edit,
load: true
})
} else {
this.setState({
load: true
}) })
} }
} }
...@@ -425,35 +431,21 @@ export default class UnitBisnis extends Component { ...@@ -425,35 +431,21 @@ export default class UnitBisnis extends Component {
</Snackbar> </Snackbar>
{this.state.visibleUnitBisnis === true ? {this.state.visibleUnitBisnis === true ?
<div> <div>
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -118 }}> {this.state.load && (
<label style={{ color: 'white', fontSize: 16, alignSelf: 'center', width: '20%', }}>Master Data - Business Unit</label> <div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -118 }}>
<div style={{ color: 'white', width: '50%', height: 37, display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center', borderRadius: 6, paddingLeft: 5, paddingRight: 5, alignSelf: 'center' }}> <label style={{ color: 'white', fontSize: 16, alignSelf: 'center', width: '20%', }}>Master Data - Business Unit</label>
<img src={Images.searchBlack} style={{ marginRight: 10 }} /> <div style={{ color: 'white', width: '50%', height: 37, display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center', borderRadius: 6, paddingLeft: 5, paddingRight: 5, alignSelf: 'center' }}>
<InputBase <img src={Images.searchBlack} style={{ marginRight: 10 }} />
style={{ width: '100%' }} <InputBase
placeholder="Search" style={{ width: '100%' }}
value={this.state.search} placeholder="Search"
onChange={(e) => this.handleInputChange(e.target.value)} value={this.state.search}
inputProps={{ 'aria-label': 'naked' }} onChange={(e) => this.handleInputChange(e.target.value)}
/> inputProps={{ 'aria-label': 'naked' }}
</div> />
<div style={{ width: '30%', justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> </div>
<a data-tip={'Download Template'} data-for="template"> <div style={{ width: '30%', justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<button <a data-tip={'Download Template'} data-for="template">
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.downloadFile()}
>
<img src={Images.template} />
</button>
</a>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
{this.state.create && (
<a data-tip={'Upload'} data-for="upload">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -461,29 +453,29 @@ export default class UnitBisnis extends Component { ...@@ -461,29 +453,29 @@ export default class UnitBisnis extends Component {
borderColor: 'transparent', borderColor: 'transparent',
margin: 5 margin: 5
}} }}
onClick={() => this.setState({ visibleUpload: true })} onClick={() => this.downloadFile()}
> >
<img src={Images.upload} /> <img src={Images.template} />
</button> </button>
</a> </a>
)} <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" /> {this.state.create && (
<a data-tip={'Download'} data-for="download"> <a data-tip={'Upload'} data-for="upload">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
margin: 5 margin: 5
}} }}
onClick={() => this.downloadDataTable()} onClick={() => this.setState({ visibleUpload: true })}
> >
<img src={Images.download} /> <img src={Images.upload} />
</button> </button>
</a> </a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" /> )}
{this.state.create && ( <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<a data-tip={'Add New'} data-for="create"> <a data-tip={'Download'} data-for="download">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -491,15 +483,32 @@ export default class UnitBisnis extends Component { ...@@ -491,15 +483,32 @@ export default class UnitBisnis extends Component {
borderColor: 'transparent', borderColor: 'transparent',
margin: 5 margin: 5
}} }}
onClick={() => this.setState({ visibleCreate: true })} onClick={() => this.downloadDataTable()}
> >
<img src={Images.add} /> <img src={Images.download} />
</button> </button>
</a> </a>
)} <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
<ReactTooltip border={true} id="create" place="bottom" type="light" effect="solid" /> {this.state.create && (
<a data-tip={'Add New'} data-for="create">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5,
marginRight: 20
}}
onClick={() => this.setState({ visibleCreate: true })}
>
<img src={Images.add} />
</button>
</a>
)}
<ReactTooltip border={true} id="create" place="bottom" type="light" effect="solid" />
</div>
</div> </div>
</div> )}
<div style={{ padding: 25 }}> <div style={{ padding: 25 }}>
<MuiThemeProvider theme={getMuiTheme()}> <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
......
...@@ -113,11 +113,11 @@ export default class VisualReportItems extends Component { ...@@ -113,11 +113,11 @@ export default class VisualReportItems extends Component {
options: reportData, options: reportData,
getOptionLabel: (option) => titleCase(option.report_name), getOptionLabel: (option) => titleCase(option.report_name),
}; };
this.setState({ listReport: defaultProps, report: reportData[0] }) this.setState({ listReport: defaultProps, report: reportData[0] })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
} }
...@@ -147,8 +147,8 @@ export default class VisualReportItems extends Component { ...@@ -147,8 +147,8 @@ export default class VisualReportItems extends Component {
this.getItemHierarki() this.getItemHierarki()
}) })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
} }
...@@ -170,8 +170,8 @@ export default class VisualReportItems extends Component { ...@@ -170,8 +170,8 @@ export default class VisualReportItems extends Component {
if (response.data.status == 'success') { if (response.data.status == 'success') {
this.setState({ items: response.data.data }) this.setState({ items: response.data.data })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
} }
...@@ -218,23 +218,23 @@ export default class VisualReportItems extends Component { ...@@ -218,23 +218,23 @@ export default class VisualReportItems extends Component {
api.create().saveVisualisasiReport(payload).then((response) => { api.create().saveVisualisasiReport(payload).then((response) => {
console.log(response); console.log(response);
// if (response.data.status == 'ucces') { // if (response.data.status == 'ucces') {
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status === "success") { if (response.data.status === "success") {
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()
}, 1000); }, 1000);
}) })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
} }
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
// } else { // } else {
// alert(response.data.message) // alert(response.data.message)
// } // }
...@@ -263,14 +263,14 @@ export default class VisualReportItems extends Component { ...@@ -263,14 +263,14 @@ export default class VisualReportItems extends Component {
</Alert> </Alert>
</Snackbar> </Snackbar>
<div style={{ height: this.props.height }}> <div style={{ height: this.props.height }}>
<div style={{ width: '100%' }} className={"main-color"} /> <div style={{ width: '100%' }} className={"main-color"} />
<div> <div>
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -118 }}> <div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -118 }}>
<label style={{ color: 'white', width: '20%', fontSize: 16, paddingTop: 8 }}>Data Visualization</label> <label style={{ color: 'white', width: '20%', fontSize: 16, paddingTop: 8 }}>Data Visualization</label>
</div> </div>
<div style={{ padding: 25, width: '100%' }}> <div style={{ padding: 25, width: '100%' }}>
<div style={{ width: '100%', padding: 25, backgroundColor: 'white', borderRadius: 6, border: 'solid 1px #c4c4c4' }}> <div style={{ width: '100%', padding: 25, backgroundColor: 'white', borderRadius: 6, border: 'solid 1px #c4c4c4' }}>
<label style={{ color: '#4b4b4b', fontSize: '16px', fontWeight: 'bold' }}>Report Item Hierarchy</label> <label style={{ color: '#4b4b4b', fontSize: '16px', fontWeight: 'bold' }}>Reports Item Hierarchy</label>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete <Autocomplete
{...this.state.listReport} {...this.state.listReport}
...@@ -278,12 +278,12 @@ export default class VisualReportItems extends Component { ...@@ -278,12 +278,12 @@ export default class VisualReportItems extends Component {
onChange={(event, newInputValue) => this.setState({ report: newInputValue }, () => this.getItemHierarki())} onChange={(event, newInputValue) => this.setState({ report: newInputValue }, () => this.getItemHierarki())}
debug debug
disableClearable disableClearable
renderInput={(params) => renderInput={(params) =>
<TextField {...params} <TextField {...params}
label="Report Type" label="Report Type"
margin="normal" margin="normal"
style={{ marginTop: 7 }} style={{ marginTop: 7 }}
InputProps={{ ...params.InputProps, style: { width: "15%" , fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }} InputProps={{ ...params.InputProps, style: { width: "15%", fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
/>} />}
value={this.state.report} value={this.state.report}
/> />
...@@ -295,13 +295,13 @@ export default class VisualReportItems extends Component { ...@@ -295,13 +295,13 @@ export default class VisualReportItems extends Component {
onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => this.getItemHierarki())} onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => this.getItemHierarki())}
debug debug
disableClearable disableClearable
renderInput={(params) => renderInput={(params) =>
<TextField {...params} <TextField {...params}
label="Company" label="Company"
margin="normal" margin="normal"
style={{ marginTop: 7 }} style={{ marginTop: 7 }}
InputProps={{ ...params.InputProps, style: { width: "15%" , fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }} InputProps={{ ...params.InputProps, style: { width: "15%", fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
/>} />}
value={this.state.company} value={this.state.company}
/> />
</div> </div>
...@@ -320,16 +320,18 @@ export default class VisualReportItems extends Component { ...@@ -320,16 +320,18 @@ export default class VisualReportItems extends Component {
<div onClick={() => this.props.onClickClose()} style={{ width: 102, height: 30, marginLeft: 25, backgroundColor: 'dodgerblue', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center', cursor: "pointer" }}> <div onClick={() => this.props.onClickClose()} style={{ width: 102, height: 30, marginLeft: 25, backgroundColor: 'dodgerblue', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center', cursor: "pointer" }}>
<span style={{ color: '#fff', fontSize: 11 }}>Back</span> <span style={{ color: '#fff', fontSize: 11 }}>Back</span>
</div> </div>
<div className="row" style={{ float: 'right', marginRight: 25 }}> {this.props.buttonEdit && (
<div onClick={() => this.props.onClickClose()} style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center', cursor: "pointer" }}> <div className="row" style={{ float: 'right', marginRight: 25 }}>
<span style={{ color: '#354960', fontSize: 11 }}>Cancel</span> <div onClick={() => this.props.onClickClose()} style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center', cursor: "pointer" }}>
</div> <span style={{ color: '#354960', fontSize: 11 }}>Cancel</span>
<button onClick={() => this.handleSave()}>
<div style={{ width: 102, height: 30, marginLeft: 25, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center', cursor: "pointer" }}>
<span style={{ color: '#fff', fontSize: 11 }}>Save</span>
</div> </div>
</button> <button onClick={() => this.handleSave()}>
</div> <div style={{ width: 102, height: 30, marginLeft: 25, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center', cursor: "pointer" }}>
<span style={{ color: '#fff', fontSize: 11 }}>Save</span>
</div>
</button>
</div>
)}
</div> </div>
</div> </div>
</div> </div>
......
...@@ -12,10 +12,10 @@ export default class PopUpFailedSave extends Component { ...@@ -12,10 +12,10 @@ export default class PopUpFailedSave extends Component {
</div> </div>
<div style={{ display: 'grid', justifyContent: 'center', marginTop: 20 }}> <div style={{ display: 'grid', justifyContent: 'center', marginTop: 20 }}>
<span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}> <span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}>
{`Maaf, penyimpanan data gagal.`} {`Sorry, form save failed.`}
</span> </span>
<span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}> <span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}>
{`Mohon ulangi beberapa saat lagi.`} {`Please try again later.`}
</span> </span>
</div> </div>
<div style={{ display: 'grid', justifyContent: 'center', marginTop: 24 }}> <div style={{ display: 'grid', justifyContent: 'center', marginTop: 24 }}>
......
...@@ -70,7 +70,7 @@ class Upload extends Component { ...@@ -70,7 +70,7 @@ class Upload extends Component {
uploadProgress: false, uploadProgress: false,
percentage: '0' percentage: '0'
}) })
this.setState({ alertMessage: "Unsupported Media Type", alert: true }) this.setState({ alertMessage: "Unsupported File", alert: true })
// alert("Unsupported Media Type") // alert("Unsupported Media Type")
} }
} }
...@@ -95,11 +95,11 @@ class Upload extends Component { ...@@ -95,11 +95,11 @@ class Upload extends Component {
if (this.state.sizeFile < 1000) { if (this.state.sizeFile < 1000) {
this.props.onUpload() this.props.onUpload()
} else { } else {
this.setState({ alertMessage: 'File Tidak Boleh Lebih Dari 1MB', alert: true }) this.setState({ alertMessage: 'File cannot be more than 1MB', alert: true })
// alert('File Tidak Boleh Lebih Dari 1MB') // alert('File Tidak Boleh Lebih Dari 1MB')
} }
} else { } else {
this.setState({ alertMessage: 'File Tidak Mendukung', alert: true }) this.setState({ alertMessage: 'Unsupported File', alert: true })
// alert('File Tidak Mendukung') // alert('File Tidak Mendukung')
} }
} }
......
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