Commit 1b1ff58e authored by Rifka Kurnia Irfiana's avatar Rifka Kurnia Irfiana

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into rifka

parents b62e1c5d bc0608d6
...@@ -15360,6 +15360,20 @@ ...@@ -15360,6 +15360,20 @@
"xlsx": "^0.14.1" "xlsx": "^0.14.1"
} }
}, },
"react-flip-move": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/react-flip-move/-/react-flip-move-3.0.4.tgz",
"integrity": "sha512-HyUVv9g3t/BS7Yz9HgrtYSWyRNdR2F81nkj+C5iRY675AwlqCLB5JU9mnZWg0cdVz7IM4iquoyZx70vzZv3Z8Q=="
},
"react-images-upload": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/react-images-upload/-/react-images-upload-1.2.8.tgz",
"integrity": "sha512-d5mhAE0BfkLTlG5MLvKVw+q76LL8r5easgWW0TTBvXD8n6HXeLMZLwCuPiOibY1a3NRMXI4AnM1r34dqLOBjng==",
"requires": {
"react": "^16.12.0",
"react-flip-move": "^3.0.4"
}
},
"react-is": { "react-is": {
"version": "16.13.1", "version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
"react-draggable-list": "^4.0.3", "react-draggable-list": "^4.0.3",
"react-dropzone": "^11.0.2", "react-dropzone": "^11.0.2",
"react-excel-renderer": "^1.1.0", "react-excel-renderer": "^1.1.0",
"react-images-upload": "^1.2.8",
"react-linechart": "^1.1.12", "react-linechart": "^1.1.12",
"react-nestable": "^1.3.0", "react-nestable": "^1.3.0",
"react-number-format": "^4.4.1", "react-number-format": "^4.4.1",
......
...@@ -89,6 +89,8 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -89,6 +89,8 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const checkUploadUnitBisnis = (body) => api.post('/business_unit/check_import', body) const checkUploadUnitBisnis = (body) => api.post('/business_unit/check_import', body)
const uploadUnitBisnis = (body) => api.post('/business_unit/import_business_unit', body) const uploadUnitBisnis = (body) => api.post('/business_unit/import_business_unit', body)
const getUnitBisnisActive = () => api.get('business_unit/get_all_business_unit_active') const getUnitBisnisActive = () => api.get('business_unit/get_all_business_unit_active')
const getDetailUnitBisnis = (id) => api.get(`business_unit/get_business_unit_by_id/${id}`)
// Perusahaan // Perusahaan
const getPerusahaan = () => api.get('company/get_all_company') const getPerusahaan = () => api.get('company/get_all_company')
...@@ -152,6 +154,10 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -152,6 +154,10 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
//Template //Template
const downloadTemplate = (fileName, fileType) => api.get(`attachment/download_file?fileName=${fileName}&&fileType=${fileType}`) const downloadTemplate = (fileName, fileType) => api.get(`attachment/download_file?fileName=${fileName}&&fileType=${fileType}`)
// UPLOAD FOTO
const uploadFoto = (body) => api.post('attachment/upload_foto', body)
// ------ // ------
// STEP 3 // STEP 3
// ------ // ------
...@@ -238,7 +244,9 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -238,7 +244,9 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
uploadPerusahaan, uploadPerusahaan,
searchPerusahaan, searchPerusahaan,
getUnitBisnisActive, getUnitBisnisActive,
getMenuByUser getMenuByUser,
getDetailUnitBisnis,
uploadFoto
} }
} }
......
...@@ -44,7 +44,8 @@ const Images = { ...@@ -44,7 +44,8 @@ const Images = {
logout: require('./setting.png'), logout: require('./setting.png'),
setting: require('./logout.png'), setting: require('./logout.png'),
failedCopy: require('./failed-copy.svg'), failedCopy: require('./failed-copy.svg'),
triputraLogo: require('./triputra-logo.png') triputraLogo: require('./triputra-logo.png'),
photo: require('./photo.svg')
} }
......
<svg xmlns="http://www.w3.org/2000/svg" width="93" height="30" viewBox="0 0 93 30">
<g fill="none" fill-rule="evenodd">
<rect width="93" height="30" fill="#019CE5" rx="4"/>
<g>
<path d="M0 0H24V24H0z" transform="translate(4 3)"/>
<g transform="translate(4 3) translate(5 6)">
<path fill="#FFF" d="M7.664 0c1.086 0 2 .743 2.259 1.749L11 1.75c1.657 0 3 1.343 3 3v4.5c0 1.657-1.343 3-3 3H3c-1.657 0-3-1.343-3-3v-4.5c0-1.657 1.343-3 3-3l1.074-.001C4.334.743 5.247 0 6.334 0h1.33z"/>
<circle cx="7" cy="7" r="3" fill="#019CE5"/>
</g>
</g>
<text fill="#FFF" font-family="Nunito-SemiBold, Nunito" font-size="11" font-weight="500">
<tspan x="32.43" y="19">Ganti Foto</tspan>
</text>
</g>
</svg>
...@@ -88,6 +88,16 @@ ...@@ -88,6 +88,16 @@
transition: 0.39; transition: 0.39;
background-color: #f8f8f8; } background-color: #f8f8f8; }
::-webkit-scrollbar {
width: 10px;
height: 10px;
background-color: rgba(0, 0, 0, 0); }
::-webkit-scrollbar-thumb {
background-color: rgba(0, 0, 0, 0.14);
-webkit-border-radius: 1ex; }
::-webkit-scrollbar-corner {
background-color: #fff; }
.test { .test {
position: fixed; position: fixed;
top: 0; top: 0;
...@@ -150,6 +150,7 @@ export default function MiniDrawer() { ...@@ -150,6 +150,7 @@ export default function MiniDrawer() {
const [selectedSubIndex, setSelectSub] = React.useState([]); const [selectedSubIndex, setSelectSub] = React.useState([]);
const [userFullname, setUserFullname] = React.useState("") const [userFullname, setUserFullname] = React.useState("")
const [userEmail, setUserEmail] = React.useState("") const [userEmail, setUserEmail] = React.useState("")
const [userPhoto, setUserPhoto] = React.useState("")
const [application, setApplication] = React.useState([]) const [application, setApplication] = React.useState([])
const [setting, setSetting] = React.useState([]) const [setting, setSetting] = React.useState([])
const [data, setData] = React.useState({ const [data, setData] = React.useState({
...@@ -316,7 +317,7 @@ export default function MiniDrawer() { ...@@ -316,7 +317,7 @@ export default function MiniDrawer() {
const parseChildren = (val) => { const parseChildren = (val) => {
let data = Object.assign([], val) let data = Object.assign([], val)
data = data.sort((a,b) => a.menu_id - b.menu_id).map((i) => { data = data.sort((a, b) => a.menu_id - b.menu_id).map((i) => {
return { return {
img: i.icon === '#' ? "" : i.icon, img: i.icon === '#' ? "" : i.icon,
label: i.menu_name, label: i.menu_name,
...@@ -331,6 +332,7 @@ export default function MiniDrawer() { ...@@ -331,6 +332,7 @@ export default function MiniDrawer() {
const getMenuHierarki = () => { const getMenuHierarki = () => {
api.create().getMenuByRole().then((response) => { api.create().getMenuByRole().then((response) => {
console.log(response) console.log(response)
if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
let app = null let app = null
let set = null let set = null
...@@ -350,15 +352,22 @@ export default function MiniDrawer() { ...@@ -350,15 +352,22 @@ export default function MiniDrawer() {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
} }
} else {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}
}) })
} }
const getUserData = () => { const getUserData = () => {
let userId = localStorage.getItem(Constant.USER) let userId = localStorage.getItem(Constant.USER)
api.create().getDetailUser(userId).then((response) => { api.create().getDetailUser(userId).then((response) => {
if (response.data) {
if (response.data.status == 'success') { if (response.data.status == 'success') {
setUserFullname(response.data.data.fullname == null ? 'Anonym' : response.data.data.fullname) setUserFullname(response.data.data.fullname === null ? 'Anonym' : response.data.data.fullname)
setUserEmail(response.data.data.email == null ? 'Anonym@123.xyz' : response.data.data.email) setUserEmail(response.data.data.email === null ? 'Anonym@123.xyz' : response.data.data.email)
setUserPhoto(response.data.data.photo === null ? "" : response.data.data.photo)
}
} }
}) })
} }
...@@ -474,6 +483,7 @@ export default function MiniDrawer() { ...@@ -474,6 +483,7 @@ export default function MiniDrawer() {
<div style={{ width: '100%', textAlign: '-webkit-center', marginTop: -45, display: 'flex', justifyContent: 'center' }}> <div style={{ width: '100%', textAlign: '-webkit-center', marginTop: -45, display: 'flex', justifyContent: 'center' }}>
<div className={"sub-color"} style={{ width: 90, height: 90, borderRadius: 50, display: 'flex', justifyContent: 'center' }}> <div className={"sub-color"} style={{ width: 90, height: 90, borderRadius: 50, display: 'flex', justifyContent: 'center' }}>
<div style={{ width: 72, height: 72, backgroundColor: '#838383', borderRadius: 50, alignSelf: 'center' }}> <div style={{ width: 72, height: 72, backgroundColor: '#838383', borderRadius: 50, alignSelf: 'center' }}>
<img src={userPhoto} style={{ width: 72, height: 72, borderRadius: 50 }} />
</div> </div>
</div> </div>
...@@ -488,7 +498,7 @@ export default function MiniDrawer() { ...@@ -488,7 +498,7 @@ export default function MiniDrawer() {
{application.map((item, index) => ( {application.map((item, index) => (
<div style={{ marginTop: index === 0 ? null : 5 }} > <div style={{ marginTop: index === 0 ? null : 5 }} >
{item.subItem.length !== 0 ? {item.subItem.length !== 0 ?
<div style={{ justifyContent: 'space-between', flexDirection: 'row', display: 'flex', paddingLeft: 5, paddingRight: 10 }} onClick={() => { handleCollapse(item) }}> <div style={{ justifyContent: 'space-between', flexDirection: 'row', display: 'flex', paddingLeft: 5, paddingRight: 10, cursor: 'pointer' }} onClick={() => { handleCollapse(item) }}>
<ListItem key={item.label}> <ListItem key={item.label}>
<ListItemIcon style={{ minWidth: open ? 40 : 56 }}><img src={item.img} /></ListItemIcon> <ListItemIcon style={{ minWidth: open ? 40 : 56 }}><img src={item.img} /></ListItemIcon>
<Typography style={{ fontFamily: 'nunito', color: '#525355', fontSize: 14 }}>{item.label}</Typography> <Typography style={{ fontFamily: 'nunito', color: '#525355', fontSize: 14 }}>{item.label}</Typography>
...@@ -536,7 +546,7 @@ export default function MiniDrawer() { ...@@ -536,7 +546,7 @@ export default function MiniDrawer() {
{setting.map((item, index) => ( {setting.map((item, index) => (
<div style={{ marginTop: index === 0 ? null : 5 }} > <div style={{ marginTop: index === 0 ? null : 5 }} >
{item.subItem.length !== 0 ? {item.subItem.length !== 0 ?
<div style={{ justifyContent: 'space-between', flexDirection: 'row', display: 'flex', paddingLeft: 5, paddingRight: 10 }} onClick={() => { handleCollapseSetting(item) }}> <div style={{ justifyContent: 'space-between', flexDirection: 'row', display: 'flex', paddingLeft: 5, paddingRight: 10, cursor: 'pointer' }} onClick={() => { handleCollapseSetting(item) }}>
<ListItem key={item.label}> <ListItem key={item.label}>
<ListItemIcon style={{ minWidth: open ? 40 : 56 }}><img src={item.img} /></ListItemIcon> <ListItemIcon style={{ minWidth: open ? 40 : 56 }}><img src={item.img} /></ListItemIcon>
<Typography style={{ fontFamily: 'nunito', color: '#525355', fontSize: 14 }}>{item.label}</Typography> <Typography style={{ fontFamily: 'nunito', color: '#525355', fontSize: 14 }}>{item.label}</Typography>
......
...@@ -42,7 +42,7 @@ class Login extends Component { ...@@ -42,7 +42,7 @@ class Login extends Component {
handleChange(e) { handleChange(e) {
let data = this.state let data = this.state
this.setState({...data, [e.target.name] : e.target.value}) this.setState({ ...data, [e.target.name]: e.target.value })
if (e.target.name == "email") { if (e.target.name == "email") {
this.setState({ errorEmail: false, msgEmail: '' }) this.setState({ errorEmail: false, msgEmail: '' })
} else if (e.target.name) { } else if (e.target.name) {
...@@ -69,6 +69,7 @@ class Login extends Component { ...@@ -69,6 +69,7 @@ class Login extends Component {
} }
login() { login() {
console.log('login');
let payload = { let payload = {
"email": this.state.email, "email": this.state.email,
"password": this.state.password "password": this.state.password
...@@ -101,9 +102,9 @@ class Login extends Component { ...@@ -101,9 +102,9 @@ class Login extends Component {
var email = localStorage.getItem(Constant.EMAIL) var email = localStorage.getItem(Constant.EMAIL)
var password = localStorage.getItem(Constant.PASSWORD) var password = localStorage.getItem(Constant.PASSWORD)
if (email == null || password == null) { if (email == null || password == null) {
this.setState({email: '', password: ''}) this.setState({ email: '', password: '' })
} else if(email != '' && password != ''){ } else if (email != '' && password != '') {
this.setState({email, password}) this.setState({ email, password })
} }
} }
...@@ -116,11 +117,17 @@ class Login extends Component { ...@@ -116,11 +117,17 @@ class Login extends Component {
<img src={Images.imageLogin} style={{ marginTop: 30 }} /> <img src={Images.imageLogin} style={{ marginTop: 30 }} />
</div> </div>
<div style={{ width: '50%', height: '100vh', backgroundColor: '#152d40', display: 'flex', justifyContent: 'center', alignItems: 'center', flexDirection: 'column' }}> <div style={{ width: '50%', height: '100vh', backgroundColor: '#152d40', display: 'flex', justifyContent: 'center', alignItems: 'center', flexDirection: 'column' }}>
<form onSubmit={(e) => {
e.preventDefault()
this.validateLogin()
}}
>
<div style={{ paddingTop: 56, paddingLeft: 54, paddingRight: 54, display: 'flex', flexDirection: 'column', width: 388, height: (this.state.msgEmail.length > 45 ? 466 : 441), borderRadius: 12, boxShadow: '0 2 4 0 rgba(0, 0, 0, 0.2)', backgroundColor: '#ffffff' }}> <div style={{ paddingTop: 56, paddingLeft: 54, paddingRight: 54, display: 'flex', flexDirection: 'column', width: 388, height: (this.state.msgEmail.length > 45 ? 466 : 441), borderRadius: 12, boxShadow: '0 2 4 0 rgba(0, 0, 0, 0.2)', backgroundColor: '#ffffff' }}>
<img src={Images.tia} /> <img src={Images.tia} />
<TextField <TextField
label={<Typography style={{fontSize: 12, fontFamily: 'Nunito Sans, sans-serif'}}>Email *</Typography>} label={<Typography style={{ fontSize: 12, fontFamily: 'Nunito Sans, sans-serif' }}>Email *</Typography>}
id="email" id="email"
type={"text"} type={"text"}
name={"email"} name={"email"}
...@@ -138,7 +145,7 @@ class Login extends Component { ...@@ -138,7 +145,7 @@ class Login extends Component {
/> />
<TextField <TextField
label={<Typography style={{fontSize: 12, fontFamily: 'Nunito Sans, sans-serif'}}>Kata Sandi *</Typography>} label={<Typography style={{ fontSize: 12, fontFamily: 'Nunito Sans, sans-serif' }}>Kata Sandi *</Typography>}
id="password" id="password"
type={this.state.showPass ? 'text' : 'password'} type={this.state.showPass ? 'text' : 'password'}
name={"password"} name={"password"}
...@@ -150,29 +157,42 @@ class Login extends Component { ...@@ -150,29 +157,42 @@ class Login extends Component {
error={this.state.errorPassword} error={this.state.errorPassword}
style={{ width: '100%', height: 51, marginTop: this.state.errorEmail ? (this.state.msgEmail.length > 45 ? 60 : 35) : 20 }} style={{ width: '100%', height: 51, marginTop: this.state.errorEmail ? (this.state.msgEmail.length > 45 ? 60 : 35) : 20 }}
helperText={this.state.msgPassword} helperText={this.state.msgPassword}
onSubmit={() => this.validateLogin()}
InputProps={{ InputProps={{
endAdornment: <InputAdornment position="end"> endAdornment: <InputAdornment position="end">
<IconButton <IconButton
aria-label="toggle password visibility" aria-label="toggle password visibility"
style={{color: '#4b4b4b', opacity: 0.5}} style={{ color: '#4b4b4b', opacity: 0.5 }}
onClick={() => this.setState({showPass: !this.state.showPass})} onClick={() => this.setState({ showPass: !this.state.showPass })}
edge="end" edge="end"
> >
{this.state.showPass ? <Visibility style={{fontSize: 18}} /> : <VisibilityOff style={{fontSize: 18}} />} {this.state.showPass ? <Visibility style={{ fontSize: 18 }} /> : <VisibilityOff style={{ fontSize: 18 }} />}
</IconButton> </IconButton>
</InputAdornment>, </InputAdornment>,
}} }}
/> />
<div style={{ flexDirection: 'row', width: '100%', marginTop: this.state.errorPassword ? 26 : 16 }}> <div style={{ flexDirection: 'row', width: '100%', marginTop: this.state.errorPassword ? 26 : 16 }}>
<CustomCheckbox name="checked-remember" checked={this.state.rememberMe} onChange={() => this.setState({rememberMe: !this.state.rememberMe})} /> <CustomCheckbox name="checked-remember" checked={this.state.rememberMe} onChange={() => this.setState({ rememberMe: !this.state.rememberMe })} />
<span style={{ color: 'rgba(0, 0, 0, 0.5)', fontSize: 12, fontFamily: 'Nunito Sans, sans-serif' }}>Remember Me</span> <span style={{ color: 'rgba(0, 0, 0, 0.5)', fontSize: 12, fontFamily: 'Nunito Sans, sans-serif' }}>Remember Me</span>
<Link to={{pathname: '/forgot-password'}} style={{textDecoration: 'none'}}><span style={{marginLeft: 30, color: '#51c6ea', cursor: 'pointer', fontSize: 12, fontFamily: 'Nunito Sans, sans-serif' }}>Lupa Kata Sandi?</span></Link> <Link to={{ pathname: '/forgot-password' }} style={{ textDecoration: 'none' }}><span style={{ marginLeft: 30, color: '#51c6ea', cursor: 'pointer', fontSize: 12, fontFamily: 'Nunito Sans, sans-serif' }}>Lupa Kata Sandi?</span></Link>
</div> </div>
<Button name="submit" variant="contained" disabled={this.state.email.trim() == '' && this.state.password.trim() == '' ? true : false} onClick={() => this.validateLogin()} style={{ marginTop: 23, width: '100%', height: 35, borderRadius: 4, color: this.state.email.trim() == '' && this.state.password.trim() == '' ? '#4b4b4b' : '#fff', backgroundColor: this.state.email.trim() == '' && this.state.password.trim() == '' ? '#d8d8d8' : '#51c6ea' }}> <button
<Typography style={{fontSize: 12, fontFamily: 'Nunito Sans, sans-serif'}}>Login</Typography> type="submit"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
}}
disabled={this.state.email.trim() == '' && this.state.password.trim() == '' ? true : false}
// onClick={() => this.validateLogin()}
>
<Button name="submit" variant="contained" disabled={this.state.email.trim() == '' && this.state.password.trim() == '' ? true : false} style={{ marginTop: 23, width: '100%', height: 35, borderRadius: 4, color: this.state.email.trim() == '' && this.state.password.trim() == '' ? '#4b4b4b' : '#fff', backgroundColor: this.state.email.trim() == '' && this.state.password.trim() == '' ? '#d8d8d8' : '#51c6ea' }}>
<Typography style={{ fontSize: 12, fontFamily: 'Nunito Sans, sans-serif' }}>Login</Typography>
</Button> </Button>
</button>
</div> </div>
</form>
</div> </div>
</div > </div >
); );
......
...@@ -495,9 +495,14 @@ export default class Parameter extends Component { ...@@ -495,9 +495,14 @@ export default class Parameter extends Component {
uploadParameter() { uploadParameter() {
api.create().uploadParameter(this.state.payload).then(response => { api.create().uploadParameter(this.state.payload).then(response => {
if (response.data) {
if (response.data.status === "success") {
console.log(response) console.log(response)
alert(response.data.message)
this.getAllParameter() this.getAllParameter()
this.setState({ visibleParameter: true }) this.setState({ visibleParameter: true })
}
}
}) })
} }
...@@ -648,6 +653,7 @@ export default class Parameter extends Component { ...@@ -648,6 +653,7 @@ export default class Parameter extends Component {
/> />
</div> </div>
<div style={{ width: '20%', justifyContent: 'space-around', display: 'flex' }}> <div style={{ width: '20%', justifyContent: 'space-around', display: 'flex' }}>
<a data-tip={'Download Template'} data-for="template">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -659,6 +665,9 @@ export default class Parameter extends Component { ...@@ -659,6 +665,9 @@ export default class Parameter extends Component {
> >
<img src={Images.template} /> <img src={Images.template} />
</button> </button>
</a>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
<a data-tip={'Upload'} data-for="upload">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -670,6 +679,9 @@ export default class Parameter extends Component { ...@@ -670,6 +679,9 @@ export default class Parameter extends Component {
> >
<img src={Images.upload} /> <img src={Images.upload} />
</button> </button>
</a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<a data-tip={'Download'} data-for="download">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -681,16 +693,22 @@ export default class Parameter extends Component { ...@@ -681,16 +693,22 @@ export default class Parameter extends Component {
> >
<img src={Images.download} /> <img src={Images.download} />
</button> </button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
<a data-tip={'Tambah'} data-for="create">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent' borderColor: 'transparent',
margin: 5
}} }}
onClick={() => this.setState({ visibleCreate: true })} onClick={() => this.setState({ visibleCreate: true })}
> >
<img src={Images.add} /> <img src={Images.add} />
</button> </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 }}>
...@@ -777,7 +795,7 @@ export default class Parameter extends Component { ...@@ -777,7 +795,7 @@ export default class Parameter extends Component {
className="btn btn-circle btn-white" className="btn btn-circle btn-white"
onClick={() => this.setState({ visibleUpload: false })} onClick={() => this.setState({ visibleUpload: false })}
> >
<img src={Images.close}/> <img src={Images.close} />
</button> </button>
</div> </div>
</div> </div>
...@@ -785,7 +803,7 @@ export default class Parameter extends Component { ...@@ -785,7 +803,7 @@ export default class Parameter extends Component {
type={this.state.uploadStatus} type={this.state.uploadStatus}
percentage={this.state.percentage} percentage={this.state.percentage}
result={this.state.result} result={this.state.result}
acceptedFiles={["pdf"]} acceptedFiles={["xlsx"]}
onHandle={(dt) => { onHandle={(dt) => {
this.fileHandler(dt) this.fileHandler(dt)
this.setState({ uploadStatus: 'idle', percentage: '0' }) this.setState({ uploadStatus: 'idle', percentage: '0' })
......
...@@ -49,7 +49,7 @@ export default class ReportItems extends Component { ...@@ -49,7 +49,7 @@ export default class ReportItems extends Component {
let isi = resp.rows.slice(3) let isi = resp.rows.slice(3)
let payload = [] let payload = []
isi.map((item, index) => { isi.map((item, index) => {
if(item.length > 0) { if (item.length > 0) {
payload.push({ payload.push({
id: index + 1, id: index + 1,
report: item[0], report: item[0],
...@@ -452,8 +452,8 @@ export default class ReportItems extends Component { ...@@ -452,8 +452,8 @@ export default class ReportItems extends Component {
console.log(response) console.log(response)
if (response.data.status == 'success') { if (response.data.status == 'success') {
let data = response.data.data let data = response.data.data
let listData = data.sort((a,b) => a.item_report_id-b.item_report_id).map((item, index) => { let listData = data.sort((a, b) => a.item_report_id - b.item_report_id).map((item, index) => {
return [index, item.item_report_id, item.report_name, item.company_name, item.order, item.description, item.parent, item.uom, item.weight, item.type_report_name, item.status ] return [index, item.item_report_id, item.report_name, item.company_name, item.order, item.description, item.parent, item.uom, item.weight, item.type_report_name, item.status]
}) })
this.setState({ dataTable: listData, listData: response.data.data }) this.setState({ dataTable: listData, listData: response.data.data })
} else { } else {
...@@ -486,7 +486,7 @@ export default class ReportItems extends Component { ...@@ -486,7 +486,7 @@ export default class ReportItems extends Component {
if (response.data.status == 'success') { if (response.data.status == 'success') {
let data = response.data.data let data = response.data.data
let listData = data.map((item, index) => { let listData = data.map((item, index) => {
return [index, item.item_report_id, item.report_name, item.company_name, item.order, item.description, item.parent, item.uom, item.weight, item.type_report_name, item.status ] return [index, item.item_report_id, item.report_name, item.company_name, item.order, item.description, item.parent, item.uom, item.weight, item.type_report_name, item.status]
}) })
this.setState({ dataTable: listData, listData: response.data.data }) this.setState({ dataTable: listData, listData: response.data.data })
} else { } else {
...@@ -549,9 +549,14 @@ export default class ReportItems extends Component { ...@@ -549,9 +549,14 @@ export default class ReportItems extends Component {
uploadReportItems() { uploadReportItems() {
api.create().uploadReportItems(this.state.payload).then(response => { api.create().uploadReportItems(this.state.payload).then(response => {
if (response.data) {
if (response.data.status === "success") {
console.log(response) console.log(response)
alert(response.data.message)
this.getData() this.getData()
this.setState({ itemReport: true }) this.setState({ itemReport: true })
}
}
}) })
} }
...@@ -726,6 +731,7 @@ export default class ReportItems extends Component { ...@@ -726,6 +731,7 @@ export default class ReportItems extends Component {
/> />
</div> </div>
<div style={{ width: '30%', justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> <div style={{ width: '30%', justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download Template'} data-for="template">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -737,6 +743,9 @@ export default class ReportItems extends Component { ...@@ -737,6 +743,9 @@ export default class ReportItems extends Component {
> >
<img src={Images.template} /> <img src={Images.template} />
</button> </button>
</a>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
<a data-tip={'Upload'} data-for="upload">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -748,6 +757,9 @@ export default class ReportItems extends Component { ...@@ -748,6 +757,9 @@ export default class ReportItems extends Component {
> >
<img src={Images.upload} onClick={() => this.setState({ visibleUpload: true })} /> <img src={Images.upload} onClick={() => this.setState({ visibleUpload: true })} />
</button> </button>
</a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<a data-tip={'Download'} data-for="download">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -759,6 +771,9 @@ export default class ReportItems extends Component { ...@@ -759,6 +771,9 @@ export default class ReportItems extends Component {
> >
<img src={Images.download} /> <img src={Images.download} />
</button> </button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
<a data-tip={'Visualisasi'} data-for="visualisasi">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -766,10 +781,13 @@ export default class ReportItems extends Component { ...@@ -766,10 +781,13 @@ export default class ReportItems extends Component {
borderColor: 'transparent', borderColor: 'transparent',
margin: 5 margin: 5
}} }}
onClick={() => null} onClick={() => this.setState({ visualisasi: true, itemReport: false })}
> >
<img src={Images.visualisasi} onClick={() => this.setState({ visualisasi: true, itemReport: false })} /> <img src={Images.visualisasi} />
</button> </button>
</a>
<ReactTooltip border={true} id="visualisasi" place="bottom" type="light" effect="solid" />
<a data-tip={'Tambah'} data-for="tambah">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -780,6 +798,9 @@ export default class ReportItems extends Component { ...@@ -780,6 +798,9 @@ export default class ReportItems extends Component {
> >
<img src={Images.add} onClick={() => this.setState({ add: true })} /> <img src={Images.add} onClick={() => this.setState({ add: true })} />
</button> </button>
</a>
<ReactTooltip border={true} id="tambah" place="bottom" type="light" effect="solid" />
</div> </div>
</div> </div>
<div style={{ padding: 25 }}> <div style={{ padding: 25 }}>
...@@ -797,11 +818,11 @@ export default class ReportItems extends Component { ...@@ -797,11 +818,11 @@ export default class ReportItems extends Component {
this.state.visualisasi == true ? this.state.visualisasi == true ?
<VisualReportItems <VisualReportItems
onClickClose={() => this.setState({ visualisasi: false, itemReport: true })} onClickClose={() => this.setState({ visualisasi: false, itemReport: true })}
height= {this.props.height} height={this.props.height}
/> />
: :
<div style={{ height: this.props.height }}> <div style={{ height: this.props.height }}>
<div style={{ height: 199, width: '100%' }} className={"main-color"}/> <div style={{ height: 199, width: '100%' }} className={"main-color"} />
<div> <div>
<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 }}>
...@@ -823,7 +844,7 @@ export default class ReportItems extends Component { ...@@ -823,7 +844,7 @@ export default class ReportItems extends Component {
<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 }}>Batal</span> <span style={{ color: '#354960', fontSize: 11 }}>Batal</span>
...@@ -860,7 +881,7 @@ export default class ReportItems extends Component { ...@@ -860,7 +881,7 @@ export default class ReportItems extends Component {
/> />
)} )}
{this.state.popupError && ( {this.state.popupError && (
<PopUpFailedSave onClickClose={()=> this.setState({ popupError: false })} /> <PopUpFailedSave onClickClose={() => this.setState({ popupError: false })} />
)} )}
{this.state.visibleUpload && ( {this.state.visibleUpload && (
<div className="test app-popup-show"> <div className="test app-popup-show">
...@@ -877,7 +898,7 @@ export default class ReportItems extends Component { ...@@ -877,7 +898,7 @@ export default class ReportItems extends Component {
className="btn btn-circle btn-white" className="btn btn-circle btn-white"
onClick={() => this.setState({ visibleUpload: false })} onClick={() => this.setState({ visibleUpload: false })}
> >
<img src={Images.close}/> <img src={Images.close} />
</button> </button>
</div> </div>
</div> </div>
...@@ -885,7 +906,7 @@ export default class ReportItems extends Component { ...@@ -885,7 +906,7 @@ export default class ReportItems extends Component {
type={this.state.uploadStatus} type={this.state.uploadStatus}
percentage={this.state.percentage} percentage={this.state.percentage}
result={this.state.result} result={this.state.result}
acceptedFiles={["pdf"]} acceptedFiles={["xlsx"]}
onHandle={(dt) => { onHandle={(dt) => {
this.fileHandler(dt) this.fileHandler(dt)
this.setState({ uploadStatus: 'idle', percentage: '0' }) this.setState({ uploadStatus: 'idle', percentage: '0' })
......
...@@ -183,27 +183,31 @@ export default class UnitBisnis extends Component { ...@@ -183,27 +183,31 @@ export default class UnitBisnis extends Component {
getData() { getData() {
api.create().getUnitBisnis().then((response) => { api.create().getUnitBisnis().then((response) => {
console.log(response) console.log(response)
if (response.data) {
if (response.data.status == 'success') { if (response.data.status == 'success') {
let data = response.data.data let data = response.data.data
let listData = data.sort((a,b) => a.business_unit_id - b.business_unit_id).map((item, index) => { let listData = data.sort((a, b) => a.business_unit_id - b.business_unit_id).map((item, index) => {
return [index, item.business_unit_id, item.business_unit_name, item.status] return [index, item.business_unit_id, item.business_unit_name, item.status]
}) })
this.setState({ dataTable: listData, listData: response.data.data }) this.setState({ dataTable: listData, listData: response.data.data })
} else { } else {
alert(response.data.message) alert(response.data.message)
} }
} else {
this.setState({ dataTable: [] })
}
}) })
} }
openPopUp(index, type) { openPopUp(rowData, type) {
if (type === 'edit') { if (type === 'edit') {
this.setState({ this.setState({
selectIndex: index, rowData: rowData,
visibleEdit: true visibleEdit: true
}) })
} else { } else {
this.setState({ this.setState({
data: this.state.listData[index], rowData: rowData,
visibleCreate: true visibleCreate: true
}) })
} }
...@@ -232,6 +236,7 @@ export default class UnitBisnis extends Component { ...@@ -232,6 +236,7 @@ export default class UnitBisnis extends Component {
this.setState({ visibleEdit: false }) this.setState({ visibleEdit: false })
api.create().updateUnitBisnis(payload).then(response => { api.create().updateUnitBisnis(payload).then(response => {
if (response.data.status == 'success') { if (response.data.status == 'success') {
alert(response.data.message)
this.getData() this.getData()
} else { } else {
alert(response.data.message) alert(response.data.message)
...@@ -283,8 +288,11 @@ export default class UnitBisnis extends Component { ...@@ -283,8 +288,11 @@ export default class UnitBisnis extends Component {
uploadUnitBisnis() { uploadUnitBisnis() {
api.create().uploadUnitBisnis(this.state.payload).then(response => { api.create().uploadUnitBisnis(this.state.payload).then(response => {
console.log(response) console.log(response)
if (response.data.status === "success") {
alert(response.data.message)
this.getData() this.getData()
this.setState({ visibleUnitBisnis: true }) this.setState({ visibleUnitBisnis: true })
}
}) })
} }
...@@ -301,8 +309,8 @@ export default class UnitBisnis extends Component { ...@@ -301,8 +309,8 @@ export default class UnitBisnis extends Component {
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
}} }}
// onClick={() => console.log(tableMeta.rowData[1])} // onClick={() => console.log(tableMeta)}
onClick={() => this.openPopUp(tableMeta.rowIndex, 'edit')} onClick={() => this.openPopUp(tableMeta.rowData, 'edit')}
> >
<img src={Images.editCopy} /> <img src={Images.editCopy} />
</button> </button>
...@@ -368,9 +376,9 @@ export default class UnitBisnis extends Component { ...@@ -368,9 +376,9 @@ export default class UnitBisnis extends Component {
onChange={(e) => this.handleInputChange(e.target.value)} onChange={(e) => this.handleInputChange(e.target.value)}
inputProps={{ 'aria-label': 'naked' }} inputProps={{ 'aria-label': 'naked' }}
/> />
{/* <input type="text" value={this.state.search} onChange={(e)=> this.setState({ search: e.target.value})} style={{ width: '100%'}} /> */}
</div> </div>
<div style={{ width: '30%', justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> <div style={{ width: '30%', justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download Template'} data-for="template">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -382,6 +390,9 @@ export default class UnitBisnis extends Component { ...@@ -382,6 +390,9 @@ export default class UnitBisnis extends Component {
> >
<img src={Images.template} /> <img src={Images.template} />
</button> </button>
</a>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
<a data-tip={'Upload'} data-for="upload">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -393,6 +404,9 @@ export default class UnitBisnis extends Component { ...@@ -393,6 +404,9 @@ export default class UnitBisnis extends Component {
> >
<img src={Images.upload} /> <img src={Images.upload} />
</button> </button>
</a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<a data-tip={'Download'} data-for="download">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -404,6 +418,9 @@ export default class UnitBisnis extends Component { ...@@ -404,6 +418,9 @@ export default class UnitBisnis extends Component {
> >
<img src={Images.download} /> <img src={Images.download} />
</button> </button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
<a data-tip={'Tambah'} data-for="create">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -415,6 +432,8 @@ export default class UnitBisnis extends Component { ...@@ -415,6 +432,8 @@ export default class UnitBisnis extends Component {
> >
<img src={Images.add} /> <img src={Images.add} />
</button> </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 }}>
...@@ -481,12 +500,12 @@ export default class UnitBisnis extends Component { ...@@ -481,12 +500,12 @@ export default class UnitBisnis extends Component {
<CreateUnitBisnis <CreateUnitBisnis
type={"edit"} type={"edit"}
onClickClose={() => this.setState({ visibleEdit: false })} onClickClose={() => this.setState({ visibleEdit: false })}
data={this.state.listData[this.state.selectIndex]} data={this.state.rowData}
updateUnitBisnis={this.updateUnitBisnis.bind(this)} updateUnitBisnis={this.updateUnitBisnis.bind(this)}
/> />
)} )}
{this.state.popupError && ( {this.state.popupError && (
<PopUpFailedSave onClickClose={()=> this.setState({ popupError: false })} /> <PopUpFailedSave onClickClose={() => this.setState({ popupError: false })} />
)} )}
{this.state.visibleUpload && ( {this.state.visibleUpload && (
...@@ -504,7 +523,7 @@ export default class UnitBisnis extends Component { ...@@ -504,7 +523,7 @@ export default class UnitBisnis extends Component {
className="btn btn-circle btn-white" className="btn btn-circle btn-white"
onClick={() => this.setState({ visibleUpload: false })} onClick={() => this.setState({ visibleUpload: false })}
> >
<img src={Images.close}/> <img src={Images.close} />
</button> </button>
</div> </div>
</div> </div>
...@@ -512,7 +531,7 @@ export default class UnitBisnis extends Component { ...@@ -512,7 +531,7 @@ export default class UnitBisnis extends Component {
type={this.state.uploadStatus} type={this.state.uploadStatus}
percentage={this.state.percentage} percentage={this.state.percentage}
result={this.state.result} result={this.state.result}
acceptedFiles={["pdf"]} acceptedFiles={["xlsx"]}
onHandle={(dt) => { onHandle={(dt) => {
this.fileHandler(dt) this.fileHandler(dt)
this.setState({ uploadStatus: 'idle', percentage: '0' }) this.setState({ uploadStatus: 'idle', percentage: '0' })
......
...@@ -116,27 +116,14 @@ export default class EditReportItems extends Component { ...@@ -116,27 +116,14 @@ export default class EditReportItems extends Component {
// alert('coba ya') // alert('coba ya')
if (R.isNil(this.state.reportType)) return alert("Jenis Laporan is Required."); if (R.isNil(this.state.reportType)) return alert("Jenis Laporan is Required.");
if (R.isNil(this.state.company)) return alert("Perusahaan is Required."); if (R.isNil(this.state.company)) return alert("Perusahaan is Required.");
else if (R.isNil(this.state.order)) { else if (R.isEmpty(this.state.tempData.order)) {
this.setState({errorOrder: true, msgErrorOrder: 'Order Harus Diisi'}) this.setState({errorOrder: true, msgErrorOrder: 'Order Harus Diisi'})
} } else if (R.isEmpty(this.state.tempData.description)) {
else if (R.isEmpty(this.state.description)) {
this.setState({errorDesc: true, msgErrorDesc: 'Deskripsi Harus Diisi'}) this.setState({errorDesc: true, msgErrorDesc: 'Deskripsi Harus Diisi'})
} } else if (R.isNil(this.state.InputType)) return alert("Tipe Data harus dipilih.")
else if (R.isNil(this.state.parent)) return alert("Parent ID is Required.") else if (this.state.InputType.type_report_name === 'Formula' || this.state.InputType.type_report_name === 'Validation' && R.isEmpty(this.state.tempData.formula)) {
else if (R.isNil(this.state.InputType)) return alert("Tipe Data is Required.");
else if (this.state.disabledFormula === false && R.isEmpty(this.state.formula)) {
this.setState({errorFormula: true, msgErrorFormula: 'Formula Harus Diisi'}) this.setState({errorFormula: true, msgErrorFormula: 'Formula Harus Diisi'})
} }
else if (this.state.disabledValue === false && R.isEmpty(this.state.realVal)) {
this.setState({errorRV: true, msgErrorRV: 'Nilai Seharusnya Harus Diisi'})
}
else if (this.state.disabledCondt === false && R.isEmpty(this.state.condition)) return alert("Kondisi Jika Salah is Required.")
else if (R.isNil(this.state.startDate)) {
this.setState({errorStartDate: true, msgErrorSD: 'Start Date tidak boleh kosong'})
}
else if (R.isNil(this.state.endDate)) {
this.setState({errorEndDate: true, msgErrorED: 'End Date tidak boleh kosong'})
}
else { else {
this.updateReportItems() this.updateReportItems()
} }
...@@ -368,6 +355,8 @@ export default class EditReportItems extends Component { ...@@ -368,6 +355,8 @@ export default class EditReportItems extends Component {
id="description" id="description"
label="Deskripsi" label="Deskripsi"
name="description" name="description"
error={this.state.errorDesc}
helperText={this.state.msgErrorDesc}
onChange={(e) => this.handleChange(e, '')} onChange={(e) => this.handleChange(e, '')}
value={this.state.tempData === null ? '' : this.state.tempData.description} value={this.state.tempData === null ? '' : this.state.tempData.description}
inputProps={{ inputProps={{
...@@ -545,14 +534,15 @@ export default class EditReportItems extends Component { ...@@ -545,14 +534,15 @@ export default class EditReportItems extends Component {
id="order" id="order"
label="Order" label="Order"
name="order" name="order"
onChange={(e) => this.handleChange(e, '')}
value={this.state.tempData === null ? '' : this.state.tempData.order} value={this.state.tempData === null ? '' : this.state.tempData.order}
error={this.state.errorOrder}
helperText={this.state.msgErrorOrder}
onChange={(e) => this.handleChange(e, '')}
inputProps={{ inputProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600, fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif'
paddingLeft: 10
} }
}} }}
InputLabelProps={{ InputLabelProps={{
...@@ -560,8 +550,7 @@ export default class EditReportItems extends Component { ...@@ -560,8 +550,7 @@ export default class EditReportItems extends Component {
fontSize: 11, fontSize: 11,
fontWeight: 600, fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085', color: '#7e8085'
paddingLeft: 10
} }
}} }}
> >
...@@ -623,6 +612,8 @@ export default class EditReportItems extends Component { ...@@ -623,6 +612,8 @@ export default class EditReportItems extends Component {
label="Formula" label="Formula"
disabled={this.state.InputType == null? true : (this.state.InputType.type_report_name === 'Formula' || this.state.InputType.type_report_name === 'Validation'? false : true)} disabled={this.state.InputType == null? true : (this.state.InputType.type_report_name === 'Formula' || this.state.InputType.type_report_name === 'Validation'? false : true)}
name="formula" name="formula"
error={this.state.errorFormula}
helperText={this.state.msgErrorFormula}
onChange={(e) => this.handleChange(e, '')} onChange={(e) => this.handleChange(e, '')}
value={this.state.tempData === null ? '' : this.state.tempData.formula} value={this.state.tempData === null ? '' : this.state.tempData.formula}
inputProps={{ inputProps={{
...@@ -701,7 +692,7 @@ export default class EditReportItems extends Component { ...@@ -701,7 +692,7 @@ export default class EditReportItems extends Component {
</button> </button>
</div> </div>
<div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}> <div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
<button onClick={() => this.updateReportItems()}> <button onClick={() => this.validasi()}>
<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 }}>Simpan</span> <span style={{ color: '#fff', fontSize: 11 }}>Simpan</span>
</div> </div>
......
...@@ -4,12 +4,14 @@ import * as R from 'ramda' ...@@ -4,12 +4,14 @@ import * as R from 'ramda'
import { DateTimePicker, KeyboardDatePicker, DatePicker } from "@material-ui/pickers"; import { DateTimePicker, KeyboardDatePicker, DatePicker } from "@material-ui/pickers";
import format from "date-fns/format"; import format from "date-fns/format";
import Images from '../../../assets/Images'; import Images from '../../../assets/Images';
import api from '../../../api';
export default class CreateUnitBisnis extends Component { export default class CreateUnitBisnis extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
id: '', id: '',
status:"",
name: '', name: '',
startDate: '', startDate: '',
endDate: '', endDate: '',
...@@ -28,15 +30,43 @@ export default class CreateUnitBisnis extends Component { ...@@ -28,15 +30,43 @@ export default class CreateUnitBisnis extends Component {
componentDidMount() { componentDidMount() {
if (this.props.type === 'edit') { if (this.props.type === 'edit') {
let data = this.props.data this.getDetailUnitBisnis()
console.log(this.props.data);
// this.setState({
// id: data[0],
// name: data[1],
// startDate: data[2],
// endDate: data[3]
// })
} else {
let date = format(new Date, 'yyyy-MM-dd')
console.log(date);
this.setState({
startDate: date,
endDate: date
})
}
}
getDetailUnitBisnis() {
api.create().getDetailUnitBisnis(this.props.data[1]).then(response => {
console.log(response)
if (response.data) {
if (response.data.status === "success") {
let data = response.data.data
this.setState({ this.setState({
id: data.business_unit_id, id: data.business_unit_id,
name: data.business_unit_name, name: data.business_unit_name,
startDate: data.start_date, startDate: data.start_date,
endDate: data.end_date endDate: data.end_date,
status: data.status,
created: data.created,
updated: data.updated === null ? "" : data.updated
}) })
} }
} }
})
}
handleChange(e, type) { handleChange(e, type) {
let data = this.state let data = this.state
...@@ -90,9 +120,9 @@ export default class CreateUnitBisnis extends Component { ...@@ -90,9 +120,9 @@ export default class CreateUnitBisnis extends Component {
if (R.isEmpty(this.state.name)) { if (R.isEmpty(this.state.name)) {
this.setState({ errorName: true, msgErrorName: 'Unit Bisnis tidak boleh kosong' }) this.setState({ errorName: true, msgErrorName: 'Unit Bisnis tidak boleh kosong' })
} else if (R.isEmpty(this.state.startDate)) { } else if (R.isEmpty(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorStartDate: 'Tanggal Mulai tidak boleh kosong' }) this.setState({ errorStartDate: true, msgErrorStartDate: 'Berlaku Mulai tidak boleh kosong' })
} else if (R.isEmpty(this.state.endDate)) { } else if (R.isEmpty(this.state.endDate)) {
this.setState({ errorEndDate: true, msgErrorEndDate: 'Tanggal Berakhir tidak boleh kosong' }) this.setState({ errorEndDate: true, msgErrorEndDate: 'Berkahir Hingga tidak boleh kosong' })
} else { } else {
let payload = { let payload = {
"business_unit_name": this.state.name, "business_unit_name": this.state.name,
...@@ -119,7 +149,7 @@ export default class CreateUnitBisnis extends Component { ...@@ -119,7 +149,7 @@ export default class CreateUnitBisnis extends Component {
className="btn btn-circle btn-white" className="btn btn-circle btn-white"
onClick={() => this.props.onClickClose()} onClick={() => this.props.onClickClose()}
> >
<img src={Images.close}/> <img src={Images.close} />
</button> </button>
</div> </div>
</div> </div>
...@@ -130,8 +160,8 @@ export default class CreateUnitBisnis extends Component { ...@@ -130,8 +160,8 @@ export default class CreateUnitBisnis extends Component {
<div style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}> <div style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
<TextField <TextField
style={{ width: '100%' }} style={{ width: '100%' }}
value={this.props.data.business_unit_id} value={this.state.id}
id="status" id="id"
label="ID" label="ID"
disabled disabled
inputProps={{ inputProps={{
...@@ -178,7 +208,7 @@ export default class CreateUnitBisnis extends Component { ...@@ -178,7 +208,7 @@ export default class CreateUnitBisnis extends Component {
<div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
<TextField <TextField
style={{ width: '100%' }} style={{ width: '100%' }}
value={this.props.data.status} value={this.state.status}
id="status" id="status"
label="Status" label="Status"
disabled disabled
...@@ -199,11 +229,11 @@ export default class CreateUnitBisnis extends Component { ...@@ -199,11 +229,11 @@ export default class CreateUnitBisnis extends Component {
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<Typography style={{ fontSize: 11, width: '20%' }}>Dibuat</Typography> <Typography style={{ fontSize: 11, width: '20%' }}>Dibuat</Typography>
<Typography style={{ fontSize: 11 }}>: {this.props.data.created}</Typography> <Typography style={{ fontSize: 11 }}>: {this.state.created}</Typography>
</div> </div>
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<Typography style={{ fontSize: 11, width: '20%' }}>Diubah</Typography> <Typography style={{ fontSize: 11, width: '20%' }}>Diubah</Typography>
<Typography style={{ fontSize: 11 }}>: {this.props.data.updated == - null ? "" : this.props.data.updated}</Typography> <Typography style={{ fontSize: 11 }}>: {this.state.updated}</Typography>
</div> </div>
</div> </div>
</div> </div>
...@@ -307,7 +337,7 @@ export default class CreateUnitBisnis extends Component { ...@@ -307,7 +337,7 @@ export default class CreateUnitBisnis extends Component {
className="btn btn-circle btn-white" className="btn btn-circle btn-white"
onClick={() => this.props.onClickClose()} onClick={() => this.props.onClickClose()}
> >
<img src={Images.close}/> <img src={Images.close} />
</button> </button>
</div> </div>
</div> </div>
...@@ -385,8 +415,8 @@ export default class CreateUnitBisnis extends Component { ...@@ -385,8 +415,8 @@ export default class CreateUnitBisnis extends Component {
</div> </div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Typography style={{ fontSize: 11 }}>Dibuat : Admin - 21 Jul 2020, 18:45</Typography> <Typography style={{ fontSize: 11 }}>Dibuat : </Typography>
<Typography style={{ fontSize: 11 }}>Diubah : Admin - 21 Jul 2020, 18:45</Typography> <Typography style={{ fontSize: 11 }}>Diubah : </Typography>
</div> </div>
</div> </div>
......
This diff is collapsed.
...@@ -263,7 +263,7 @@ export default class AddUser extends Component { ...@@ -263,7 +263,7 @@ export default class AddUser extends Component {
return ( return (
<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' }}>Ubah Data</span> <span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Ubah Data</span>
......
...@@ -299,7 +299,7 @@ export default class EditUser extends Component { ...@@ -299,7 +299,7 @@ export default class EditUser extends Component {
return ( return (
<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' }}>Ubah Data</span> <span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Ubah Data</span>
......
...@@ -9,6 +9,8 @@ import api from "../../api"; ...@@ -9,6 +9,8 @@ import api from "../../api";
import { titleCase } from "../../library/Utils"; import { titleCase } from "../../library/Utils";
import InputAdornment from '@material-ui/core/InputAdornment'; import InputAdornment from '@material-ui/core/InputAdornment';
import TextField from '@material-ui/core/TextField'; import TextField from '@material-ui/core/TextField';
import { InputBase } from "@material-ui/core";
import ReactTooltip from "react-tooltip";
var ct = require("../../library/CustomTable"); var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable()); const getMuiTheme = () => createMuiTheme(ct.customTable());
const options = ct.customOptions(); const options = ct.customOptions();
...@@ -30,11 +32,11 @@ class UserRole extends Component { ...@@ -30,11 +32,11 @@ class UserRole extends Component {
} }
closeEdit() { closeEdit() {
this.setState({edit: false}) this.setState({ edit: false })
} }
closeAdd() { closeAdd() {
this.setState({add: false}) this.setState({ add: false })
} }
getRole() { getRole() {
...@@ -42,11 +44,11 @@ class UserRole extends Component { ...@@ -42,11 +44,11 @@ class UserRole extends Component {
// console.log(response) // console.log(response)
if (response.data.status === 'success') { if (response.data.status === 'success') {
let data = response.data.data let data = response.data.data
let listData = data.sort((a,b) => a.role_id - b.role_id).map((item,index) => { let listData = data.sort((a, b) => a.role_id - b.role_id).map((item, index) => {
return [index, item.role_id, item.role_name, item.access, item.status] return [index, item.role_id, item.role_name, item.access, item.status]
}) })
// console.log(listData) // console.log(listData)
this.setState({listRole: listData}) this.setState({ listRole: listData })
// this.setState({listRole: response.data.data}, () => { // this.setState({listRole: response.data.data}, () => {
// console.log(this.state.listRole) // console.log(this.state.listRole)
// }) // })
...@@ -65,10 +67,10 @@ class UserRole extends Component { ...@@ -65,10 +67,10 @@ class UserRole extends Component {
api.create().searchRole(payload).then((response) => { api.create().searchRole(payload).then((response) => {
if (response.data.status === 'success') { if (response.data.status === 'success') {
let data = response.data.data let data = response.data.data
let listData = data.sort((a,b) => a.role_id - b.role_id).map((item,index) => { let listData = data.sort((a, b) => a.role_id - b.role_id).map((item, index) => {
return [index, item.role_id, item.role_name, item.access, item.status] return [index, item.role_id, item.role_name, item.access, item.status]
}) })
this.setState({listRole: listData}) this.setState({ listRole: listData })
} else { } else {
alert(response.data.message) alert(response.data.message)
} }
...@@ -87,7 +89,7 @@ class UserRole extends Component { ...@@ -87,7 +89,7 @@ class UserRole extends Component {
handleChange(e) { handleChange(e) {
let data = this.state let data = this.state
window.requestIdleCallback((e) => this.setState({...data, [e.target.name]: e.target.value}, () => { window.requestIdleCallback((e) => this.setState({ ...data, [e.target.name]: e.target.value }, () => {
alert('asdk') alert('asdk')
})) }))
...@@ -107,11 +109,11 @@ class UserRole extends Component { ...@@ -107,11 +109,11 @@ class UserRole extends Component {
borderColor: 'transparent', borderColor: 'transparent',
}} }}
// onClick={() => console.log(tableMeta.rowData[1])} // onClick={() => console.log(tableMeta.rowData[1])}
onClick={() => this.setState({edit: true, indexData: tableMeta.rowData[1]})} onClick={() => this.setState({ edit: true, indexData: tableMeta.rowData[1] })}
> >
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{ tableMeta.rowData[4] === "Aktif" ? {tableMeta.rowData[4] === "Aktif" ?
<img src={Images.editCopy}/> : <img src={Images.editCopy} /> :
null null
} }
</div > </div >
...@@ -172,14 +174,13 @@ class UserRole extends Component { ...@@ -172,14 +174,13 @@ class UserRole extends Component {
<div className={"main-color"} style={{ height: 199, width: '100%' }} /> <div className={"main-color"} style={{ height: 199, width: '100%' }} />
<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={{ fontFamily: 'nunito', color: 'white', width: '20%', alignSelf: 'center', fontSize: 18}}>Master Data - Role & Otorisasi</label> <label style={{ color: 'white', fontSize: 16, alignSelf: 'center', width: '20%', }}>Master Data - Role & Otorisasi</label>
<div style={{width: '60%', justifyContent: 'center', display: 'flex', borderWidth: 2, alignItems: 'center' }}> <div style={{ color: 'white', width: '50%', height: 37, display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center', borderRadius: 6, paddingLeft: 5, paddingRight: 5, alignSelf: 'center' }}>
<div style={{width: '50%', backgroundColor:'white', padding: 10, borderRadius: 7.5}}> <img src={Images.searchBlack} style={{ marginRight: 10 }} />
<TextField <InputBase
id="input-with-icon-textfield" style={{ width: '100%' }}
name="search" placeholder="Search"
value={this.state.search} value={this.state.search}
placeholder={'Search'}
onChange={(e) => { onChange={(e) => {
this.setState({ search: e.target.value }, () => { this.setState({ search: e.target.value }, () => {
if (this.state.search.length > 0) { if (this.state.search.length > 0) {
...@@ -189,22 +190,25 @@ class UserRole extends Component { ...@@ -189,22 +190,25 @@ class UserRole extends Component {
} }
}); });
}} }}
onKeyDown={(e) => this._handleKeyDown(e)} inputProps={{ 'aria-label': 'naked' }}
style={{width: '100%', borderBottomWidth: 0, borderBottomColor: 'red'}}
InputProps={{
style: { fontFamily: 'nunito', borderBottomColor: 'white'},
startAdornment: (
<InputAdornment position="start">
<SearchIcon />
</InputAdornment>
),
}}
/> />
</div> </div>
</div>
{/* <label style={{ color: 'white', width: '60%', justifyContent: 'center', display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center' }}>Search</label> */} {/* <label style={{ color: 'white', width: '60%', justifyContent: 'center', display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center' }}>Search</label> */}
<div style={{ width: '20%', justifyContent: 'flex-end', display: 'flex' }}> <div style={{ width: '20%', justifyContent: 'flex-end', display: 'flex' }}>
<img src={Images.add} onClick={() => this.setState({add: true})}/> <a data-tip={'Tambah'} data-for="create">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.setState({ add: 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 }}>
......
This diff is collapsed.
...@@ -28,12 +28,12 @@ class Upload extends Component { ...@@ -28,12 +28,12 @@ class Upload extends Component {
console.log('old percentage', prevs.percentage) console.log('old percentage', prevs.percentage)
console.log('new percentage', this.state.percentage) console.log('new percentage', this.state.percentage)
if (this.state.percentage !== prevs.percentage) { if (this.state.percentage !== prevs.percentage) {
this.setState({percentage: prevs.percentage}) this.setState({ percentage: prevs.percentage })
} }
} }
if (prevs.result === 'success' || prevs.result === 'error') { if (prevs.result === 'success' || prevs.result === 'error') {
if (this.state.uploadProgress === true) { if (this.state.uploadProgress === true) {
this.setState({uploadProgress: false, percentage: '100', iconButtonUpload: 'fa fa-1x fa-check'}) this.setState({ uploadProgress: false, percentage: '100', iconButtonUpload: 'fa fa-1x fa-check' })
} }
} }
} }
...@@ -43,13 +43,13 @@ class Upload extends Component { ...@@ -43,13 +43,13 @@ class Upload extends Component {
let length = acceptedFiles[0].name.split(".").length let length = acceptedFiles[0].name.split(".").length
let fileType = acceptedFiles[0].name.split(".")[length - 1] let fileType = acceptedFiles[0].name.split(".")[length - 1]
formData.append('file', acceptedFiles[0]) formData.append('file', acceptedFiles[0])
if (acceptedFiles) console.log(acceptedFiles);
{ if (acceptedFiles) {
this.setState({ this.setState({
file: acceptedFiles[0], file: acceptedFiles[0],
typeFile: fileType, typeFile: fileType,
nameFile: acceptedFiles[0].name, nameFile: acceptedFiles[0].name,
sizeFile: (acceptedFiles[0].size/1000).toFixed(0), sizeFile: (acceptedFiles[0].size / 1000).toFixed(0),
previewVisible: true, previewVisible: true,
inputVisible: false, inputVisible: false,
uploadProgress: false, uploadProgress: false,
...@@ -57,8 +57,7 @@ class Upload extends Component { ...@@ -57,8 +57,7 @@ class Upload extends Component {
}) })
this.props.onHandle(acceptedFiles[0]) this.props.onHandle(acceptedFiles[0])
} }
else else {
{
this.setState({ this.setState({
previewVisible: false, previewVisible: false,
inputVisible: true, inputVisible: true,
...@@ -79,37 +78,44 @@ class Upload extends Component { ...@@ -79,37 +78,44 @@ class Upload extends Component {
} }
onUpload = () => { onUpload = () => {
this.props.onUpload()
// var strProps = this.props.acceptedFiles
// var strState = this.state.typeFile
// if (strProps.includes(strState)) {
// this.setState({uploadProgress: true, percentage: '0'})
// this.props.onUpload() // this.props.onUpload()
// } else { var strProps = this.props.acceptedFiles
// alert('Unsupported File Type') var strState = this.state.typeFile
// } // console.log(strProps);
// console.log(strState);
if (strProps.includes(strState)) {
if (this.state.sizeFile < 1000000) {
this.props.onUpload()
} else {
alert('File Tidak Boleh Lebih Dari 1MB')
}
} else {
alert('File Tidak Mendukung')
}
} }
render() { render() {
return( return (
<div> <div>
<Dropzone ref={dropzoneRef} onDrop={this.onDrop}> <Dropzone ref={dropzoneRef} onDrop={this.onDrop}>
{({getRootProps, getInputProps}) => ( {({ getRootProps, getInputProps }) => (
<div> <div>
<div className="upload-file"> <div className="upload-file">
{/* label */} {/* label */}
{ this.state.inputVisible {this.state.inputVisible
? <div {...getRootProps()} className="padding-10px" style={{cursor: 'pointer'}}> ? <div {...getRootProps()} className="padding-10px" style={{ cursor: 'pointer' }}>
<input {...getInputProps()} /> <input {...getInputProps()} />
<div className="u-p-title"> <div className="u-p-title">
Drag 'n' drop some files here, or click to select files Drag 'n' drop some files here, or click to select files
</div> </div>
</div> </div>
: null } : null}
{/* file */} {/* file */}
{ this.state.previewVisible {this.state.previewVisible
? ?
<div className="u-p-file u-p-preview"> <div className="u-p-file u-p-preview">
<div className="display-flex-normal"> <div className="display-flex-normal">
...@@ -123,10 +129,10 @@ class Upload extends Component { ...@@ -123,10 +129,10 @@ class Upload extends Component {
</div> </div>
<div className="width width-full margin-left-10px"> <div className="width width-full margin-left-10px">
<div className="txt-site txt-12 txt-white txt-bold"> <div className="txt-site txt-12 txt-white txt-bold">
{ this.state.nameFile } {this.state.nameFile}
</div> </div>
<div className="txt-site txt-11 txt-white txt-thin"> <div className="txt-site txt-11 txt-white txt-thin">
{ this.state.sizeFile } KB {this.state.sizeFile} KB
</div> </div>
</div> </div>
{/* this.state.uploadProgress === true {/* this.state.uploadProgress === true
...@@ -138,7 +144,7 @@ class Upload extends Component { ...@@ -138,7 +144,7 @@ class Upload extends Component {
{this.props.type === 'upload' ? {this.props.type === 'upload' ?
<div className="width width-155px padding-10px txt-site txt-11 txt-white txt-thin"> <div className="width width-155px padding-10px txt-site txt-11 txt-white txt-thin">
Uploading {this.state.percentage}% Uploading {this.state.percentage}%
</div> : null } </div> : null}
{this.props.disableButtonUpload !== true ? ( {this.props.disableButtonUpload !== true ? (
<div className="width width-35px"> <div className="width width-35px">
...@@ -148,7 +154,7 @@ class Upload extends Component { ...@@ -148,7 +154,7 @@ class Upload extends Component {
onClick={this.state.uploadProgress === true ? null : this.onUpload}> onClick={this.state.uploadProgress === true ? null : this.onUpload}>
{/*<i className={this.state.iconButtonUpload} />*/} {/*<i className={this.state.iconButtonUpload} />*/}
{this.state.uploadProgress === true {this.state.uploadProgress === true
? <i className={ 'fa fa-1x fa-spinner fa-spin'} /> : ? <i className={'fa fa-1x fa-spinner fa-spin'} /> :
<img src={Images.upload} />} <img src={Images.upload} />}
</button> </button>
</div> </div>
...@@ -157,7 +163,7 @@ class Upload extends Component { ...@@ -157,7 +163,7 @@ class Upload extends Component {
{this.props.type === 'upload' ? {this.props.type === 'upload' ?
<div className="margin-top-15px"> <div className="margin-top-15px">
<LinearProgress variant="determinate" value={this.state.percentage} /> <LinearProgress variant="determinate" value={this.state.percentage} />
</div> : null } </div> : null}
{/* this.state.uploadProgress === true {/* this.state.uploadProgress === true
? ( ? (
<div className="margin-15px"> <div className="margin-15px">
...@@ -165,7 +171,7 @@ class Upload extends Component { ...@@ -165,7 +171,7 @@ class Upload extends Component {
</div> </div>
) : null */} ) : null */}
</div> </div>
: null } : null}
{/* image */} {/* image */}
{/* <div className="u-p-image u-p-preview"> {/* <div className="u-p-image u-p-preview">
......
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