Commit 78b799fb authored by Deni Rinaldi's avatar Deni Rinaldi

otorisasi profile

parent 33b53923
......@@ -109,6 +109,9 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const updateUser = (body) => api.post('user/update_user', body)
const deleteUser = (userId) => api.get(`user/delete_user/${userId}`)
const changePassword = (body) => api.post('/user/change_password', body)
const checkUploadUser = (body) => api.post('/user/check_import', body)
const uploadUser = (body) => api.post('/user/import_user', body)
//Template
const downloadTemplate = (fileName,fileType) => api.get(`attachment/download_file?fileName=${fileName}&&fileType=${fileType}`)
......@@ -162,7 +165,9 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
checkUploadUnitBisnis,
uploadUnitBisnis,
changePassword,
getPerusahaanHierarki
getPerusahaanHierarki,
checkUploadUser,
uploadUser
}
}
......
......@@ -8,6 +8,9 @@ const Images = {
budgetTahunan: require('./masterbudget.svg'),
manajemenDokumen: require('./docmanagement.svg'),
laporanBulanan: require('./laporanbulanan.svg'),
rolling: require('./rolling.svg'),
operatingindicator: require('./operatingindicator.svg'),
outlookperformance: require('./outlookperformance.svg'),
laporan: require('./laporan.svg'),
masterdata: require('./masterdata.svg'),
otorisasi: require('./otorisasi.svg'),
......@@ -39,6 +42,7 @@ const Images = {
search: require('./search.png'),
logout: require('./setting.png'),
setting: require('./logout.png'),
failedCopy: require('./failed-copy.svg'),
}
......
<svg xmlns="http://www.w3.org/2000/svg" width="17" height="16" viewBox="0 0 17 16">
<g fill="none" fill-rule="evenodd" opacity=".9">
<path d="M0 0H24V24H0z" transform="translate(-3 -4)"/>
<g stroke="#FFF" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.2">
<g stroke="#0D2846" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.2">
<path d="M13.538 5.28v7.028c0 .68-.55 1.23-1.23 1.23H1.23c-.68 0-1.231-.55-1.231-1.23V1.23C0 .55.551 0 1.23 0h10.373" transform="translate(-3 -4) translate(4 5)"/>
<path d="M2.552 6.154L6.217 9.95 14.923 0" transform="translate(-3 -4) translate(4 5)"/>
</g>
......
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="17" viewBox="0 0 14 17">
<g fill="none" fill-rule="evenodd" opacity=".9">
<path d="M0 0H24V24H0z" transform="translate(-5 -4)"/>
<g stroke="#FFF" stroke-width="1.2" transform="translate(-5 -4) translate(6 5)">
<g stroke="#0D2846" stroke-width="1.2" transform="translate(-5 -4) translate(6 5)">
<rect width="12" height="15" rx="2"/>
<path stroke-linecap="round" d="M2 3.025L10.02 3.025M2 6L10.02 6M2 9L10.02 9M2 12L6.01 12"/>
</g>
......
<svg xmlns="http://www.w3.org/2000/svg" width="72" height="72" viewBox="0 0 72 72">
<g fill="none" fill-rule="evenodd">
<circle cx="36" cy="36" r="36" fill="#ED8080"/>
<path fill="#FF3939" d="M36 72c19.882 0 36-16.118 36-36S55.882 0 36 0"/>
<circle cx="35.95" cy="35.95" r="31.95" fill="#FBE776" fill-rule="nonzero"/>
<path fill="#F5DB44" fill-rule="nonzero" d="M35.95 67.9c17.645 0 31.95-14.305 31.95-31.95C67.9 18.304 53.594 4 35.95 4"/>
<g fill="#FF3939" transform="translate(31 17)">
<rect width="11" height="24" rx="3"/>
<circle cx="5.5" cy="32.5" r="5.5"/>
</g>
</g>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
<g fill="none" fill-rule="evenodd" opacity=".9">
<path d="M0 0H24V24H0z" transform="translate(-3 -3)"/>
<path stroke="#FFF" stroke-linejoin="round" stroke-width="1.2" d="M4.46 8.838l7.019-4.492c.329-.21.75-.21 1.08.001l6.982 4.49c.286.185.459.502.459.842V19c0 .552-.448 1-1 1h-4.98 0v-6.924H9.991V20H5c-.552 0-1-.448-1-1V9.68c0-.34.174-.658.46-.842z" transform="translate(-3 -3)"/>
<path stroke="#0D2846" stroke-linejoin="round" stroke-width="1.2" d="M4.46 8.838l7.019-4.492c.329-.21.75-.21 1.08.001l6.982 4.49c.286.185.459.502.459.842V19c0 .552-.448 1-1 1h-4.98 0v-6.924H9.991V20H5c-.552 0-1-.448-1-1V9.68c0-.34.174-.658.46-.842z" transform="translate(-3 -3)"/>
</g>
</svg>
......@@ -2,9 +2,9 @@
<g fill="none" fill-rule="evenodd" opacity=".9">
<path d="M0 0H24V24H0z" transform="translate(-5 -4)"/>
<g transform="translate(-5 -4) translate(6 4)">
<rect width="12" height="14" y="2" stroke="#FFF" stroke-width="1.2" rx="2"/>
<rect width="8" height="3" x="2" fill="#FFF" rx="1"/>
<path stroke="#FFF" stroke-linecap="round" stroke-width="1.2" d="M2 12.5L6 12.5M2 6.5L10 6.5M2 9.5L10 9.5"/>
<rect width="12" height="14" y="2" stroke="#0D2846" stroke-width="1.2" rx="2"/>
<rect width="8" height="3" x="2" fill="#0D2846" rx="1"/>
<path stroke="#0D2846" stroke-linecap="round" stroke-width="1.2" d="M2 12.5L6 12.5M2 6.5L10 6.5M2 9.5L10 9.5"/>
</g>
</g>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="19" viewBox="0 0 16 19">
<g fill="none" fill-rule="evenodd" opacity=".9">
<path d="M0 0H24V24H0z" transform="translate(-4 -2)"/>
<g stroke="#FFF" stroke-width="1.2" transform="translate(-4 -2) translate(5 3)">
<g stroke="#0D2846" stroke-width="1.2" transform="translate(-4 -2) translate(5 3)">
<rect width="12" height="15" y="2" rx="2"/>
<path d="M2 2.06h0V2c0-1.105.895-2 2-2h8c1.105 0 2 .895 2 2v11c0 1.105-.895 2-2 2h0"/>
<path stroke-linecap="round" d="M2 5.025L10.02 5.025M2 8L10.02 8M2 11L10.02 11M2 14L6.01 14"/>
......
......@@ -2,12 +2,12 @@
<g fill="none" fill-rule="evenodd" opacity=".9">
<path d="M0 0H24V24H0z" transform="translate(-3 -3)"/>
<g transform="translate(-3 -3) translate(4 4)">
<path stroke="#FFF" stroke-width="1.2" d="M13.704 16.008c.197 0 1.207.025 1.223-.002C15.606 14.834 16 13.459 16 12c0-4.418-3.582-8-8-8s-8 3.582-8 8c0 1.46.391 2.83 1.075 4.008.008.013.436.013 1.286 0h11.343z"/>
<text fill="#FFF" font-family="Nunito-Bold, Nunito" font-size="8" font-weight="bold">
<path stroke="#0D2846" stroke-width="1.2" d="M13.704 16.008c.197 0 1.207.025 1.223-.002C15.606 14.834 16 13.459 16 12c0-4.418-3.582-8-8-8s-8 3.582-8 8c0 1.46.391 2.83 1.075 4.008.008.013.436.013 1.286 0h11.343z"/>
<text fill="#0D2846" font-family="Nunito-Bold, Nunito" font-size="8" font-weight="bold">
<tspan x="3" y="13">Rp</tspan>
</text>
<path stroke="#FFF" stroke-width="1.2" d="M10.139.004c.074 0 .452-.009.458 0 .255.39.403.848.403 1.333C11 2.807 9.657 4 8 4S5 2.808 5 1.337c0-.486.147-.941.403-1.333.003-.005.164-.005.482 0h4.254z"/>
<rect width="8" height="1" x="4" y="3" fill="#FFF" rx=".5"/>
<path stroke="#0D2846" stroke-width="1.2" d="M10.139.004c.074 0 .452-.009.458 0 .255.39.403.848.403 1.333C11 2.807 9.657 4 8 4S5 2.808 5 1.337c0-.486.147-.941.403-1.333.003-.005.164-.005.482 0h4.254z"/>
<rect width="8" height="1" x="4" y="3" fill="#0D2846" rx=".5"/>
</g>
</g>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="13" viewBox="0 0 18 13">
<g fill="none" fill-rule="evenodd" opacity=".9">
<path d="M0 0H24V24H0z" transform="translate(-3 -5)"/>
<g stroke="#FFF" stroke-width="1.2" transform="translate(-3 -5) translate(4 6)">
<g stroke="#0D2846" stroke-width="1.2" transform="translate(-3 -5) translate(4 6)">
<path d="M.137 8.279l1.51-6.721C1.853.647 2.663 0 3.597 0h8.808c.933 0 1.742.645 1.95 1.555l1.509 6.724"/>
<rect width="16" height="4" y="7" rx="2"/>
</g>
......
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
<g fill="none" fill-rule="evenodd" opacity=".9">
<path d="M0 0H24V24H0z" transform="translate(-3 -3)"/>
<g transform="translate(-3 -3) translate(4 4)">
<circle cx="8" cy="8" r="8" stroke="#0D2846" stroke-width="1.2"/>
<path fill="#0D2846" d="M16 8c0 4.418-3.582 8-8 8s-8-3.582-8-8h6c0 1.105.895 2 2 2s2-.895 2-2z"/>
<circle cx="8" cy="8" r="1" fill="#0D2846"/>
<path fill="#0D2846" d="M7 8L8 2.046 9 8z"/>
</g>
</g>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="13" viewBox="0 0 18 13">
<g fill="none" fill-rule="evenodd" opacity=".9">
<path d="M0 0H24V24H0z" transform="translate(-3 -6)"/>
<g stroke="#FFF" stroke-width="1.2" transform="translate(-3 -6) translate(4 7)">
<g stroke="#0D2846" stroke-width="1.2" transform="translate(-3 -6) translate(4 7)">
<rect width="16" height="11" stroke-linejoin="round" rx="1"/>
<path stroke-linejoin="round" d="M1 0h14c.552 0 1 .448 1 1v2h0H0V1c0-.552.448-1 1-1z"/>
<path d="M3 0L3 11M10 0L10 11"/>
......
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="18" viewBox="0 0 15 18">
<g fill="none" fill-rule="evenodd" opacity=".9">
<path d="M0 0H24V24H0z" transform="translate(-4 -3)"/>
<g stroke="#0D2846" stroke-width="1.2" transform="translate(-4 -3) translate(5 4)">
<rect width="13" height="16" rx="2"/>
<path stroke-linecap="round" stroke-linejoin="round" d="M2 4.065L2.983 5.012 5.002 3M2 8.065L2.983 9.012 5.002 7M2 12.065L2.983 13.012 5.002 11"/>
<path stroke-linecap="round" d="M7 4.006L11.002 4.006M7 8.006L11.002 8.006M7 12.006L11.002 12.006"/>
</g>
</g>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="17" height="18" viewBox="0 0 17 18">
<g fill="none" fill-rule="evenodd" opacity=".9">
<path d="M0 0H24V24H0z" transform="translate(-3 -3)"/>
<g stroke="#0D2846" stroke-linejoin="round" stroke-width="1.2">
<path d="M0 2L9 0 9 16 0 14z" transform="translate(-3 -3) translate(4 4)"/>
<path fill="#0D2846" d="M9 3H15V13H9z" transform="translate(-3 -3) translate(4 4)"/>
</g>
</g>
</svg>
......@@ -6,6 +6,19 @@
background-color: #f0f1f3 !important;
}
.blue-color{
color: #1a2d3e !important;
}
.btn-save{
width: 102px;
height: 30px;
object-fit: contain;
border-radius: 4px;
background-color: #354960;
outline: none;
}
.gradient-purple {
background: linear-gradient(to top, #9b59b6 10%, #e74c3c 100%);
color: #fff; }
......@@ -145,6 +158,9 @@
border-top-right-radius: 20px;
border-bottom-right-radius: 20px;
}
.btn-no-outline{
outline: 'none'
}
.color-white {
......@@ -76,6 +76,7 @@ const useStyles = makeStyles((theme) => ({
},
drawerOpen: {
width: drawerWidth,
borderRight: 0,
transition: theme.transitions.create('width', {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.enteringScreen,
......@@ -83,6 +84,7 @@ const useStyles = makeStyles((theme) => ({
backgroundColor: '#f6f7f9'
},
drawerClose: {
borderRight: 0,
transition: theme.transitions.create('width', {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.leavingScreen,
......@@ -251,7 +253,7 @@ export default function MiniDrawer() {
{ArraySide.map((item, index) => (
<div style={{ marginTop: index === 0 ? null : 5 }} >
{item.subItem != null ?
<div style={{ justifyContent: 'space-between', flexDirection: 'row', display: 'flex', paddingLeft: 10, paddingRight: 10 }} onClick={() => selectedIndexs == null ? setSelectedIndexs(item.label) : setSelectedIndexs(null)}>
<div style={{ justifyContent: 'space-between', flexDirection: 'row', display: 'flex', paddingLeft: 5, paddingRight: 10 }} onClick={() => selectedIndexs == null ? setSelectedIndexs(item.label) : setSelectedIndexs(null)}>
<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>
......@@ -268,7 +270,7 @@ export default function MiniDrawer() {
</Link> : null
:
<Link to={`${url}/${item.path}`}>
<div style={{ paddingLeft: 10 }} className={selectedIndex === item.label ? "active" : ""}>
<div style={{ paddingLeft: 5 }} className={selectedIndex === item.label ? "active" : ""}>
<ListItem button key={item.label} onClick={() => selectIndex(item.label)}>
<ListItemIcon style={{ minWidth: open ? 40 : 56 }}><img src={item.img} style={{ fill: '#525355' }} /></ListItemIcon>
<Typography style={{ fontFamily: 'nunito', color: '#525355', fontSize: 14 }}>{item.label}</Typography>
......@@ -283,7 +285,7 @@ export default function MiniDrawer() {
{item.subItem.map((sub, indexs) => {
return (
<Link to={`${url}/${sub.path}`}>
<div style={{ paddingLeft: 10, }} className={selectedSubIndex === sub.label ? "active" : ""} onClick={() => selectSub(sub.label)}>
<div style={{ paddingLeft: 5, }} className={selectedSubIndex === sub.label ? "active" : ""} onClick={() => selectSub(sub.label)}>
<ListItem button style={{ paddingLeft: 61 }}>
<Typography style={{ fontFamily: 'nunito', color: '#525355', fontSize: 14 }}>{sub.label}</Typography>
</ListItem>
......
......@@ -33,7 +33,7 @@ export default class DashboardCAT extends Component {
]
return (
<div className='a-s-p-mid no-header'>
<div className={"main-color"} style={{ padding: 28 }}>
<div className={"main-color"} style={{ padding: 27 }}>
<Typography style={{ fontSize: '16px', color: 'white' }}>ON CHANGE CAT</Typography>
</div>
<div className="padding-20px">
......
......@@ -11,6 +11,7 @@ import { TextField, InputBase } from "@material-ui/core";
import { ExcelRenderer } from 'react-excel-renderer';
import api from "../../api";
import { isThisSecond } from "date-fns";
import PopUpFailedSave from "../../library/PopUpFailedSave";
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable());
......@@ -30,7 +31,8 @@ export default class UnitBisnis extends Component {
visibleUnitBisnis: true,
cols: null,
rows: null,
dataLoaded: false
dataLoaded: false,
popupError: false
}
this.fileHandler = this.fileHandler.bind(this);
}
......@@ -352,7 +354,7 @@ export default class UnitBisnis extends Component {
return (
<div style={{ height: this.props.height }}>
{/* <Row> */}
<div style={{ height: 199, width: '100%' }} className={"main-color"}/>
<div style={{ height: 199, width: '100%' }} className={"main-color"} />
{this.state.visibleUnitBisnis === true ?
<div>
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -150 }}>
......@@ -454,28 +456,15 @@ export default class UnitBisnis extends Component {
<span style={{ color: '#354960', fontSize: 11 }}>Batal</span>
</div>
</button>
{this.state.buttonError === true ?
<a data-tip={'Terdapat Error saat import data'} data-for="button">
<button
type="button"
onClick={() => null}
onClick={() => this.state.buttonError ? this.setState({ popupError: true }) : this.uploadUnitBisnis()}
style={{}}
>
<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>
</button>
</a> :
<button
type="button"
onClick={() => this.uploadUnitBisnis()}
style={{}}
>
<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>
</button>}
<ReactTooltip border={true} id="button" place="top" type="light" effect="solid" />
</div>
</div>
}
......@@ -496,6 +485,10 @@ export default class UnitBisnis extends Component {
updateUnitBisnis={this.updateUnitBisnis.bind(this)}
/>
)}
{this.state.popupError && (
<PopUpFailedSave onClickClose={()=> this.setState({ popupError: false })} />
)}
{this.state.visibleUpload && (
<div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
......
......@@ -11,6 +11,8 @@ import { titleCase } from "../../library/Utils";
import { InputAdornment, TextField } from "@material-ui/core";
import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer';
import ReactTooltip from "react-tooltip";
import PopUpFailedSave from "../../library/PopUpFailedSave";
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable());
......@@ -76,7 +78,7 @@ const tesss = [{
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex'}}>
<div style={{ display: 'flex' }}>
{val}
</div >
);
......@@ -101,11 +103,11 @@ export default class UserRole extends Component {
}
closeEdit() {
this.setState({edit: false})
this.setState({ edit: false })
}
closeAdd() {
this.setState({add: false})
this.setState({ add: false })
}
getUser() {
......@@ -114,11 +116,11 @@ export default class UserRole extends Component {
if (response.data.status == 'success') {
// console.log(response.data.data)
let data = response.data.data
let listData = data.map((item,index) => {
let listData = data.map((item, index) => {
return [index, item.user_id, item.fullname, item.email, item.role_name, item.company, item.status]
})
// console.log(listData)
this.setState({listUser: listData})
this.setState({ listUser: listData })
// this.setState({listUser: response.data.data}, () => {
// console.log(this.state.listUser)
// })
......@@ -136,10 +138,10 @@ export default class UserRole extends Component {
api.create().searchUser(payload).then((response) => {
if (response.data.status == 'success') {
let data = response.data.data
let listData = data.map((item,index) => {
let listData = data.map((item, index) => {
return [index, item.user_id, item.fullname, item.email, item.role_name, item.company, item.status]
})
this.setState({listUser: listData})
this.setState({ listUser: listData })
} else {
alert(response.data.message)
}
......@@ -154,19 +156,157 @@ export default class UserRole extends Component {
}
else {
let judul = resp.rows[0]
let isi = resp.rows.slice(1)
// let body = isi.map((item) => {
// return {
// item
// ]
// })
console.log(JSON.stringify(isi));
let isi = resp.rows.slice(3)
let payload = []
isi.map((item, index) => {
payload.push({
id: item.id,
fullname: item[0],
email: item[1],
role: item[2],
start_date: item[3],
end_date: item[4],
})
})
let body = {
user: payload
}
this.setState({ payload: body })
api.create().checkUploadUser(body).then(response => {
console.log(response);
if (response.data.status === "success") {
let dataRow = response.data.data.map((item, index) => {
return [
index + 1,
item.fullname,
item.email,
item.role,
item.start_date,
item.end_date,
item.error
]
})
let columns = [
"Data Ke-",
"Nama Lengkap",
{
name: "Email",
options: {
customBodyRender: (val, tableMeta) => {
console.log(tableMeta)
let check = null
if (tableMeta.rowData[6] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('email'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[6] != null && check > -1 ?
<a data-tip={tableMeta.rowData[6][check].message} data-for="email">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
}
<ReactTooltip border={true} id="email" place="bottom" type="light" effect="solid" />
</div >
);
}
}
},
{
name: "Role",
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[6] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('role'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[6] != null && check > -1 ?
<a data-tip={tableMeta.rowData[6][check].message} data-for="role">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
}
<ReactTooltip border={true} id="role" place="bottom" type="light" effect="solid" />
</div >
);
}
}
},
{
name: "Berlaku Mulai",
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[6] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('start_date'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[6] != null && check > -1 ?
<a data-tip={tableMeta.rowData[6][check].message} data-for="startdate">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
}
<ReactTooltip border={true} id="startdate" place="bottom" type="light" effect="solid" />
</div >
);
}
}
},
{
name: "Berakhir Hingga",
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[6] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('end_date'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[6] != null && check > -1 ?
<a data-tip={tableMeta.rowData[6][check].message} data-for="enddate">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
}
<ReactTooltip border={true} id="enddate" place="bottom" type="light" effect="solid" />
</div >
);
}
}
},
{
name: "",
options: {
display: false
}
}
]
this.setState({
dataLoaded: true,
cols: tesss,
rows: isi
cols: columns,
rows: dataRow
});
}
})
}
});
}
......@@ -186,7 +326,7 @@ export default class UserRole extends Component {
}
downloadDataTables = async () => {
let res = await fetch ("https://tia.eksad.com/tia-reporting-dev/public/user/export_user")
let res = await fetch("https://tia.eksad.com/tia-reporting-dev/public/user/export_user")
res = await res.blob()
console.log(res)
if (res.size > 0) {
......@@ -208,6 +348,14 @@ export default class UserRole extends Component {
}
}
uploadUser() {
api.create().uploadUser(this.state.payload).then(response => {
console.log(response)
this.getUser()
this.setState({ visibleUser: true })
})
}
render() {
const columns = [{
name: "Action",
......@@ -222,7 +370,7 @@ export default 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] })}
>
<img src={Images.editCopy} />
</button>
......@@ -279,7 +427,7 @@ export default class UserRole extends Component {
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex'}}>
<div style={{ display: 'flex' }}>
{val}
</div >
);
......@@ -292,9 +440,9 @@ export default class UserRole extends Component {
<div style={{ height: 199, backgroundColor: '#354960', width: '100%' }} />
{this.state.visibleUser ? <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 - User</label>
<div style={{width: '60%', justifyContent: 'center', display: 'flex', borderWidth: 2, alignItems: 'center' }}>
<div style={{width: '50%', backgroundColor:'white', padding: 10, borderRadius: 7.5}}>
<label style={{ fontFamily: 'nunito', color: 'white', width: '20%', alignSelf: 'center', fontSize: 18 }}>Master Data - User</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"
......@@ -310,9 +458,9 @@ export default class UserRole extends Component {
});
}}
onKeyDown={(e) => this._handleKeyDown(e)}
style={{width: '100%', borderBottomWidth: 0, borderBottomColor: 'red'}}
style={{ width: '100%', borderBottomWidth: 0, borderBottomColor: 'red' }}
InputProps={{
style: { fontFamily: 'nunito', borderBottomColor: 'white'},
style: { fontFamily: 'nunito', borderBottomColor: 'white' },
startAdornment: (
<InputAdornment position="start">
<SearchIcon />
......@@ -333,7 +481,7 @@ export default class UserRole extends Component {
}}
onClick={() => this.downloadFile()}
>
<img src={Images.template}/>
<img src={Images.template} />
</button>
<button
style={{
......@@ -347,7 +495,7 @@ export default class UserRole extends Component {
}}
onClick={() => this.setState({ visibleUpload: true })}
>
<img src={Images.upload}/>
<img src={Images.upload} />
</button>
<button
style={{
......@@ -361,7 +509,7 @@ export default class UserRole extends Component {
}}
onClick={() => this.downloadDataTables()}
>
<img src={Images.download}/>
<img src={Images.download} />
</button>
<button
style={{
......@@ -373,9 +521,9 @@ export default class UserRole extends Component {
marginRight: 5,
marginLeft: 20
}}
onClick={() => this.setState({add: true})}
onClick={() => this.setState({ add: true })}
>
<img src={Images.add}/>
<img src={Images.add} />
</button>
</div>
</div>
......@@ -415,9 +563,15 @@ export default class UserRole extends Component {
<span style={{ color: '#354960', fontSize: 11 }}>Batal</span>
</div>
</button>
<button
type="button"
onClick={() => this.state.buttonError ? this.setState({ popupError: true }) : null}
style={{}}
>
<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>
</button>
</div>
</div>
}
......@@ -435,6 +589,9 @@ export default class UserRole extends Component {
data={this.state.indexData}
/>
)}
{this.state.popupError && (
<PopUpFailedSave onClickClose={() => this.setState({ popupError: false })} />
)}
{this.state.visibleUpload && (
<div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
......
import React, { Component } from 'react';
import { Typography, AppBar, Tabs, Tab, TextField } from '@material-ui/core';
import { Typography, AppBar, Tabs, Tab, TextField, Collapse, withStyles, Checkbox } from '@material-ui/core';
import HomePage from './HomePage';
import Images from '../assets/Images';
import api from '../api';
import Constant from '../library/Constant';
import RemoveIcon from '@material-ui/icons/Remove';
import AddIcon from '@material-ui/icons/Add';
import { titleCase } from '../library/Utils';
const CustomCheckbox = withStyles({
root: {
color: '#51c6ea',
'&$checked': {
color: '#51c6ea',
},
},
checked: {},
})((props) => <Checkbox color="default" {...props} />);
export default class Profile extends Component {
constructor(props) {
......@@ -18,11 +32,21 @@ export default class Profile extends Component {
msgOldPassword: 'Terdiri 8 karakter dengan kombinasi angka.',
msgPassword: 'Terdiri 8 karakter dengan kombinasi angka.',
msgConfirmPassword: 'Terdiri 8 karakter dengan kombinasi angka.',
company: [],
listCompany: [],
selectedIndex: 0
}
}
componentDidMount() {
this.getPerusahaan()
this.getUser()
}
selectTab = (event, newEvent) => {
this.setState({ tab: newEvent })
}
handleChange(e) {
let data = this.state
this.setState({ ...data, [e.target.name]: e.target.value })
......@@ -68,7 +92,7 @@ export default class Profile extends Component {
}
}
confirmPassword(){
confirmPassword() {
let body = {
"old_password": this.state.oldPassword,
"new_password": this.state.password,
......@@ -77,7 +101,7 @@ export default class Profile extends Component {
api.create().changePassword(body).then(response => {
console.log(response);
if (response.data.status === "success") {
this.setState({ oldPassword: "", password: "", confirmPassword: ""})
this.setState({ oldPassword: "", password: "", confirmPassword: "" })
alert(response.data.message)
} else {
alert(response.data.message)
......@@ -96,10 +120,35 @@ export default class Profile extends Component {
return re.test(String(email).toLowerCase());
}
getUser() {
let userId = localStorage.getItem(Constant.USER)
api.create().getDetailUser(userId).then((response) => {
if (response.data.status == 'success') {
this.setState({ company: response.data.data.company })
console.log(response)
}
})
}
getPerusahaan() {
api.create().getPerusahaanHierarki().then((response) => {
if (response.data.status == 'success') {
this.setState({ listCompany: response.data.data })
console.log(response.data.data)
}
})
}
handleItemChecked(item) {
let indexID = this.state.company.findIndex((val) => val == item.company_id)
return indexID == -1 ? false : true
}
render() {
return (
<div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
<div style={{ height: 203, backgroundColor: '#354960', flex: 1, display: 'flex', alignItems: 'flex-end', padding: 20 }}>
<div className={"main-color"} style={{ height: 203, flex: 1, display: 'flex', alignItems: 'flex-end', padding: 20 }}>
<div style={{ display: 'flex', alignItems: 'center' }}>
<div style={{ height: 72, width: 72, backgroundColor: 'white', borderRadius: 40, marginRight: 20 }} />
<Typography style={{ fontSize: '24px', color: 'white', fontWeight: 'bold' }}>John Doe</Typography>
......@@ -180,8 +229,8 @@ export default class Profile extends Component {
<div style={{ width: '100%', height: 64, backgroundColor: '#354960', display: 'flex', paddingLeft: 20, borderTopLeftRadius: 6, borderTopRightRadius: 6, alignItems: 'center' }}>
<Typography style={{ fontSize: '13px', color: 'white', fontWeight: 'bold' }}>Otorisasi Perusahaan</Typography>
</div>
<div style={{ padding: 20 }}>
<div style={{ display: 'flex' }}>
<div style={{ padding: 20, overflow: 'scroll', height: '40vh' }}>
{/* <div style={{ display: 'flex' }}>
<img src={Images.check} style={{ marginRight: 10 }} />
<Typography style={{ fontSize: 14, opacity: .5, color: '#4b4b4b' }}>Agro PersadaTriputra </Typography>
</div>
......@@ -196,7 +245,45 @@ export default class Profile extends Component {
<div style={{ display: 'flex', marginTop: 20, paddingLeft: 20 }}>
<img src={Images.check} style={{ marginRight: 10 }} />
<Typography style={{ fontSize: 14, opacity: .5, color: '#4b4b4b' }}>Dharma Poliplast</Typography>
</div> */}
{this.state.listCompany.map((item, index) => {
return (
<div>
<div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start' }}>
<span>
<CustomCheckbox
disabled={true}
disabled={true}
checked={this.handleItemChecked(item)}
// onChange={() => this.handleItemClick(item)}
/>
</span>
<Typography style={{ fontSize: 12 }}>{titleCase(item.company_name)}</Typography>
</div>
{item.childCompany.length > 0 && item.childCompany.map((items, indexs) => {
return (
<Collapse in={index == this.state.selectedIndex} timeout="auto" unmountOnExit>
<div style={{ paddingLeft: 30, display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start' }}>
{/* {item.sub_menu.length > 0 && <span onClick={() => this.setState({ selectedIndex: index == this.state.selectedIndex ? 0 : index })} style={{ marginLeft: 7, marginRight: 2 }}>
{index == this.state.selectedIndex ? <RemoveIcon color={'action'} fontSize={'small'} /> : <AddIcon color={'action'} fontSize={'small'} />}
</span>} */}
{/* <RemoveIcon color={'action'} fontSize={'small'} /> */}
<span>
<CustomCheckbox
disabled={true}
checked={this.handleItemChecked(items)}
// onChange={() => this.handleItemClick(items)}
/>
</span>
<Typography style={{ fontSize: 12 }}>{titleCase(items.company_name)}</Typography>
</div>
</Collapse>
)
})}
</div>
)
})}
</div>
</div>
</div>
......
......@@ -20,19 +20,19 @@ const arraySide = [
subItem: null
},
{
img: Images.manajemenDokumen,
img: Images.rolling,
label: 'Rolling Outlook & CAT Revision',
path: 'beranda',
subItem: null
},
{
img: Images.manajemenDokumen,
img: Images.outlookperformance,
label: 'Outlook Performance Appraisal',
path: 'beranda',
subItem: null
},
{
img: Images.manajemenDokumen,
img: Images.operatingindicator,
label: 'Operating Indicator',
path: 'beranda',
subItem: null
......@@ -71,6 +71,12 @@ const arraySide = [
path: 'beranda',
subItem: null
},
{
img: '',
label: 'Profile',
path: 'profile',
subItem: null
},
{
img: Images.masterdata,
label: 'Master Data',
......
import React, { Component } from 'react';
import Images from '../assets/Images';
import { Typography } from '@material-ui/core';
export default class PopUpFailedSave extends Component {
render() {
return (
<div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8, padding: 50 }}>
<div style={{ display: 'flex', justifyContent: 'center' }}>
<img src={Images.failedCopy} />
</div>
<div style={{ display: 'grid', justifyContent: 'center', marginTop: 20 }}>
<span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}>
{`Maaf, penyimpanan data gagal.`}
</span>
<span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}>
{`Mohon ulangi beberapa saat lagi.`}
</span>
</div>
<div style={{ display: 'grid', justifyContent: 'center', marginTop: 24 }}>
<button
className={"btn-save"}
onClick={()=> this.props.onClickClose()}
>
<span style={{ color: 'white' }}>OK</span>
</button>
</div>
</div>
</div>
);
}
}
......@@ -58,6 +58,10 @@ const routes = [
path: "/home/dashboard-cat",
main: DashboardCAT
},
{
path: "/home/profile",
main: Profile
},
{
path: "*",
main: screen404
......
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