Commit 91d854bd authored by Deni Rinaldi's avatar Deni Rinaldi

image sidebar ++ || upload || getUnitBisnis

parent 8fa58802
......@@ -2373,6 +2373,15 @@
}
}
},
"adler-32": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/adler-32/-/adler-32-1.2.0.tgz",
"integrity": "sha1-aj5r8KY5ALoVZSgIyxXGgT0aXyU=",
"requires": {
"exit-on-epipe": "~1.0.1",
"printj": "~1.1.0"
}
},
"aggregate-error": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.1.tgz",
......@@ -2692,6 +2701,11 @@
"resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz",
"integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg=="
},
"attr-accept": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/attr-accept/-/attr-accept-2.2.1.tgz",
"integrity": "sha512-GpefLMsbH5ojNgfTW+OBin2xKzuHfyeNA+qCktzZojBhbA/lPZdCFMWdwk5ajb989Ok7ZT+EADqvW3TAFNMjhA=="
},
"autoprefixer": {
"version": "9.8.6",
"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.8.6.tgz",
......@@ -3667,6 +3681,16 @@
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw="
},
"cfb": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/cfb/-/cfb-1.2.0.tgz",
"integrity": "sha512-sXMvHsKCICVR3Naq+J556K+ExBo9n50iKl6LGarlnvuA2035uMlGA/qVrc0wQtow5P1vJEw9UyrKLCbtIKz+TQ==",
"requires": {
"adler-32": "~1.2.0",
"crc-32": "~1.2.0",
"printj": "~1.1.2"
}
},
"chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
......@@ -3897,6 +3921,22 @@
"resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c="
},
"codepage": {
"version": "1.14.0",
"resolved": "https://registry.npmjs.org/codepage/-/codepage-1.14.0.tgz",
"integrity": "sha1-jL4lSBMjVZ19MHVxsP/5HnodL5k=",
"requires": {
"commander": "~2.14.1",
"exit-on-epipe": "~1.0.1"
},
"dependencies": {
"commander": {
"version": "2.14.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.14.1.tgz",
"integrity": "sha512-+YR16o3rK53SmWHU3rEM3tPAh2rwb1yPcQX5irVn7mb0gXbwuCCrnkbV5+PBfETdfg1vui07nM6PCG1zndcjQw=="
}
}
},
"collection-visit": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz",
......@@ -4176,6 +4216,15 @@
"parse-json": "^4.0.0"
}
},
"crc-32": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.0.tgz",
"integrity": "sha512-1uBwHxF+Y/4yF5G48fwnKq6QsIXheor3ZLPT80yGBV1oEUwpPojlEhQbWKVw1VwcTQyMGHK1/XMmTjmlsmTTGA==",
"requires": {
"exit-on-epipe": "~1.0.1",
"printj": "~1.1.0"
}
},
"create-ecdh": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz",
......@@ -5813,6 +5862,11 @@
"resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz",
"integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw="
},
"exit-on-epipe": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/exit-on-epipe/-/exit-on-epipe-1.0.1.tgz",
"integrity": "sha512-h2z5mrROTxce56S+pnvAV890uu7ls7f1kEvVGJbw1OlFH3/mlJ5bkXu0KRyW94v37zzHPiUd55iLn3DA7TjWpw=="
},
"expand-brackets": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz",
......@@ -6154,6 +6208,14 @@
"schema-utils": "^2.5.0"
}
},
"file-selector": {
"version": "0.1.12",
"resolved": "https://registry.npmjs.org/file-selector/-/file-selector-0.1.12.tgz",
"integrity": "sha512-Kx7RTzxyQipHuiqyZGf+Nz4vY9R1XGxuQl/hLoJwq+J4avk/9wxxgZyHKtbyIPJmbD4A66DWGYfyykWNpcYutQ==",
"requires": {
"tslib": "^1.9.0"
}
},
"filesize": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/filesize/-/filesize-6.0.1.tgz",
......@@ -6356,6 +6418,11 @@
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
"integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ="
},
"frac": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/frac/-/frac-1.1.2.tgz",
"integrity": "sha512-w/XBfkibaTl3YDqASwfDUqkna4Z2p9cFSr1aHDt0WoMTECnRfBOv2WArlZILlqgWlmdIlALXGpM2AOhEk5W3IA=="
},
"fragment-cache": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz",
......@@ -11231,6 +11298,11 @@
}
}
},
"printj": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/printj/-/printj-1.1.2.tgz",
"integrity": "sha512-zA2SmoLaxZyArQTOPj5LXecR+RagfPSU5Kw1qP+jkWeNlrq+eJZyY2oS68SU1Z/7/myXM4lo9716laOFAVStCQ=="
},
"process": {
"version": "0.11.10",
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
......@@ -11749,11 +11821,31 @@
"scheduler": "^0.19.1"
}
},
"react-dropzone": {
"version": "11.0.2",
"resolved": "https://registry.npmjs.org/react-dropzone/-/react-dropzone-11.0.2.tgz",
"integrity": "sha512-/Wde9Il1aJ1FtWllg3N2taIeJh4aftx6UGUG8R1TmLnZit2RnDcEjcKwEEbKwgLXTTh8QQpiZWQJq45jTy1jCA==",
"requires": {
"attr-accept": "^2.0.0",
"file-selector": "^0.1.12",
"prop-types": "^15.7.2"
}
},
"react-error-overlay": {
"version": "6.0.7",
"resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.7.tgz",
"integrity": "sha512-TAv1KJFh3RhqxNvhzxj6LeT5NWklP6rDr2a0jaTfsZ5wSZWHOGeqQyejUp3xxLfPt2UpyJEcVQB/zyPcmonNFA=="
},
"react-excel-renderer": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/react-excel-renderer/-/react-excel-renderer-1.1.0.tgz",
"integrity": "sha512-bxQdl7CLQmC3ughWUyMuzVPgjnssiQWi/3hGzq7bJ39wkBUT1E7gr8uh3PaJMG+AqYPx91qBFhDwzzNzZGKADA==",
"requires": {
"react": "^16.7.0",
"webpack": "^4.12.0",
"xlsx": "^0.14.1"
}
},
"react-is": {
"version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
......@@ -13180,6 +13272,14 @@
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw="
},
"ssf": {
"version": "0.10.3",
"resolved": "https://registry.npmjs.org/ssf/-/ssf-0.10.3.tgz",
"integrity": "sha512-pRuUdW0WwyB2doSqqjWyzwCD6PkfxpHAHdZp39K3dp/Hq7f+xfMwNAWIi16DyrRg4gg9c/RvLYkJTSawTPTm1w==",
"requires": {
"frac": "~1.1.2"
}
},
"sshpk": {
"version": "1.16.1",
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz",
......@@ -15307,6 +15407,27 @@
"async-limiter": "~1.0.0"
}
},
"xlsx": {
"version": "0.14.5",
"resolved": "https://registry.npmjs.org/xlsx/-/xlsx-0.14.5.tgz",
"integrity": "sha512-s/5f4/mjeWREmIWZ+HtDfh/rnz51ar+dZ4LWKZU3u9VBx2zLdSIWTdXgoa52/pnZ9Oe/Vu1W1qzcKzLVe+lq4w==",
"requires": {
"adler-32": "~1.2.0",
"cfb": "^1.1.2",
"codepage": "~1.14.0",
"commander": "~2.17.1",
"crc-32": "~1.2.0",
"exit-on-epipe": "~1.0.1",
"ssf": "~0.10.2"
},
"dependencies": {
"commander": {
"version": "2.17.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz",
"integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg=="
}
}
},
"xml-name-validator": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz",
......
......@@ -18,6 +18,8 @@
"react-bootstrap": "^1.3.0",
"react-d3-donut": "^1.1.2",
"react-dom": "^16.13.1",
"react-dropzone": "^11.0.2",
"react-excel-renderer": "^1.1.0",
"react-number-format": "^4.4.1",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.1"
......
......@@ -72,6 +72,10 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
//Menu
const getMenu = () => api.get('menu/get_menu_hierarki')
//UNIT BISNIS
const getUnitBisnis = () => api.get('business_unit/get_all_business_unit')
// ------
// STEP 3
// ------
......@@ -94,7 +98,8 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
addRole,
editRole,
deleteRole,
getMenu
getMenu,
getUnitBisnis
}
}
......
......@@ -9,6 +9,9 @@ const Images = {
manajemenDokumen: require('./docmanagement.svg'),
laporanBulanan: require('./laporanbulanan.svg'),
laporan: require('./laporan.svg'),
masterdata: require('./masterdata.svg'),
otorisasi: require('./otorisasi.svg'),
approvalmatrix: require('./approvalmatrix.svg'),
editCopy: require('./edit-copy.svg'),
editCopy2: require('./edit-copy-2.svg'),
tia: require('./tia.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">
<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>
</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)">
<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>
</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)">
<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"/>
</g>
</g>
</svg>
......@@ -83,6 +83,24 @@
-ms-transition: all 0.35s cubic-bezier(0, 1, 0.5, 1);
-o-transition: all 0.35s cubic-bezier(0, 1, 0.5, 1);
transition: all 0.35s cubic-bezier(0, 1, 0.5, 1); }
.app-popup::-moz-scrollbar {
width: 10px;
height: 10px;
background-color: rgba(0, 0, 0, 0); }
.app-popup::-moz-scrollbar-thumb {
background-color: rgba(0, 0, 0, 0.14);
-moz-border-radius: 1ex; }
.app-popup::-moz-scrollbar-corner {
background-color: #fff; }
.app-popup::-webkit-scrollbar {
width: 10px;
height: 10px;
background-color: rgba(0, 0, 0, 0); }
.app-popup::-webkit-scrollbar-thumb {
background-color: rgba(0, 0, 0, 0.14);
-webkit-border-radius: 1ex; }
.app-popup::-webkit-scrollbar-corner {
background-color: #fff; }
.app-popup-show {
display: flex;
-webkit-transition: all 0.35s cubic-bezier(0, 1, 0.5, 1);
......@@ -6026,7 +6044,7 @@
background-color: #fff;
color: #394263; }
.btn.btn-black {
background-color: rgba(0, 0, 0, 0.1);
background-color: #0d2846;
color: #fff; }
.btn.btn-black:hover {
background-color: rgba(0, 0, 0, 0.54);
......@@ -6635,7 +6653,7 @@
.upload-file {
position: relative;
width: calc(100% - 30px);
width: calc(100%);
padding: 15px;
border-radius: 5px;
background-color: rgba(85, 85, 85, 0.1); }
......@@ -6648,11 +6666,10 @@
color: #444444; }
.upload-file .u-p-preview {
position: relative;
width: calc(100% - 30px);
padding: 15px;
border-radius: 5px;
margin: 15px 0;
background-color: rgba(0, 0, 0, 0.84); }
background-color: #51c6ea; }
.upload-file .u-p-top {
position: relative;
width: 100%;
......@@ -194,7 +194,7 @@ export default function MiniDrawer() {
<div style={{ display: 'flex', justifyContent: 'space-between', flex: 1, padding: 10 }}>
<img src={Images.triputra} alt="React Logo" style={{ height: 31, width: 151, alignSelf: 'center' }} />
<IconButton onClick={handleDrawerClose}>
{theme.direction === 'rtl' ? <ChevronRightIcon color={"white"} /> : <ChevronLeftIcon color={"white"} />}
<ChevronLeftIcon style={{ fill: 'white' }} />
</IconButton>
</div>
{open &&
......@@ -225,18 +225,26 @@ export default function MiniDrawer() {
{item.subItem != null ?
<div style={{ justifyContent: 'space-between', flexDirection: 'row', display: 'flex', paddingRight: 10 }} onClick={() => selectedIndex == 0 ? setSelectedIndex(index) : setSelectedIndex(0)}>
<ListItem button key={item.label}>
<ListItemIcon>{index % 2 === 0 ? <InboxIcon style={{ color: "white" }} /> : <MailIcon style={{ color: "white" }} />}</ListItemIcon>
<ListItemIcon><img src={item.img} /></ListItemIcon>
<Typography style={{ color: 'white', fontSize: 12 }}>{item.label}</Typography>
</ListItem>
{item.subItem != null ? (index === selectedIndex ? <ExpandLess style={{ color: "white", marginLeft: 50, alignSelf: 'center' }} /> : <ExpandMore style={{ color: "white", marginLeft: 50, alignSelf: 'center' }} />) : null}
</div>
:
<Link to={`${url}/${item.path}`}>
<ListItem button key={item.label} onClick={() => setSelectedIndex(index)}>
<ListItemIcon>{index % 2 === 0 ? <InboxIcon style={{ color: "white" }} /> : <MailIcon style={{ color: "white" }} />}</ListItemIcon>
<Typography style={{ color: 'white', fontSize: 12 }}>{item.label}</Typography>
</ListItem>
</Link>
item.label === 'PENGATURAN' ?
open ?
<Link to={`${url}/${item.path}`}>
<ListItem button key={item.label} onClick={() => null}>
<Typography style={{ color: 'white', fontSize: 12 }}>{item.label}</Typography>
</ListItem>
</Link> : null :
<Link to={`${url}/${item.path}`}>
<ListItem button key={item.label} onClick={() => setSelectedIndex(index)}>
<ListItemIcon><img src={item.img} /></ListItemIcon>
<Typography style={{ color: 'white', fontSize: 12 }}>{item.label}</Typography>
</ListItem>
</Link>
}
{item.subItem != null &&
<div>
......
......@@ -3,9 +3,12 @@ import { Container, Row, Col } from "react-bootstrap";
import { makeStyles, createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles';
import SearchIcon from '@material-ui/icons/Search';
import Images from "../../assets/Images";
import UploadFile from "../../library/Upload";
import MUIDataTable from "mui-datatables";
import CreateUnitBisnis from "./formUnitBisnis/CreateUnitBisnis";
import { TextField, InputBase } from "@material-ui/core";
import { ExcelRenderer } from 'react-excel-renderer';
import api from "../../api";
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable());
......@@ -17,16 +20,64 @@ export default class UnitBisnis extends Component {
this.state = {
visibleCreate: false,
visibleEdit: false,
dataTable: [],
listData: [],
data: []
}
this.fileHandler = this.fileHandler.bind(this);
}
fileHandler = (event) => {
let fileObj = event
ExcelRenderer(fileObj, (err, resp) => {
// console.log(resp);
// if (err) {
// console.log(err);
// }
// else {
// this.setState({
// cols: resp.cols,
// rows: resp.rows
// });
// }
});
}
componentDidMount() {
this.getData()
}
render() {
getData() {
api.create().getUnitBisnis().then((response) => {
console.log(response)
if (response.data.status == 'success') {
let data = response.data.data
let listData = data.map((item, index) => {
return [index, item.business_unit_id, item.business_unit_name, item.status]
})
this.setState({ dataTable: listData, listData: response.data.data })
} else {
alert(response.data.message)
}
})
}
openPopUp(index, type) {
if (type === 'edit') {
this.setState({
selectIndex: index,
visibleEdit: true
})
} else {
this.setState({
data: this.state.listData[index],
visibleCreate: true
})
}
}
console.log(this.props.height)
render() {
const columns = [{
name: "Action",
options: {
......@@ -37,9 +88,10 @@ export default class UnitBisnis extends Component {
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent'
borderColor: 'transparent',
}}
onClick={() => this.setState({ visibleEdit: true, data: tableMeta.rowData })}
// onClick={() => console.log(tableMeta.rowData[1])}
onClick={() => this.openPopUp(tableMeta.rowIndex, 'edit')}
>
<img src={Images.editCopy} />
</button>
......@@ -105,7 +157,16 @@ export default class UnitBisnis extends Component {
</div>
<div style={{ width: '20%', justifyContent: 'space-around', display: 'flex' }}>
<img src={Images.template} />
<img src={Images.upload} />
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent'
}}
onClick={() => this.setState({ visibleUpload: true })}
>
<img src={Images.upload} />
</button>
<img src={Images.download} />
<button
style={{
......@@ -123,7 +184,7 @@ export default class UnitBisnis extends Component {
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
theme={getMuiTheme()}
data={data}
data={this.state.dataTable}
columns={columns}
options={options}
/>
......@@ -141,9 +202,42 @@ export default class UnitBisnis extends Component {
<CreateUnitBisnis
type={"edit"}
onClickClose={() => this.setState({ visibleEdit: false })}
data={this.state.data}
data={this.state.listData[this.state.selectIndex]}
/>
)}
{this.state.visibleUpload && (
<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="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
<div className="popup-title">
<span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Upload File</span>
</div>
</div>
<div className="col-2 content-right" style={{ maxWidth: "inherit", alignSelf: 'center' }}>
<button
type="button"
className="btn btn-circle btn-white"
onClick={() => this.setState({ visibleUpload: false })}
>
<i className="fa fa-lg fa-times" style={{ color: 'white' }} />
</button>
</div>
</div>
<UploadFile
type={this.state.uploadStatus}
percentage={this.state.percentage}
result={this.state.result}
acceptedFiles={["pdf"]}
onHandle={(dt) => {
this.fileHandler(dt)
this.setState({ uploadStatus: 'idle', percentage: '0' })
}}
onUpload={() => this.setState({ visibleUpload: false })}
/>
</div>
</div>
)}
</div>
);
}
......
......@@ -7,9 +7,13 @@ export default class CreateUnitBisnis extends Component {
return type === 'edit' ? this.renderEdit() : this.renderCreate()
}
componentDidMount() {
console.log(this.props.data);
}
renderEdit() {
return (
<div className="test app-popup-show" style={{ paddingTop: 100 }}>
<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="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
......@@ -31,61 +35,119 @@ export default class CreateUnitBisnis extends Component {
<div className="border-bottom grid grid-2x grid-mobile-none gap-15px" style={{ padding: 20 }}>
<div className="column-1">
<div className="margin-bottom-20px">
<div style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
value={this.props.data[1]}
value={this.props.data.business_unit_id}
id="status"
label="ID"
disabled
variant="filled"
inputProps={{
style: {
fontSize: 11
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
/>
</div>
<div className="margin-bottom-20px">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
id="periode"
value={"1 Januari 2020"}
label="Berlaku Mulai"
// value={this.state.periode}
onChange={(e) => null}
inputProps={{
style: {
fontSize: 11
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
>
</TextField>
</div>
<div className="margin-bottom-20px">
<div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
value={this.props.data[3]}
value={this.props.data.status}
id="status"
label="Status"
disabled
variant="filled"
inputProps={{
style: {
fontSize: 11
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
/>
</div>
<div className="margin-bottom-20px">
<Typography style={{ fontSize: 11 }}>Dibuat : Admin - 21 Jul 2020, 18:45</Typography>
<Typography style={{ fontSize: 11 }}>Diubah : Admin - 21 Jul 2020, 18:45</Typography>
<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>
</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>
</div>
</div>
</div>
<div className="column-2">
<div className="margin-bottom-20px">
<div style={{ padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
id="unit"
label="Unit Bisnis"
value={this.props.data[2]}
value={this.props.data.business_unit_name}
inputProps={{
style: {
fontSize: 11
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
>
</TextField>
</div>
<div className="margin-bottom-20px">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
id="unit"
label="Berlaku Hingga"
defaultValue={"31 Desember 2100"}
inputProps={{
style: {
fontSize: 11
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
>
</TextField>
</div>
......@@ -95,9 +157,14 @@ export default class CreateUnitBisnis extends Component {
<div className="border-top grid grid-2x" style={{ height: 56, backgroundColor: '#f5f5f5', paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1" style={{ alignSelf: 'center' }}>
<div style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#354960', fontSize: 11 }}>Batal</span>
</div>
<button
type="button"
onClick={() => this.props.onClickClose()}
>
<div style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#354960', fontSize: 11 }}>Batal</span>
</div>
</button>
</div>
<div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
<div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
......@@ -134,7 +201,7 @@ export default class CreateUnitBisnis extends Component {
<div className="border-bottom grid grid-2x grid-mobile-none gap-15px" style={{ padding: 20 }}>
<div className="column-1">
<div className="margin-bottom-20px">
<div style={{ padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
id="periode"
......@@ -142,43 +209,86 @@ export default class CreateUnitBisnis extends Component {
label="Berlaku Mulai"
// value={this.state.periode}
onChange={(e) => null}
inputProps={{
style: {
fontSize: 11
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
>
</TextField>
</div>
<div className="margin-bottom-20px">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5, backgroundColor: '#e8e8e8', }}>
<TextField
style={{ width: '100%' }}
defaultValue={"Aktif"}
id="status"
label="Status"
disabled
variant="filled"
inputProps={{
style: {
fontSize: 11
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
/>
</div>
<div className="margin-bottom-20px">
<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>
</div>
</div>
<div className="column-2">
<div className="margin-bottom-20px">
<div style={{ padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
id="unit"
label="Unit Bisnis"
defaultValue={"Agrobisnis"}
inputProps={{
style: {
fontSize: 11
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
>
</TextField>
</div>
<div className="margin-bottom-20px">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
id="unit"
label="Berlaku Hingga"
defaultValue={"31 Desember 2100"}
inputProps={{
style: {
fontSize: 11
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
>
</TextField>
</div>
......@@ -188,9 +298,14 @@ export default class CreateUnitBisnis extends Component {
<div className="border-top grid grid-2x" style={{ height: 56, backgroundColor: '#f5f5f5', paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1" style={{ alignSelf: 'center' }}>
<div style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#354960', fontSize: 11 }}>Batal</span>
</div>
<button
type="button"
onClick={() => this.props.onClickClose()}
>
<div style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#354960', fontSize: 11 }}>Batal</span>
</div>
</button>
</div>
<div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
<div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
......@@ -199,7 +314,7 @@ export default class CreateUnitBisnis extends Component {
</div>
</div>
</div>
</div>
</div >
);
}
}
import Images from "../assets/Images";
const arraySide = [
{
img: '',
img: Images.Home,
label: 'Beranda',
path: 'beranda',
subItem: null
},
{
img: '',
img: Images.budgetTahunan,
label: 'Budget Tahunan',
path: 'budget-tahunan',
subItem: null
},
{
img: '',
img: Images.laporanBulanan,
label: 'Laporan Bulanan',
path: 'beranda',
subItem: null
},
{
img: '',
img: Images.manajemenDokumen,
label: 'Manajemen Dokumen',
path: 'beranda',
subItem: null
},
{
img: '',
img: Images.laporan,
label: 'Laporan',
path: '',
subItem: [
......@@ -52,7 +54,7 @@ const arraySide = [
subItem: null
},
{
img: '',
img: Images.masterdata,
label: 'Master Data',
path: '',
subItem: [
......@@ -84,7 +86,7 @@ const arraySide = [
]
},
{
img: '',
img: Images.otorisasi,
label: 'Otorisasi',
path: '',
subItem: [
......@@ -101,7 +103,7 @@ const arraySide = [
]
},
{
img: '',
img: Images.approvalmatrix,
label: 'Approval Matrix',
path: 'approval-matrix',
subItem: null
......
import React, { Component, createRef } from "react"
import Dropzone from 'react-dropzone'
import LinearProgress from '@material-ui/core/LinearProgress'
import Images from "../assets/Images"
const dropzoneRef = createRef()
class Upload extends Component {
constructor(props) {
super(props)
this.state = {
file: '',
nameFile: 'File name',
typeFile: '',
sizeFile: '0',
inputVisible: true,
previewVisible: false,
labelUploadVisible: false,
iconButtonUpload: 'fa fa-1x fa-upload',
uploadProgress: false,
percentage: '0',
completed: '0'
}
}
componentDidUpdate(prevs, next) {
if (prevs.percentage > 0 && prevs.percentage <= 100) {
console.log('old percentage', prevs.percentage)
console.log('new percentage', this.state.percentage)
if (this.state.percentage !== prevs.percentage) {
this.setState({percentage: prevs.percentage})
}
}
if (prevs.result === 'success' || prevs.result === 'error') {
if (this.state.uploadProgress === true) {
this.setState({uploadProgress: false, percentage: '100', iconButtonUpload: 'fa fa-1x fa-check'})
}
}
}
onDrop = (acceptedFiles) => {
const formData = new FormData()
let length = acceptedFiles[0].name.split(".").length
let fileType = acceptedFiles[0].name.split(".")[length - 1]
formData.append('file', acceptedFiles[0])
if (acceptedFiles)
{
this.setState({
file: acceptedFiles[0],
typeFile: fileType,
nameFile: acceptedFiles[0].name,
sizeFile: (acceptedFiles[0].size/1000).toFixed(0),
previewVisible: true,
inputVisible: false,
uploadProgress: false,
percentage: '0'
})
this.props.onHandle(acceptedFiles[0])
}
else
{
this.setState({
previewVisible: false,
inputVisible: true,
uploadProgress: false,
percentage: '0'
})
alert("Unsupported Media Type")
}
}
onRemove = () => {
this.setState({
previewVisible: false,
inputVisible: true,
uploadProgress: false,
percentage: '0'
})
}
onUpload = () => {
this.props.onUpload()
// var strProps = this.props.acceptedFiles
// var strState = this.state.typeFile
// if (strProps.includes(strState)) {
// this.setState({uploadProgress: true, percentage: '0'})
// this.props.onUpload()
// } else {
// alert('Unsupported File Type')
// }
}
render() {
return(
<div>
<Dropzone ref={dropzoneRef} onDrop={this.onDrop}>
{({getRootProps, getInputProps}) => (
<div>
<div className="upload-file">
{/* label */}
{ this.state.inputVisible
? <div {...getRootProps()} className="padding-10px" style={{cursor: 'pointer'}}>
<input {...getInputProps()} />
<div className="u-p-title">
Drag 'n' drop some files here, or click to select files
</div>
</div>
: null }
{/* file */}
{ this.state.previewVisible
?
<div className="u-p-file u-p-preview">
<div className="display-flex-normal">
<div className="width width-35px">
<button
onClick={this.state.uploadProgress === true ? null : this.onRemove}
className="btn btn-small-circle btn-black"
type="button">
<i className="fa fa-1x fa-times" />
</button>
</div>
<div className="width width-full margin-left-10px">
<div className="txt-site txt-12 txt-white txt-bold">
{ this.state.nameFile }
</div>
<div className="txt-site txt-11 txt-white txt-thin">
{ this.state.sizeFile } KB
</div>
</div>
{/* this.state.uploadProgress === true
? (
<div className="width width-100px padding-10px txt-site txt-12 txt-white txt-thin">
({this.state.percentage})%
</div>
) : null */}
{this.props.type === 'upload' ?
<div className="width width-155px padding-10px txt-site txt-11 txt-white txt-thin">
Uploading {this.state.percentage}%
</div> : null }
{this.props.disableButtonUpload !== true ? (
<div className="width width-35px">
<button
className="btn btn-small-circle"
type="button"
onClick={this.state.uploadProgress === true ? null : this.onUpload}>
{/*<i className={this.state.iconButtonUpload} />*/}
{this.state.uploadProgress === true
? <i className={ 'fa fa-1x fa-spinner fa-spin'} /> :
<img src={Images.upload} />}
</button>
</div>
) : null}
</div>
{this.props.type === 'upload' ?
<div className="margin-top-15px">
<LinearProgress variant="determinate" value={this.state.percentage} />
</div> : null }
{/* this.state.uploadProgress === true
? (
<div className="margin-15px">
<LinearProgress variant="determinate" value={this.state.percentage} />
</div>
) : null */}
</div>
: null }
{/* image */}
{/* <div className="u-p-image u-p-preview">
<div className="display-flex-normal">
<div className="width width-full display-flex-normal">
<button className="btn btn-small-circle btn-black">
<i className="fa fa-1x fa-times" />
</button>
</div>
<div className="width width-full display-flex-normal content-right">
<button className="btn btn-small-circle btn-black">
<i className="fa fa-1x fa-upload" />
</button>
</div>
</div>
</div> */}
</div>
</div>
)}
</Dropzone>
</div>
)
}
}
export default Upload
\ No newline at end of file
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