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 @@
"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": {
"version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
......
......@@ -32,6 +32,7 @@
"react-draggable-list": "^4.0.3",
"react-dropzone": "^11.0.2",
"react-excel-renderer": "^1.1.0",
"react-images-upload": "^1.2.8",
"react-linechart": "^1.1.12",
"react-nestable": "^1.3.0",
"react-number-format": "^4.4.1",
......
......@@ -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 uploadUnitBisnis = (body) => api.post('/business_unit/import_business_unit', body)
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
const getPerusahaan = () => api.get('company/get_all_company')
......@@ -152,6 +154,10 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
//Template
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
// ------
......@@ -238,7 +244,9 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
uploadPerusahaan,
searchPerusahaan,
getUnitBisnisActive,
getMenuByUser
getMenuByUser,
getDetailUnitBisnis,
uploadFoto
}
}
......
......@@ -44,7 +44,8 @@ const Images = {
logout: require('./setting.png'),
setting: require('./logout.png'),
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 @@
transition: 0.39;
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 {
position: fixed;
top: 0;
......@@ -150,6 +150,7 @@ export default function MiniDrawer() {
const [selectedSubIndex, setSelectSub] = React.useState([]);
const [userFullname, setUserFullname] = React.useState("")
const [userEmail, setUserEmail] = React.useState("")
const [userPhoto, setUserPhoto] = React.useState("")
const [application, setApplication] = React.useState([])
const [setting, setSetting] = React.useState([])
const [data, setData] = React.useState({
......@@ -316,7 +317,7 @@ export default function MiniDrawer() {
const parseChildren = (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 {
img: i.icon === '#' ? "" : i.icon,
label: i.menu_name,
......@@ -331,21 +332,26 @@ export default function MiniDrawer() {
const getMenuHierarki = () => {
api.create().getMenuByRole().then((response) => {
console.log(response)
if (response.data.status === "success") {
let app = null
let set = null
response.data.data.map((item) => {
if (item.menu_name === "Application") {
app = parseChildren(item.sub_menu)
return app
} else {
set = parseChildren(item.sub_menu)
return set
}
})
setApplication(app)
setSetting(set)
console.log(app);
if (response.data) {
if (response.data.status === "success") {
let app = null
let set = null
response.data.data.map((item) => {
if (item.menu_name === "Application") {
app = parseChildren(item.sub_menu)
return app
} else {
set = parseChildren(item.sub_menu)
return set
}
})
setApplication(app)
setSetting(set)
console.log(app);
} else {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}
} else {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
......@@ -356,9 +362,12 @@ export default function MiniDrawer() {
const getUserData = () => {
let userId = localStorage.getItem(Constant.USER)
api.create().getDetailUser(userId).then((response) => {
if (response.data.status == 'success') {
setUserFullname(response.data.data.fullname == null ? 'Anonym' : response.data.data.fullname)
setUserEmail(response.data.data.email == null ? 'Anonym@123.xyz' : response.data.data.email)
if (response.data) {
if (response.data.status == 'success') {
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() {
<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 style={{ width: 72, height: 72, backgroundColor: '#838383', borderRadius: 50, alignSelf: 'center' }}>
<img src={userPhoto} style={{ width: 72, height: 72, borderRadius: 50 }} />
</div>
</div>
......@@ -488,7 +498,7 @@ export default function MiniDrawer() {
{application.map((item, index) => (
<div style={{ marginTop: index === 0 ? null : 5 }} >
{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}>
<ListItemIcon style={{ minWidth: open ? 40 : 56 }}><img src={item.img} /></ListItemIcon>
<Typography style={{ fontFamily: 'nunito', color: '#525355', fontSize: 14 }}>{item.label}</Typography>
......@@ -536,7 +546,7 @@ export default function MiniDrawer() {
{setting.map((item, index) => (
<div style={{ marginTop: index === 0 ? null : 5 }} >
{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}>
<ListItemIcon style={{ minWidth: open ? 40 : 56 }}><img src={item.img} /></ListItemIcon>
<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 {
uploadParameter() {
api.create().uploadParameter(this.state.payload).then(response => {
console.log(response)
this.getAllParameter()
this.setState({ visibleParameter: true })
if (response.data) {
if (response.data.status === "success") {
console.log(response)
alert(response.data.message)
this.getAllParameter()
this.setState({ visibleParameter: true })
}
}
})
}
......@@ -648,49 +653,62 @@ export default class Parameter extends Component {
/>
</div>
<div style={{ width: '20%', justifyContent: 'space-around', display: 'flex' }}>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.downloadFile()}
>
<img src={Images.template} />
</button>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.setState({ visibleUpload: true })}
>
<img src={Images.upload} />
</button>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.downloadDataTable()}
>
<img src={Images.download} />
</button>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent'
}}
onClick={() => this.setState({ visibleCreate: true })}
>
<img src={Images.add} />
</button>
<a data-tip={'Download Template'} data-for="template">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.downloadFile()}
>
<img src={Images.template} />
</button>
</a>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
<a data-tip={'Upload'} data-for="upload">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.setState({ visibleUpload: true })}
>
<img src={Images.upload} />
</button>
</a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<a data-tip={'Download'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.downloadDataTable()}
>
<img src={Images.download} />
</button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
<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 style={{ padding: 25 }}>
......@@ -777,7 +795,7 @@ export default class Parameter extends Component {
className="btn btn-circle btn-white"
onClick={() => this.setState({ visibleUpload: false })}
>
<img src={Images.close}/>
<img src={Images.close} />
</button>
</div>
</div>
......@@ -785,7 +803,7 @@ export default class Parameter extends Component {
type={this.state.uploadStatus}
percentage={this.state.percentage}
result={this.state.result}
acceptedFiles={["pdf"]}
acceptedFiles={["xlsx"]}
onHandle={(dt) => {
this.fileHandler(dt)
this.setState({ uploadStatus: 'idle', percentage: '0' })
......
This diff is collapsed.
This diff is collapsed.
......@@ -116,27 +116,14 @@ export default class EditReportItems extends Component {
// alert('coba ya')
if (R.isNil(this.state.reportType)) return alert("Jenis Laporan 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'})
}
else if (R.isEmpty(this.state.description)) {
} else if (R.isEmpty(this.state.tempData.description)) {
this.setState({errorDesc: true, msgErrorDesc: 'Deskripsi Harus Diisi'})
}
else if (R.isNil(this.state.parent)) return alert("Parent ID is Required.")
else if (R.isNil(this.state.InputType)) return alert("Tipe Data is Required.");
else if (this.state.disabledFormula === false && R.isEmpty(this.state.formula)) {
} else if (R.isNil(this.state.InputType)) return alert("Tipe Data harus dipilih.")
else if (this.state.InputType.type_report_name === 'Formula' || this.state.InputType.type_report_name === 'Validation' && R.isEmpty(this.state.tempData.formula)) {
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 {
this.updateReportItems()
}
......@@ -368,6 +355,8 @@ export default class EditReportItems extends Component {
id="description"
label="Deskripsi"
name="description"
error={this.state.errorDesc}
helperText={this.state.msgErrorDesc}
onChange={(e) => this.handleChange(e, '')}
value={this.state.tempData === null ? '' : this.state.tempData.description}
inputProps={{
......@@ -545,14 +534,15 @@ export default class EditReportItems extends Component {
id="order"
label="Order"
name="order"
onChange={(e) => this.handleChange(e, '')}
value={this.state.tempData === null ? '' : this.state.tempData.order}
error={this.state.errorOrder}
helperText={this.state.msgErrorOrder}
onChange={(e) => this.handleChange(e, '')}
inputProps={{
style: {
fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif',
paddingLeft: 10
fontFamily: 'Nunito Sans, sans-serif'
}
}}
InputLabelProps={{
......@@ -560,8 +550,7 @@ export default class EditReportItems extends Component {
fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085',
paddingLeft: 10
color: '#7e8085'
}
}}
>
......@@ -623,6 +612,8 @@ export default class EditReportItems extends Component {
label="Formula"
disabled={this.state.InputType == null? true : (this.state.InputType.type_report_name === 'Formula' || this.state.InputType.type_report_name === 'Validation'? false : true)}
name="formula"
error={this.state.errorFormula}
helperText={this.state.msgErrorFormula}
onChange={(e) => this.handleChange(e, '')}
value={this.state.tempData === null ? '' : this.state.tempData.formula}
inputProps={{
......@@ -701,7 +692,7 @@ export default class EditReportItems extends Component {
</button>
</div>
<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' }}>
<span style={{ color: '#fff', fontSize: 11 }}>Simpan</span>
</div>
......
......@@ -4,12 +4,14 @@ import * as R from 'ramda'
import { DateTimePicker, KeyboardDatePicker, DatePicker } from "@material-ui/pickers";
import format from "date-fns/format";
import Images from '../../../assets/Images';
import api from '../../../api';
export default class CreateUnitBisnis extends Component {
constructor(props) {
super(props)
this.state = {
id: '',
status:"",
name: '',
startDate: '',
endDate: '',
......@@ -28,16 +30,44 @@ export default class CreateUnitBisnis extends Component {
componentDidMount() {
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({
id: data.business_unit_id,
name: data.business_unit_name,
startDate: data.start_date,
endDate: data.end_date
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({
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) {
let data = this.state
let isDate = type !== '' ? true : false
......@@ -90,9 +120,9 @@ export default class CreateUnitBisnis extends Component {
if (R.isEmpty(this.state.name)) {
this.setState({ errorName: true, msgErrorName: 'Unit Bisnis tidak boleh kosong' })
} 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)) {
this.setState({ errorEndDate: true, msgErrorEndDate: 'Tanggal Berakhir tidak boleh kosong' })
this.setState({ errorEndDate: true, msgErrorEndDate: 'Berkahir Hingga tidak boleh kosong' })
} else {
let payload = {
"business_unit_name": this.state.name,
......@@ -119,7 +149,7 @@ export default class CreateUnitBisnis extends Component {
className="btn btn-circle btn-white"
onClick={() => this.props.onClickClose()}
>
<img src={Images.close}/>
<img src={Images.close} />
</button>
</div>
</div>
......@@ -130,8 +160,8 @@ export default class CreateUnitBisnis extends Component {
<div style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
value={this.props.data.business_unit_id}
id="status"
value={this.state.id}
id="id"
label="ID"
disabled
inputProps={{
......@@ -178,7 +208,7 @@ export default class CreateUnitBisnis extends Component {
<div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
value={this.props.data.status}
value={this.state.status}
id="status"
label="Status"
disabled
......@@ -199,11 +229,11 @@ export default class CreateUnitBisnis extends Component {
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<div style={{ display: 'flex' }}>
<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 style={{ display: 'flex' }}>
<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>
......@@ -307,7 +337,7 @@ export default class CreateUnitBisnis extends Component {
className="btn btn-circle btn-white"
onClick={() => this.props.onClickClose()}
>
<img src={Images.close}/>
<img src={Images.close} />
</button>
</div>
</div>
......@@ -385,8 +415,8 @@ export default class CreateUnitBisnis extends Component {
</div>
<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 }}>Diubah : Admin - 21 Jul 2020, 18:45</Typography>
<Typography style={{ fontSize: 11 }}>Dibuat : </Typography>
<Typography style={{ fontSize: 11 }}>Diubah : </Typography>
</div>
</div>
......
This diff is collapsed.
......@@ -263,7 +263,7 @@ export default class AddUser extends Component {
return (
<div className="test app-popup-show">
<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="popup-title">
<span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Ubah Data</span>
......
......@@ -299,7 +299,7 @@ export default class EditUser extends Component {
return (
<div className="test app-popup-show">
<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="popup-title">
<span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Ubah Data</span>
......
......@@ -9,6 +9,8 @@ import api from "../../api";
import { titleCase } from "../../library/Utils";
import InputAdornment from '@material-ui/core/InputAdornment';
import TextField from '@material-ui/core/TextField';
import { InputBase } from "@material-ui/core";
import ReactTooltip from "react-tooltip";
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable());
const options = ct.customOptions();
......@@ -30,11 +32,11 @@ class UserRole extends Component {
}
closeEdit() {
this.setState({edit: false})
this.setState({ edit: false })
}
closeAdd() {
this.setState({add: false})
this.setState({ add: false })
}
getRole() {
......@@ -42,15 +44,15 @@ class UserRole extends Component {
// console.log(response)
if (response.data.status === 'success') {
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]
})
// console.log(listData)
this.setState({listRole: listData})
this.setState({ listRole: listData })
// this.setState({listRole: response.data.data}, () => {
// console.log(this.state.listRole)
// })
} else {
alert(response.data.message)
}
......@@ -65,14 +67,14 @@ class UserRole extends Component {
api.create().searchRole(payload).then((response) => {
if (response.data.status === 'success') {
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]
})
this.setState({listRole: listData})
this.setState({ listRole: listData })
} else {
alert(response.data.message)
}
})
})
}
_handleKeyDown(e) {
......@@ -87,9 +89,9 @@ class UserRole extends Component {
handleChange(e) {
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')
}))
}
......@@ -107,15 +109,15 @@ class UserRole extends Component {
borderColor: 'transparent',
}}
// 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' }}>
{ tableMeta.rowData[4] === "Aktif" ?
<img src={Images.editCopy}/> :
{tableMeta.rowData[4] === "Aktif" ?
<img src={Images.editCopy} /> :
null
}
</div >
</button>
</div >
);
......@@ -172,39 +174,41 @@ class UserRole extends Component {
<div className={"main-color"} style={{ height: 199, width: '100%' }} />
<div>
<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>
<div style={{width: '60%', justifyContent: 'center', display: 'flex', borderWidth: 2, alignItems: 'center' }}>
<div style={{width: '50%', backgroundColor:'white', padding: 10, borderRadius: 7.5}}>
<TextField
id="input-with-icon-textfield"
name="search"
value={this.state.search}
placeholder={'Search'}
onChange={(e) => {
this.setState({ search: e.target.value }, () => {
if (this.state.search.length > 0) {
this.searchRole()
} else {
this.getRole()
}
});
}}
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>
<label style={{ color: 'white', fontSize: 16, alignSelf: 'center', width: '20%', }}>Master Data - Role & Otorisasi</label>
<div style={{ color: 'white', width: '50%', height: 37, display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center', borderRadius: 6, paddingLeft: 5, paddingRight: 5, alignSelf: 'center' }}>
<img src={Images.searchBlack} style={{ marginRight: 10 }} />
<InputBase
style={{ width: '100%' }}
placeholder="Search"
value={this.state.search}
onChange={(e) => {
this.setState({ search: e.target.value }, () => {
if (this.state.search.length > 0) {
this.searchRole()
} else {
this.getRole()
}
});
}}
inputProps={{ 'aria-label': 'naked' }}
/>
</div>
{/* <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' }}>
<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 style={{ padding: 25 }}>
......@@ -218,14 +222,14 @@ class UserRole extends Component {
</div>
</div>
{this.state.add && (
<AddRole
<AddRole
onClickClose={this.closeAdd.bind(this)}
refresh={this.getRole.bind(this)}
data={this.state.indexData}
/>
)}
{this.state.edit && (
<EditRole
<EditRole
onClickClose={this.closeEdit.bind(this)}
refresh={this.getRole.bind(this)}
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