Commit 68ec52b1 authored by Deni Rinaldi's avatar Deni Rinaldi

uplad foto, hover button ++

parent 554bbb2d
...@@ -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>
...@@ -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,21 +332,26 @@ export default function MiniDrawer() { ...@@ -331,21 +332,26 @@ 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.status === "success") { if (response.data) {
let app = null if (response.data.status === "success") {
let set = null let app = null
response.data.data.map((item) => { let set = null
if (item.menu_name === "Application") { response.data.data.map((item) => {
app = parseChildren(item.sub_menu) if (item.menu_name === "Application") {
return app app = parseChildren(item.sub_menu)
} else { return app
set = parseChildren(item.sub_menu) } else {
return set set = parseChildren(item.sub_menu)
} return set
}) }
setApplication(app) })
setSetting(set) setApplication(app)
console.log(app); setSetting(set)
console.log(app);
} else {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}
} else { } else {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -356,9 +362,12 @@ export default function MiniDrawer() { ...@@ -356,9 +362,12 @@ export default function MiniDrawer() {
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.status == 'success') { if (response.data) {
setUserFullname(response.data.data.fullname == null ? 'Anonym' : response.data.data.fullname) if (response.data.status == 'success') {
setUserEmail(response.data.data.email == null ? 'Anonym@123.xyz' : response.data.data.email) setUserFullname(response.data.data.fullname === null ? 'Anonym' : response.data.data.fullname)
setUserEmail(response.data.data.email === null ? 'Anonym@123.xyz' : response.data.data.email)
setUserPhoto(response.data.data.photo === null ? "" : response.data.data.photo)
}
} }
}) })
} }
...@@ -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>
......
This diff is collapsed.
...@@ -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 => {
console.log(response) if (response.data) {
this.getAllParameter() if (response.data.status === "success") {
this.setState({ visibleParameter: true }) console.log(response)
alert(response.data.message)
this.getAllParameter()
this.setState({ visibleParameter: true })
}
}
}) })
} }
...@@ -648,49 +653,62 @@ export default class Parameter extends Component { ...@@ -648,49 +653,62 @@ 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' }}>
<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} />
<button </button>
style={{ </a>
backgroundColor: 'transparent', <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
cursor: 'pointer', <a data-tip={'Upload'} data-for="upload">
borderColor: 'transparent', <button
margin: 5 style={{
}} backgroundColor: 'transparent',
onClick={() => this.setState({ visibleUpload: true })} cursor: 'pointer',
> borderColor: 'transparent',
<img src={Images.upload} /> margin: 5
</button> }}
<button onClick={() => this.setState({ visibleUpload: true })}
style={{ >
backgroundColor: 'transparent', <img src={Images.upload} />
cursor: 'pointer', </button>
borderColor: 'transparent', </a>
margin: 5 <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
}} <a data-tip={'Download'} data-for="download">
onClick={() => this.downloadDataTable()} <button
> style={{
<img src={Images.download} /> backgroundColor: 'transparent',
</button> cursor: 'pointer',
<button borderColor: 'transparent',
style={{ margin: 5
backgroundColor: 'transparent', }}
cursor: 'pointer', onClick={() => this.downloadDataTable()}
borderColor: 'transparent' >
}} <img src={Images.download} />
onClick={() => this.setState({ visibleCreate: true })} </button>
> </a>
<img src={Images.add} /> <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</button> <a data-tip={'Tambah'} data-for="create">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
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 }}>
...@@ -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' })
......
This diff is collapsed.
This diff is collapsed.
...@@ -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,16 +30,44 @@ export default class CreateUnitBisnis extends Component { ...@@ -28,16 +30,44 @@ 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({ this.setState({
id: data.business_unit_id, startDate: date,
name: data.business_unit_name, endDate: date
startDate: data.start_date,
endDate: data.end_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({
id: data.business_unit_id,
name: data.business_unit_name,
startDate: data.start_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
let isDate = type !== '' ? true : false let isDate = type !== '' ? true : false
...@@ -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,15 +44,15 @@ class UserRole extends Component { ...@@ -42,15 +44,15 @@ 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)
// }) // })
} else { } else {
alert(response.data.message) alert(response.data.message)
} }
...@@ -65,14 +67,14 @@ class UserRole extends Component { ...@@ -65,14 +67,14 @@ 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)
} }
}) })
} }
_handleKeyDown(e) { _handleKeyDown(e) {
...@@ -87,9 +89,9 @@ class UserRole extends Component { ...@@ -87,9 +89,9 @@ 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,15 +109,15 @@ class UserRole extends Component { ...@@ -107,15 +109,15 @@ 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 >
</button> </button>
</div > </div >
); );
...@@ -172,39 +174,41 @@ class UserRole extends Component { ...@@ -172,39 +174,41 @@ 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) { this.searchRole()
this.searchRole() } else {
} else { this.getRole()
this.getRole() }
} });
}); }}
}} inputProps={{ 'aria-label': 'naked' }}
onKeyDown={(e) => this._handleKeyDown(e)} />
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 }}>
...@@ -218,14 +222,14 @@ class UserRole extends Component { ...@@ -218,14 +222,14 @@ class UserRole extends Component {
</div> </div>
</div> </div>
{this.state.add && ( {this.state.add && (
<AddRole <AddRole
onClickClose={this.closeAdd.bind(this)} onClickClose={this.closeAdd.bind(this)}
refresh={this.getRole.bind(this)} refresh={this.getRole.bind(this)}
data={this.state.indexData} data={this.state.indexData}
/> />
)} )}
{this.state.edit && ( {this.state.edit && (
<EditRole <EditRole
onClickClose={this.closeEdit.bind(this)} onClickClose={this.closeEdit.bind(this)}
refresh={this.getRole.bind(this)} refresh={this.getRole.bind(this)}
data={this.state.indexData} data={this.state.indexData}
......
This diff is collapsed.
This diff is collapsed.
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