Commit 81ebde6b authored by faisalhamdi's avatar faisalhamdi

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

parents 267d4bef b201a5e5
......@@ -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"
......
......@@ -60,13 +60,24 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
// way at this level.
//
const getRoot = () => api.get('')
//Auth
const login = (body) => api.post('auth/login', body)
const verification = (body) => api.post('email/reset_password', body)
//Role
const getRole = () => api.get('role/get_all_role')
const getDetailRole = (roleId) => api.get(`role/get_role_by_id/${roleId}`)
const addRole = (body) => api.post('role/create_role', body)
const editRole = (body) => api.post('role/update_role', body)
const deleteRole = (roleId) => api.post(`role/delete_role/${roleId}`)
//Menu
const getMenu = () => api.get('menu/get_menu_hierarki')
//UNIT BISNIS
const getUnitBisnis = () => api.get('business_unit/get_all_business_unit')
// ------
// STEP 3
// ------
......@@ -83,10 +94,14 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
// a list of the API functions from step 2
getRoot,
login,
verification,
getRole,
getDetailRole,
addRole,
editRole,
deleteRole,
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%;
import React, { Component } from 'react';
import Images from '../assets/Images';
import { TextField, InputAdornment, Button, Typography } from '@material-ui/core';
import { Link } from 'react-router-dom';
class EmailVerification extends Component {
......@@ -23,9 +24,12 @@ class EmailVerification extends Component {
<Typography style={{textAlign: 'center', fontSize: 14, marginTop: 24, color: '#4b4b4b', fontFamily: 'Nunito Sans, sans-serif'}} >Link verifikasi berhasil terkirim. Silahkan cek email Anda.</Typography>
<Link to={{pathname: '/login'}} style={{textDecoration: 'none'}}>
<Button variant="contained" style={{ marginTop: 24, marginBottom: 20, width: 250, height: 30, borderRadius: 4 , backgroundColor: '#51c6ea', color: '#ffffff'}}>
<Typography style={{fontSize: 12, fontFamily: 'Nunito Sans, sans-serif'}}>Tutup</Typography>
</Button>
</Link>
</div>
</div>
);
......
import React, { Component } from 'react';
import Images from '../assets/Images';
import { TextField, InputAdornment, Button, Typography } from '@material-ui/core';
import api from '../api';
import Constant from '../library/Constant';
class ForgotPassword extends Component {
constructor(props) {
super(props)
this.state = {
username: ''
email: '',
errorEmail: false,
msgEmail: ''
}
}
handleChange(e) {
let data = this.state
this.setState({...data, [e.target.name] : e.target.value})
if (e.target.name == "email") {
this.setState({ errorEmail: false, msgEmail: '' })
}
}
validateEmail() {
if (this.state.email.trim() == "") {
this.setState({ errorEmail: true, msgEmail: 'Email harus diisi!' })
} else {
this.verification()
}
}
verification() {
// alert('test')
let payload = {
"email": this.state.email
}
api.create().verification(payload).then((response) => {
if(response.data.status === 'success') {
this.props.history.push('/email-verification')
} else {
if (response.data.message == 'Akun Tidak Ditemukan!') {
this.setState({ errorEmail: true, msgEmail: response.data.message })
}
}
})
}
render() {
return (
<div style={{ flex: 1, display: 'flex', backgroundColor: '#51c6ea', height: '100vh', justifyContent: 'center', alignItems: 'center' }}>
......@@ -23,26 +55,28 @@ class ForgotPassword extends Component {
<TextField
label={<Typography style={{fontSize: 12, fontFamily: 'Nunito Sans, sans-serif'}}>Email *</Typography>}
id="username"
id="email"
type={"text"}
name={"username"}
value={this.state.username}
onChange={(username) => this.setState({username: username.target.value})}
name={"email"}
value={this.state.email}
onChange={(email) => {
this.handleChange(email)
}}
variant="outlined"
error={false}
error={this.state.errorEmail}
style={{ width: 250, height: 51, marginTop: 32, fontSize: 14 }}
helperText=""
helperText={this.state.msgEmail}
InputProps={{
endAdornment: <InputAdornment position="end"><img src={Images.email} /></InputAdornment>,
}}
/>
<Button variant="contained" style={{ marginTop: 23, width: 250, height: 30, borderRadius: 4 }} disabled>
<Button name="submit" variant="contained" disabled={this.state.email.trim() === '' ? true : false} onClick={() => this.validateEmail()} style={{ marginTop: this.state.errorEmail ? 35 : 23, width: '100%', height: 30, borderRadius: 4, color: this.state.email.trim() === '' ? '#4b4b4b' : '#fff', backgroundColor: this.state.email.trim() === '' ? '#d8d8d8' : '#51c6ea' }}>
<Typography style={{fontSize: 12, fontFamily: 'Nunito Sans, sans-serif'}}>Lanjut</Typography>
</Button>
<div style={{ marginTop: 24}}>
<span style={{ color: '#51c6ea', cursor: 'pointer' }}>
<span onClick={() => this.props.history.goBack()} style={{ color: '#51c6ea', cursor: 'pointer' }}>
<Typography style={{fontSize: 14}}>Kembali Ke Login</Typography>
</span>
</div>
......
......@@ -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,15 +225,23 @@ 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>
:
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>{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>
</Link>
......
......@@ -6,6 +6,7 @@ import Visibility from '@material-ui/icons/Visibility';
import VisibilityOff from '@material-ui/icons/VisibilityOff';
import api from '../api';
import Constant from '../library/Constant';
import { Link } from 'react-router-dom';
const CustomCheckbox = withStyles({
root: {
......@@ -23,7 +24,11 @@ class Login extends Component {
this.state = {
username: '',
password: '',
showPass: false
showPass: false,
errorUsername: false,
errorPassword: false,
msgUsername: '',
msgPassword: ''
}
}
......@@ -34,6 +39,21 @@ class Login extends Component {
handleChange(e) {
let data = this.state
this.setState({...data, [e.target.name] : e.target.value})
if (e.target.name == "username") {
this.setState({ errorUsername: false, msgUsername: '' })
} else if (e.target.name) {
this.setState({ errorPassword: false, msgPassword: '' })
}
}
validateLogin() {
if (this.state.username.trim() == "") {
this.setState({ errorUsername: true, msgUsername: 'Username harus diisi!' })
} else if (this.state.password.trim() == "") {
this.setState({ errorPassword: true, msgPassword: 'Password harus diisi!' })
} else {
this.login()
}
}
login() {
......@@ -46,7 +66,11 @@ class Login extends Component {
localStorage.setItem(Constant.TOKEN, response.data.data.token)
this.props.history.push('/home/beranda')
} else {
alert(response.data.message)
if (response.data.message == 'Password Salah!') {
this.setState({ errorPassword: true, msgPassword: response.data.message })
} else {
this.setState({ errorUsername: true, msgUsername: response.data.message })
}
}
})
}
......@@ -59,7 +83,7 @@ class Login extends Component {
<img src={Images.imageLogin} style={{ marginTop: 30 }} />
</div>
<div style={{ width: '50%', height: '100vh', backgroundColor: '#51c6ea', display: 'flex', justifyContent: 'center', alignItems: 'center', flexDirection: 'column' }}>
<div style={{ paddingTop: 56, paddingLeft: 64, paddingRight: 64, display: 'flex', flexDirection: 'column', width: 378, height: 431, borderRadius: 12, boxShadow: '0 2 4 0 rgba(0, 0, 0, 0.2)', backgroundColor: '#ffffff' }}>
<div style={{ paddingTop: 56, paddingLeft: 54, paddingRight: 54, display: 'flex', flexDirection: 'column', width: 388, height: 441, borderRadius: 12, boxShadow: '0 2 4 0 rgba(0, 0, 0, 0.2)', backgroundColor: '#ffffff' }}>
<img src={Images.tia} />
<TextField
......@@ -68,11 +92,13 @@ class Login extends Component {
type={"text"}
name={"username"}
value={this.state.username}
onChange={(username) => this.handleChange(username)}
onChange={(username) => {
this.handleChange(username)
}}
variant="outlined"
error={false}
style={{ width: 250, height: 51, marginTop: 32, fontSize: 14 }}
helperText=""
error={this.state.errorUsername}
style={{ width: '100%', height: 51, marginTop: 32, fontSize: 14 }}
helperText={this.state.msgUsername}
InputProps={{
endAdornment: <InputAdornment position="end"><img src={Images.email} /></InputAdornment>,
}}
......@@ -84,11 +110,13 @@ class Login extends Component {
type={this.state.showPass ? 'text' : 'password'}
name={"password"}
value={this.state.password}
onChange={(password) => this.handleChange(password) }
onChange={(password) => {
this.handleChange(password)
}}
variant="outlined"
error={false}
style={{ width: 250, height: 51, marginTop: 20 }}
helperText=""
error={this.state.errorPassword}
style={{ width: '100%', height: 51, marginTop: this.state.errorUsername ? 35 : 20 }}
helperText={this.state.msgPassword}
InputProps={{
endAdornment: <InputAdornment position="end">
<IconButton
......@@ -103,12 +131,12 @@ class Login extends Component {
}}
/>
<div style={{ flexDirection: 'row', width: '100%', marginTop: 16 }}>
<div style={{ flexDirection: 'row', width: '100%', marginTop: this.state.errorPassword ? 26 : 16 }}>
<CustomCheckbox name="checked-remember" />
<span style={{ color: 'rgba(0, 0, 0, 0.5)', fontSize: 12, fontFamily: 'Nunito Sans, sans-serif' }}>Remember Me</span>
<span style={{marginLeft: 30, color: '#51c6ea', cursor: 'pointer', fontSize: 12, fontFamily: 'Nunito Sans, sans-serif' }}>Lupa Kata Sandi?</span>
<Link to={{pathname: '/forgot-password'}} style={{textDecoration: 'none'}}><span style={{marginLeft: 30, color: '#51c6ea', cursor: 'pointer', fontSize: 12, fontFamily: 'Nunito Sans, sans-serif' }}>Lupa Kata Sandi?</span></Link>
</div>
<Button name="submit" variant="contained" onClick={() => this.login()} style={{ marginTop: 23, width: '100%', height: 35, borderRadius: 4 }}>
<Button name="submit" variant="contained" disabled={this.state.username.trim() == '' && this.state.password.trim() == '' ? true : false} onClick={() => this.validateLogin()} style={{ marginTop: 23, width: '100%', height: 35, borderRadius: 4, color: this.state.username.trim() == '' && this.state.password.trim() == '' ? '#4b4b4b' : '#fff', backgroundColor: this.state.username.trim() == '' && this.state.password.trim() == '' ? '#d8d8d8' : '#51c6ea' }}>
<Typography style={{fontSize: 12, fontFamily: 'Nunito Sans, sans-serif'}}>Login</Typography>
</Button>
</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} />
<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' }}>
<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' }}>
<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 >
);
}
}
......@@ -18,7 +18,7 @@ export default class UserRole extends Component {
super(props)
this.state = {
listRole: [],
paramsData: {},
indexData: {},
add: false,
edit: false
}
......@@ -38,6 +38,7 @@ export default class UserRole extends Component {
getRole() {
api.create().getRole().then((response) => {
// console.log(response)
if (response.data.status == 'success') {
let data = response.data.data
let listData = data.map((item,index) => {
......@@ -52,7 +53,7 @@ export default class UserRole extends Component {
} else {
alert(response.data.message)
}
// console.log(response.data.data)
console.log(response.data.data)
})
}
......@@ -69,7 +70,8 @@ export default class UserRole extends Component {
cursor: 'pointer',
borderColor: 'transparent',
}}
onClick={() => this.setState({edit: true, paramsData: tableMeta.rowData})}
// onClick={() => console.log(tableMeta.rowData[1])}
onClick={() => this.setState({edit: true, indexData: tableMeta.rowData[1]})}
>
<img src={Images.editCopy} />
</button>
......@@ -149,13 +151,13 @@ export default class UserRole extends Component {
{this.state.add && (
<AddRole
onClickClose={this.closeAdd.bind(this)}
data={this.state.paramsData}
data={this.state.indexData}
/>
)}
{this.state.edit && (
<EditRole
onClickClose={this.closeEdit.bind(this)}
data={this.state.paramsData}
data={this.state.indexData}
/>
)}
</div>
......
import React, { Component } from 'react';
import { TextField } from '@material-ui/core';
export default class CreateUnitBisnis extends Component {
export default class AddRole extends Component {
render() {
return (
<div className="test app-popup-show" style={{display: 'flex', justifyContent: 'center', alignItems: 'center'}}>
......
import React, { Component } from 'react';
import { TextField } from '@material-ui/core';
import { TextField, Divider, Typography, Checkbox } from '@material-ui/core';
import api from '../../../api';
export default class EditRole extends Component {
constructor(props) {
super(props)
this.state = {
paramsId: this.props.data,
tempData: null,
menuData: null,
privileges: [],
checked: false
}
}
handleChecked() {
this.setState({checked: !this.state.checked})
}
componentDidMount() {
this.getDetailRole()
this.getMenu()
}
handleChange(e) {
let data = this.state
this.setState({...data, tempData: {...this.state.tempData, [e.target.name] : e.target.value}})
}
getDetailRole() {
api.create().getDetailRole(this.state.paramsId).then((response) => {
if (response.data.status == 'success') {
this.setState({tempData: response.data.data, privileges: response.data.data.privileges})
} else {
alert(response.data.message)
}
})
}
updateRole() {
let payload = {
"role_id": 40,
"role_name": "admin-tia",
"start_date": "2020-01-01",
"end_date": "2020-12-31",
"privileges": [
{
"menu_id": 17,
"button_id": [1, 2, 3]
}
]
}
}
getMenu() {
api.create().getMenu().then((response) => {
if (response.data.status == 'success') {
this.setState({menuData: response.data.data})
} else {
alert(response.data.message)
}
})
}
handleItemChecked(item) {
let indexID = this.state.privileges.findIndex((val) => val.menu_id == item.menu_id)
return indexID == -1? false : true
}
handleItemClick(item) {
let indexID = this.state.privileges.findIndex((val) => val.menu_id == item.menu_id)
let privileges = this.state.privileges
if (indexID == -1) {
privileges.push({
menu_id: item.menu_id,
button_id: [1,2,3]
})
} else {
privileges.splice(indexID,1)
}
this.setState({privileges})
}
handleSubItemChecked(item, index) {
let indexID = this.state.privileges.findIndex((val) => val.menu_id == item.menu_id)
let value = false
if (indexID == -1) {
value = false
} else {
let arrayButton = this.state.privileges[indexID].button_id
console.log(arrayButton)
let indexButtonID = this.state.privileges[indexID].button_id.findIndex((val) => val == index)
// console.log(indexButtonID)
if (indexButtonID == -1) {
value = false
} else {
value = true
}
}
return indexID == -1? value : value
}
handleSubItemClick(item, index) {
let indexID = this.state.privileges.findIndex((val) => val.menu_id == item.menu_id)
let indexButtonID = this.state.privileges[indexID].button_id.findIndex((val) => val == index)
let privileges = this.state.privileges
let button_id = privileges[indexID].button_id
if (indexButtonID == -1) {
button_id.push(index)
} else {
button_id.splice(indexButtonID,1)
}
privileges[indexID].button_id = button_id
this.setState({privileges})
}
export default class CreateUnitBisnis extends Component {
render() {
return (
<div className="test app-popup-show">
......@@ -9,7 +124,7 @@ export default class CreateUnitBisnis extends Component {
<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' }}>Create Data</span>
<span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Ubah Data</span>
</div>
</div>
<div className="col-2 content-right" style={{ maxWidth: "inherit", alignSelf: 'center' }}>
......@@ -23,8 +138,7 @@ export default class CreateUnitBisnis extends Component {
</div>
</div>
<div className="border-bottom grid grid-2x grid-mobile-none gap-15px" style={{ padding: 20 }}>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ padding: 20 }}>
<div className="column-1">
<div className="margin-bottom-20px">
<TextField
......@@ -34,7 +148,7 @@ export default class CreateUnitBisnis extends Component {
disabled
// id="outlined-read-only-input"
variant="filled"
value={1}
value={this.state.tempData == null? '' : this.state.tempData.role_id}
onChange={(e) => null}
>
{/* {periode.map((option) => (
......@@ -49,35 +163,32 @@ export default class CreateUnitBisnis extends Component {
<div className="column-2">
<div className="margin-bottom-20px">
<TextField
style={{ width: '100%'}}
id="standard-helperText"
label="Helper text"
defaultValue="Default Value"
style={{ width: '100%' , marginTop: 7}}
id="userRole"
name="role_name"
label="User Role"
value={this.state.tempData == null? '' : this.state.tempData.role_name}
onChange={(e) => this.handleChange(e)}
// defaultValue="Default Value"
// helperText="Some important text"
/>
</div>
</div>
</div>
<div className="border-bottom grid grid-2x grid-mobile-none gap-15px" style={{ padding: 20 }}>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-bottom-20px">
<TextField
style={{ width: '100%' }}
id="id"
label="ID"
disabled
// id="outlined-read-only-input"
variant="filled"
value={1}
onChange={(e) => null}
>
{/* {periode.map((option) => (
<MenuItem key={option.value} value={option.value}>
{option.label}
</MenuItem>
))} */}
</TextField>
style={{ width: '100%'}}
id="startDate"
label="Berlaku Mulai"
name="start_date"
value={this.state.tempData == null? '' : this.state.tempData.start_date}
defaultValue="Default Value"
onChange={(e) => this.handleChange(e)}
// helperText="Some important text"
/>
</div>
</div>
......@@ -85,27 +196,29 @@ export default class CreateUnitBisnis extends Component {
<div className="margin-bottom-20px">
<TextField
style={{ width: '100%'}}
id="standard-helperText"
label="Helper text"
id="endDate"
label="Berlaku Hingga"
name="end_date"
value={this.state.tempData == null? '' : this.state.tempData.end_date}
defaultValue="Default Value"
onChange={(e) => this.handleChange(e)}
// helperText="Some important text"
/>
</div>
</div>
</div>
<div className="border-bottom grid grid-2x grid-mobile-none gap-15px" style={{ padding: 20 }}>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-bottom-20px">
<TextField
style={{ width: '100%' }}
id="id"
label="ID"
id="status"
label="Status"
disabled
// id="outlined-read-only-input"
variant="filled"
value={1}
onChange={(e) => null}
value={this.state.tempData == null? '' : this.state.tempData.status}
>
{/* {periode.map((option) => (
<MenuItem key={option.value} value={option.value}>
......@@ -116,7 +229,71 @@ export default class CreateUnitBisnis extends Component {
</div>
</div>
</div>
<div style={{flexDirection:'column', display: 'flex', paddingLeft: 20, paddingRight: 20 }}>
<Typography style={{fontSize: 12}}>{`Dibuat : ${this.state.tempData == null? '' : this.state.tempData.created}`}</Typography>
<Typography style={{fontSize: 12}}>{`Diubah: ${this.state.tempData == null? '' : this.state.tempData.updated}`}</Typography>
</div>
<Divider style={{margin: 20}}/>
<div style={{paddingLeft: 20, paddingRight: 20}}>
<h5>Hak Akses</h5>
<div className="grid grid-2x grid-mobile-none gap-15px padding-top-5px padding-bottom-5px padding-left-10px padding-right-10px " style={{backgroundColor: '#4b4b4b'}}>
<div className="column-1">
<Typography style={{fontSize: 12, color: 'white'}}>Otorisasi Modul</Typography>
</div>
<div className="column-2 grid grid-3x content-center grid-mobile-none gap-15px">
<div className="column-1">
<Typography style={{fontSize: 12, color: 'white'}}>Lihat</Typography>
</div>
<div className="column-2">
<Typography style={{fontSize: 12, color: 'white'}}>Tambah</Typography>
</div>
<div className="column 3">
<Typography style={{fontSize: 12, color: 'white'}}>Ubah</Typography>
</div>
</div>
</div>
{this.state.menuData !== null && this.state.menuData.map((item,index) => {
return (
<div className="grid grid-2x grid-mobile-none gap-15px padding-left-10px padding-right-10px">
<div className="column-1" style={{display: 'flex', flexDirection: 'row', alignItems: 'center'}}>
<Checkbox
checked={this.handleItemChecked(item)}
onChange={() => this.handleItemClick(item)}
inputProps={{ 'aria-label': 'primary checkbox' }}
/>
<Typography style={{fontSize: 12}}>{item.menu_name}</Typography>
</div>
<div className="column-2 grid grid-3x content-center grid-mobile-none gap-15px">
<div className="column-1">
<Checkbox
// disabled={}
checked={this.handleSubItemChecked(item, 1)}
onChange={() => this.handleSubItemClick(item,1)}
inputProps={{ 'aria-label': 'primary checkbox' }}
/>
</div>
<div className="column-2">
<Checkbox
// disabled
checked={this.handleSubItemChecked(item, 2)}
onChange={() => this.handleSubItemClick(item,2)}
inputProps={{ 'aria-label': 'primary checkbox' }}
/>
</div>
<div className="column 3">
<Checkbox
// disabled
checked={this.handleSubItemChecked(item, 3)}
onChange={() => this.handleSubItemClick(item,3)}
inputProps={{ 'aria-label': 'primary checkbox' }}
/>
</div>
</div>
</div>
)
})}
</div>
<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' }}>
......
......@@ -13,9 +13,25 @@ class ResetPassword extends Component {
confirmPassword: '',
showPass: false,
showPass2: false,
userId: 0
}
}
componentDidMount() {
console.log(this.props.match.params.id)
let userId = this.props.match.params.id
this.setState({userId})
}
confirmPassword() {
let payload = {
"password": this.state.password,
"confirmPassword": this.state.confirmPassword,
"userId": this.state.userId
}
}
handleChange(e) {
let data = this.state
this.setState({...data, [e.target.name] : e.target.value})
......
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
......@@ -40,7 +40,7 @@ export default function BasicExample() {
{/* <Login/>
</PrivateRoute> */}
<Route path="/forgot-password" component={ForgotPassword} />
<Route path="/reset-password" component={ResetPassword} />
<Route path="/reset-password/:id" component={ResetPassword} />
<Route path="/email-verification" component={EmailVerification} />
<Route path="/register" component={Register}/>
<PrivateRoute path="/home">
......
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