Commit 43c55968 authored by EKSAD's avatar EKSAD

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

parents b09304c3 79d5557d
...@@ -2373,6 +2373,15 @@ ...@@ -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": { "aggregate-error": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.1.tgz", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.1.tgz",
...@@ -2692,6 +2701,11 @@ ...@@ -2692,6 +2701,11 @@
"resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz",
"integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==" "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": { "autoprefixer": {
"version": "9.8.6", "version": "9.8.6",
"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.8.6.tgz", "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.8.6.tgz",
...@@ -3667,6 +3681,16 @@ ...@@ -3667,6 +3681,16 @@
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" "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": { "chalk": {
"version": "2.4.2", "version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
...@@ -3897,6 +3921,22 @@ ...@@ -3897,6 +3921,22 @@
"resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" "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": { "collection-visit": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz",
...@@ -4176,6 +4216,15 @@ ...@@ -4176,6 +4216,15 @@
"parse-json": "^4.0.0" "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": { "create-ecdh": {
"version": "4.0.3", "version": "4.0.3",
"resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz", "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz",
...@@ -5813,6 +5862,11 @@ ...@@ -5813,6 +5862,11 @@
"resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz",
"integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=" "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": { "expand-brackets": {
"version": "2.1.4", "version": "2.1.4",
"resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz",
...@@ -6154,6 +6208,14 @@ ...@@ -6154,6 +6208,14 @@
"schema-utils": "^2.5.0" "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": { "filesize": {
"version": "6.0.1", "version": "6.0.1",
"resolved": "https://registry.npmjs.org/filesize/-/filesize-6.0.1.tgz", "resolved": "https://registry.npmjs.org/filesize/-/filesize-6.0.1.tgz",
...@@ -6356,6 +6418,11 @@ ...@@ -6356,6 +6418,11 @@
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
"integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" "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": { "fragment-cache": {
"version": "0.2.1", "version": "0.2.1",
"resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz",
...@@ -11231,6 +11298,11 @@ ...@@ -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": { "process": {
"version": "0.11.10", "version": "0.11.10",
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
...@@ -11749,11 +11821,31 @@ ...@@ -11749,11 +11821,31 @@
"scheduler": "^0.19.1" "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": { "react-error-overlay": {
"version": "6.0.7", "version": "6.0.7",
"resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.7.tgz", "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.7.tgz",
"integrity": "sha512-TAv1KJFh3RhqxNvhzxj6LeT5NWklP6rDr2a0jaTfsZ5wSZWHOGeqQyejUp3xxLfPt2UpyJEcVQB/zyPcmonNFA==" "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": { "react-is": {
"version": "16.13.1", "version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
...@@ -13180,6 +13272,14 @@ ...@@ -13180,6 +13272,14 @@
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" "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": { "sshpk": {
"version": "1.16.1", "version": "1.16.1",
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz",
...@@ -15307,6 +15407,27 @@ ...@@ -15307,6 +15407,27 @@
"async-limiter": "~1.0.0" "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": { "xml-name-validator": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz",
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
"react-bootstrap": "^1.3.0", "react-bootstrap": "^1.3.0",
"react-d3-donut": "^1.1.2", "react-d3-donut": "^1.1.2",
"react-dom": "^16.13.1", "react-dom": "^16.13.1",
"react-dropzone": "^11.0.2",
"react-excel-renderer": "^1.1.0",
"react-number-format": "^4.4.1", "react-number-format": "^4.4.1",
"react-router-dom": "^5.2.0", "react-router-dom": "^5.2.0",
"react-scripts": "3.4.1" "react-scripts": "3.4.1"
......
...@@ -69,12 +69,17 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/') ...@@ -69,12 +69,17 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
//Role //Role
const getRole = () => api.get('role/get_all_role') const getRole = () => api.get('role/get_all_role')
const getDetailRole = (roleId) => api.get(`role/get_role_by_id/${roleId}`) const getDetailRole = (roleId) => api.get(`role/get_role_by_id/${roleId}`)
const searchRole = (body) => api.get('/role/search_role', body)
const addRole = (body) => api.post('role/create_role', body) const addRole = (body) => api.post('role/create_role', body)
const editRole = (body) => api.post('role/update_role', body) const editRole = (body) => api.post('role/update_role', body)
const deleteRole = (roleId) => api.post(`role/delete_role/${roleId}`) const deleteRole = (roleId) => api.post(`role/delete_role/${roleId}`)
//Menu //Menu
const getMenu = () => api.get('menu/get_menu_hierarki') const getMenu = () => api.get('menu/get_menu_hierarki')
//UNIT BISNIS
const getUnitBisnis = () => api.get('business_unit/get_all_business_unit')
// ------ // ------
// STEP 3 // STEP 3
// ------ // ------
...@@ -95,10 +100,12 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/') ...@@ -95,10 +100,12 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
resetPassword, resetPassword,
getRole, getRole,
getDetailRole, getDetailRole,
searchRole,
addRole, addRole,
editRole, editRole,
deleteRole, deleteRole,
getMenu getMenu,
getUnitBisnis
} }
} }
......
...@@ -9,6 +9,9 @@ const Images = { ...@@ -9,6 +9,9 @@ const Images = {
manajemenDokumen: require('./docmanagement.svg'), manajemenDokumen: require('./docmanagement.svg'),
laporanBulanan: require('./laporanbulanan.svg'), laporanBulanan: require('./laporanbulanan.svg'),
laporan: require('./laporan.svg'), laporan: require('./laporan.svg'),
masterdata: require('./masterdata.svg'),
otorisasi: require('./otorisasi.svg'),
approvalmatrix: require('./approvalmatrix.svg'),
editCopy: require('./edit-copy.svg'), editCopy: require('./edit-copy.svg'),
editCopy2: require('./edit-copy-2.svg'), editCopy2: require('./edit-copy-2.svg'),
tia: require('./tia.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 @@ ...@@ -83,6 +83,24 @@
-ms-transition: all 0.35s cubic-bezier(0, 1, 0.5, 1); -ms-transition: all 0.35s cubic-bezier(0, 1, 0.5, 1);
-o-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); } 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 { .app-popup-show {
display: flex; display: flex;
-webkit-transition: all 0.35s cubic-bezier(0, 1, 0.5, 1); -webkit-transition: all 0.35s cubic-bezier(0, 1, 0.5, 1);
...@@ -6026,7 +6044,7 @@ ...@@ -6026,7 +6044,7 @@
background-color: #fff; background-color: #fff;
color: #394263; } color: #394263; }
.btn.btn-black { .btn.btn-black {
background-color: rgba(0, 0, 0, 0.1); background-color: #0d2846;
color: #fff; } color: #fff; }
.btn.btn-black:hover { .btn.btn-black:hover {
background-color: rgba(0, 0, 0, 0.54); background-color: rgba(0, 0, 0, 0.54);
...@@ -6635,7 +6653,7 @@ ...@@ -6635,7 +6653,7 @@
.upload-file { .upload-file {
position: relative; position: relative;
width: calc(100% - 30px); width: calc(100%);
padding: 15px; padding: 15px;
border-radius: 5px; border-radius: 5px;
background-color: rgba(85, 85, 85, 0.1); } background-color: rgba(85, 85, 85, 0.1); }
...@@ -6648,11 +6666,10 @@ ...@@ -6648,11 +6666,10 @@
color: #444444; } color: #444444; }
.upload-file .u-p-preview { .upload-file .u-p-preview {
position: relative; position: relative;
width: calc(100% - 30px);
padding: 15px; padding: 15px;
border-radius: 5px; border-radius: 5px;
margin: 15px 0; margin: 15px 0;
background-color: rgba(0, 0, 0, 0.84); } background-color: #51c6ea; }
.upload-file .u-p-top { .upload-file .u-p-top {
position: relative; position: relative;
width: 100%; width: 100%;
...@@ -194,7 +194,7 @@ export default function MiniDrawer() { ...@@ -194,7 +194,7 @@ export default function MiniDrawer() {
<div style={{ display: 'flex', justifyContent: 'space-between', flex: 1, padding: 10 }}> <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' }} /> <img src={Images.triputra} alt="React Logo" style={{ height: 31, width: 151, alignSelf: 'center' }} />
<IconButton onClick={handleDrawerClose}> <IconButton onClick={handleDrawerClose}>
{theme.direction === 'rtl' ? <ChevronRightIcon color={"white"} /> : <ChevronLeftIcon color={"white"} />} <ChevronLeftIcon style={{ fill: 'white' }} />
</IconButton> </IconButton>
</div> </div>
{open && {open &&
...@@ -225,15 +225,23 @@ export default function MiniDrawer() { ...@@ -225,15 +225,23 @@ export default function MiniDrawer() {
{item.subItem != null ? {item.subItem != null ?
<div style={{ justifyContent: 'space-between', flexDirection: 'row', display: 'flex', paddingRight: 10 }} onClick={() => selectedIndex == 0 ? setSelectedIndex(index) : setSelectedIndex(0)}> <div style={{ justifyContent: 'space-between', flexDirection: 'row', display: 'flex', paddingRight: 10 }} onClick={() => selectedIndex == 0 ? setSelectedIndex(index) : setSelectedIndex(0)}>
<ListItem button key={item.label}> <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> <Typography style={{ color: 'white', fontSize: 12 }}>{item.label}</Typography>
</ListItem> </ListItem>
{item.subItem != null ? (index === selectedIndex ? <ExpandLess style={{ color: "white", marginLeft: 50, alignSelf: 'center' }} /> : <ExpandMore style={{ color: "white", marginLeft: 50, alignSelf: 'center' }} />) : null} {item.subItem != null ? (index === selectedIndex ? <ExpandLess style={{ color: "white", marginLeft: 50, alignSelf: 'center' }} /> : <ExpandMore style={{ color: "white", marginLeft: 50, alignSelf: 'center' }} />) : null}
</div> </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}`}> <Link to={`${url}/${item.path}`}>
<ListItem button key={item.label} onClick={() => setSelectedIndex(index)}> <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> <Typography style={{ color: 'white', fontSize: 12 }}>{item.label}</Typography>
</ListItem> </ListItem>
</Link> </Link>
......
This diff is collapsed.
...@@ -6,6 +6,7 @@ import Images from '../../../assets/Images'; ...@@ -6,6 +6,7 @@ import Images from '../../../assets/Images';
import MUIDataTable from "mui-datatables"; import MUIDataTable from "mui-datatables";
import { render } from '@testing-library/react'; import { render } from '@testing-library/react';
import { TextField, InputBase } from "@material-ui/core"; import { TextField, InputBase } from "@material-ui/core";
import CreatePerusahaan from "../Perusahaan/CreatePerusahaan";
var ct = require("../../../library/CustomTable"); var ct = require("../../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable()); const getMuiTheme = () => createMuiTheme(ct.customTable());
...@@ -70,7 +71,7 @@ export default class Perusahaan extends Component { ...@@ -70,7 +71,7 @@ export default class Perusahaan extends Component {
} }
} }
}, { }, {
name: "Nama Perusahaan", name: "Parent Company",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
...@@ -163,6 +164,19 @@ export default class Perusahaan extends Component { ...@@ -163,6 +164,19 @@ export default class Perusahaan extends Component {
</div> </div>
</div> </div>
{this.state.visibleCreate && (
<CreatePerusahaan
onClickClose={() => this.setState({ visibleCreate: false })}
/>
)}
{this.state.visibleEdit && (
<CreatePerusahaan
type={"edit"}
onClickClose={() => this.setState({ visibleEdit: false })}
data={this.state.data}
/>
)}
</div> </div>
); );
} }
......
This diff is collapsed.
...@@ -6,19 +6,57 @@ import Images from "../../assets/Images"; ...@@ -6,19 +6,57 @@ import Images from "../../assets/Images";
import MUIDataTable from "mui-datatables"; import MUIDataTable from "mui-datatables";
import AddRole from './UserRole/AddRole'; import AddRole from './UserRole/AddRole';
import EditRole from './UserRole/EditRole' import EditRole from './UserRole/EditRole'
import api from "../../api";
import { titleCase } from "../../library/Utils";
var ct = require("../../library/CustomTable"); var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable()); const getMuiTheme = () => createMuiTheme(ct.customTable());
const options = ct.customOptions(); const options = ct.customOptions();
export default class User extends Component { export default class UserRole extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
listRole: [],
indexData: {},
add: false, add: false,
edit: false edit: false
} }
} }
componentDidMount() {
this.getRole()
}
closeEdit() {
this.setState({edit: false})
}
closeAdd() {
this.setState({add: false})
}
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) => {
return [index, item.role_id, item.role_name, item.access, item.status]
})
console.log(listData)
this.setState({listRole: listData})
// this.setState({listRole: response.data.data}, () => {
// console.log(this.state.listRole)
// })
} else {
alert(response.data.message)
}
console.log(response.data.data)
})
}
render() { render() {
const columns = [{ const columns = [{
name: "Action", name: "Action",
...@@ -32,7 +70,8 @@ export default class User extends Component { ...@@ -32,7 +70,8 @@ export default class User extends Component {
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
}} }}
onClick={() => this.setState({edit: true})} // onClick={() => console.log(tableMeta.rowData[1])}
onClick={() => this.setState({edit: true, indexData: tableMeta.rowData[1]})}
> >
<img src={Images.editCopy} /> <img src={Images.editCopy} />
</button> </button>
...@@ -52,23 +91,56 @@ export default class User extends Component { ...@@ -52,23 +91,56 @@ export default class User extends Component {
} }
} }
}, { }, {
name: "User Role", name: "Nama Lengkap",
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex', width: 200 }}>
{titleCase(val)}
</div >
);
}
}
}, {
name: "Email",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ display: 'flex', width: 250 }}> <div style={{ display: 'flex', width: 150 }}>
{titleCase(val)}
</div >
);
}
}
}, {
name: "Role",
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex', width: 100 }}>
{titleCase(val)}
</div >
);
}
}
}, {
name: "Perusahaan",
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex'}}>
{val} {val}
</div > </div >
); );
} }
} }
}, "Hak Akses", "Status"] }, "Status"]
const data = [ const data = [
["1", "1", "Laporan Bulanan - September 2020", "1 (20 Oktober 2020)", "Belum Disetujui"], ["1", "1", "Juki Kudet", "Juki@gmail.com)", "Admin", "Kepo", "Aktif"],
["2", "2", "Laporan Bulanan - September 2020", "1 (20 Oktober 2020)", "Belum Disetujui"], ["1", "2", "Kuji Mama", "Loro@gmail.com)", "Admin", "Kepo", "Aktif"],
["3", "3", "Budget Tahunan 2021", "0 (20 Oktober 2020)", "Belum Disetujui"], ["1", "3", "Sutaru", "Jaka@gmail.com)", "Admin", "Kepo", "Aktif"],
["4", "4", "Laporan Bulanan - September 2020", "0 (20 Oktober 2020)", "Belum Disetujui"], ["1", "4", "Tatang Katro", "ikup@gmail.com)", "Admin", "Kepo", "Aktif"],
["5", "5", "Budget Tahunan 2021", "0 (20 Oktober 2020)", "Belum Disetujui"], ["1", "5", "Firman", "Sudir@gmail.com)", "Admin", "Kepo", "Aktif"],
] ]
return ( return (
<div style={{ height: this.props.height }}> <div style={{ height: this.props.height }}>
...@@ -80,7 +152,7 @@ export default class User extends Component { ...@@ -80,7 +152,7 @@ export default class User extends Component {
<div style={{width: '60%', justifyContent: 'center', display: 'flex', borderWidth: 2, alignItems: 'center' }}> <div style={{width: '60%', justifyContent: 'center', display: 'flex', borderWidth: 2, alignItems: 'center' }}>
<div style={{width: '50%', backgroundColor:'white', padding: 10, borderRadius: 7.5, flexDirection: 'row', display: 'flex'}}> <div style={{width: '50%', backgroundColor:'white', padding: 10, borderRadius: 7.5, flexDirection: 'row', display: 'flex'}}>
<SearchIcon/> <SearchIcon/>
<input type="text" style={{flexGrow: 1, marginLeft: 10}}/> <input type="text" placeholder={'Search Role'} style={{flexGrow: 1, marginLeft: 10}}/>
</div> </div>
</div> </div>
{/* <label style={{ color: 'white', width: '60%', justifyContent: 'center', display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center' }}>Search</label> */} {/* <label style={{ color: 'white', width: '60%', justifyContent: 'center', display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center' }}>Search</label> */}
...@@ -98,8 +170,18 @@ export default class User extends Component { ...@@ -98,8 +170,18 @@ export default class User extends Component {
</MuiThemeProvider> </MuiThemeProvider>
</div> </div>
</div> </div>
{this.state.add && <AddRole/>} {this.state.add && (
{this.state.edit && <EditRole/>} <AddRole
onClickClose={this.closeAdd.bind(this)}
data={this.state.indexData}
/>
)}
{this.state.edit && (
<EditRole
onClickClose={this.closeEdit.bind(this)}
data={this.state.indexData}
/>
)}
</div> </div>
); );
} }
......
This diff is collapsed.
This diff is collapsed.
import React, { Component } from "react"; import React, { Component, memo } from "react";
import { Container, Row, Col } from "react-bootstrap"; import { Container, Row, Col } from "react-bootstrap";
import { makeStyles, createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles'; import { makeStyles, createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles';
import SearchIcon from '@material-ui/icons/Search'; import SearchIcon from '@material-ui/icons/Search';
...@@ -8,19 +8,22 @@ import AddRole from './UserRole/AddRole'; ...@@ -8,19 +8,22 @@ import AddRole from './UserRole/AddRole';
import EditRole from './UserRole/EditRole' import EditRole from './UserRole/EditRole'
import api from "../../api"; import api from "../../api";
import { titleCase } from "../../library/Utils"; import { titleCase } from "../../library/Utils";
import InputAdornment from '@material-ui/core/InputAdornment';
import TextField from '@material-ui/core/TextField';
import AccountCircle from '@material-ui/icons/AccountCircle';
var ct = require("../../library/CustomTable"); var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable()); const getMuiTheme = () => createMuiTheme(ct.customTable());
const options = ct.customOptions(); const options = ct.customOptions();
export default class UserRole extends Component { class UserRole extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
listRole: [], listRole: [],
indexData: {}, indexData: {},
add: false, add: false,
edit: false edit: false,
search: ''
} }
} }
...@@ -44,7 +47,7 @@ export default class UserRole extends Component { ...@@ -44,7 +47,7 @@ export default class UserRole extends Component {
let listData = data.map((item,index) => { let listData = data.map((item,index) => {
return [index, item.role_id, item.role_name, item.access, item.status] return [index, item.role_id, item.role_name, item.access, item.status]
}) })
console.log(listData) // console.log(listData)
this.setState({listRole: listData}) this.setState({listRole: listData})
// this.setState({listRole: response.data.data}, () => { // this.setState({listRole: response.data.data}, () => {
// console.log(this.state.listRole) // console.log(this.state.listRole)
...@@ -53,10 +56,30 @@ export default class UserRole extends Component { ...@@ -53,10 +56,30 @@ export default class UserRole extends Component {
} else { } else {
alert(response.data.message) alert(response.data.message)
} }
console.log(response.data.data) // console.log(response.data.data)
})
}
searchRole() {
let payload = {
"keyword": this.state.search
}
api.create().searchRole(payload).then((response) => {
// console.log(response.data.data)
}) })
} }
_handleKeyDown(e) {
if (e.key === 'Enter') {
// console.log('do validate');
}
}
handleChange(e) {
let data = this.state
window.requestIdleCallback((e) => this.setState({...data, [e.target.name]: e.target.value}))
}
render() { render() {
const columns = [{ const columns = [{
name: "Action", name: "Action",
...@@ -128,9 +151,32 @@ export default class UserRole extends Component { ...@@ -128,9 +151,32 @@ export default class UserRole extends Component {
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -150 }}> <div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -150 }}>
<label style={{ color: 'white', width: '20%', alignSelf: 'center'}}>Master Data - Role & Otorisasi</label> <label style={{ color: 'white', width: '20%', alignSelf: 'center'}}>Master Data - Role & Otorisasi</label>
<div style={{width: '60%', justifyContent: 'center', display: 'flex', borderWidth: 2, alignItems: 'center' }}> <div style={{width: '60%', justifyContent: 'center', display: 'flex', borderWidth: 2, alignItems: 'center' }}>
<div style={{width: '50%', backgroundColor:'white', padding: 10, borderRadius: 7.5, flexDirection: 'row', display: 'flex'}}> <div style={{width: '50%', backgroundColor:'white', padding: 10, borderRadius: 7.5}}>
<SearchIcon/> {/* <SearchIcon/> */}
<input type="text" placeholder={'Search Role'} style={{flexGrow: 1, marginLeft: 10}}/> <TextField
// className={classes.margin}
id="input-with-icon-textfield"
// label="TextField"
name="search"
value={this.state.search}
placeholder={'Search Role'}
onChange={(e) => {
// let { search } = this.state;
// search = [...search];
// search.push(e.target.value);
// search[0] = search;
this.setState({ search: e.target.value });
}}
style={{width: '100%', borderBottomWidth: 0, borderBottomColor: 'red'}}
InputProps={{
startAdornment: (
<InputAdornment position="start">
<SearchIcon />
</InputAdornment>
),
}}
/>
</div> </div>
</div> </div>
{/* <label style={{ color: 'white', width: '60%', justifyContent: 'center', display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center' }}>Search</label> */} {/* <label style={{ color: 'white', width: '60%', justifyContent: 'center', display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center' }}>Search</label> */}
...@@ -164,3 +210,5 @@ export default class UserRole extends Component { ...@@ -164,3 +210,5 @@ export default class UserRole extends Component {
); );
} }
} }
export default memo(UserRole);
\ No newline at end of file
This diff is collapsed.
import React, { Component } from 'react'; import React, { Component } from 'react';
import { TextField, Divider, Typography, Checkbox } from '@material-ui/core'; import { TextField, Divider, Typography, Checkbox, withStyles } from '@material-ui/core';
import api from '../../../api'; import api from '../../../api';
const CustomCheckbox = withStyles({
root: {
color: '#51c6ea',
'&$checked': {
color: '#51c6ea',
},
},
checked: {},
})((props) => <Checkbox color="default" {...props} />);
export default class EditRole extends Component { export default class EditRole extends Component {
constructor(props) { constructor(props) {
...@@ -91,7 +101,7 @@ export default class EditRole extends Component { ...@@ -91,7 +101,7 @@ export default class EditRole extends Component {
value = false value = false
} else { } else {
let arrayButton = this.state.privileges[indexID].button_id let arrayButton = this.state.privileges[indexID].button_id
console.log(arrayButton) // console.log(arrayButton)
let indexButtonID = this.state.privileges[indexID].button_id.findIndex((val) => val == index) let indexButtonID = this.state.privileges[indexID].button_id.findIndex((val) => val == index)
// console.log(indexButtonID) // console.log(indexButtonID)
if (indexButtonID == -1) { if (indexButtonID == -1) {
...@@ -253,40 +263,37 @@ export default class EditRole extends Component { ...@@ -253,40 +263,37 @@ export default class EditRole extends Component {
</div> </div>
</div> </div>
<div style={{height: '25vh', overflow: 'scroll'}}>
{this.state.menuData !== null && this.state.menuData.map((item,index) => { {this.state.menuData !== null && this.state.menuData.map((item,index) => {
return ( return (
<div className="grid grid-2x grid-mobile-none gap-15px padding-left-10px padding-right-10px"> <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'}}> <div className="column-1" style={{display: 'flex', flexDirection: 'row', alignItems: 'center'}}>
<Checkbox <CustomCheckbox
checked={this.handleItemChecked(item)} checked={this.handleItemChecked(item)}
onChange={() => this.handleItemClick(item)} onChange={() => this.handleItemClick(item)}
inputProps={{ 'aria-label': 'primary checkbox' }}
/> />
<Typography style={{fontSize: 12}}>{item.menu_name}</Typography> <Typography style={{fontSize: 12}}>{item.menu_name}</Typography>
</div> </div>
<div className="column-2 grid grid-3x content-center grid-mobile-none gap-15px"> <div className="column-2 grid grid-3x content-center grid-mobile-none gap-15px">
<div className="column-1"> <div className="column-1">
<Checkbox <CustomCheckbox
// disabled={} // disabled={}
checked={this.handleSubItemChecked(item, 1)} checked={this.handleSubItemChecked(item, 1)}
onChange={() => this.handleSubItemClick(item,1)} onChange={() => this.handleSubItemClick(item,1)}
inputProps={{ 'aria-label': 'primary checkbox' }}
/> />
</div> </div>
<div className="column-2"> <div className="column-2">
<Checkbox <CustomCheckbox
// disabled // disabled
checked={this.handleSubItemChecked(item, 2)} checked={this.handleSubItemChecked(item, 2)}
onChange={() => this.handleSubItemClick(item,2)} onChange={() => this.handleSubItemClick(item,2)}
inputProps={{ 'aria-label': 'primary checkbox' }}
/> />
</div> </div>
<div className="column 3"> <div className="column 3">
<Checkbox <CustomCheckbox
// disabled // disabled
checked={this.handleSubItemChecked(item, 3)} checked={this.handleSubItemChecked(item, 3)}
onChange={() => this.handleSubItemClick(item,3)} onChange={() => this.handleSubItemClick(item,3)}
inputProps={{ 'aria-label': 'primary checkbox' }}
/> />
</div> </div>
</div> </div>
...@@ -294,6 +301,8 @@ export default class EditRole extends Component { ...@@ -294,6 +301,8 @@ export default class EditRole extends Component {
) )
})} })}
</div> </div>
</div>
<div className="border-top grid grid-2x" style={{ height: 56, backgroundColor: '#f5f5f5', paddingLeft: 20, paddingRight: 20 }}> <div className="border-top grid grid-2x" style={{ height: 56, backgroundColor: '#f5f5f5', paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1" style={{ alignSelf: 'center' }}> <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' }}> <div style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
......
import Images from "../assets/Images";
const arraySide = [ const arraySide = [
{ {
img: '', img: Images.Home,
label: 'Beranda', label: 'Beranda',
path: 'beranda', path: 'beranda',
subItem: null subItem: null
}, },
{ {
img: '', img: Images.budgetTahunan,
label: 'Budget Tahunan', label: 'Budget Tahunan',
path: 'budget-tahunan', path: 'budget-tahunan',
subItem: null subItem: null
}, },
{ {
img: '', img: Images.laporanBulanan,
label: 'Laporan Bulanan', label: 'Laporan Bulanan',
path: 'beranda', path: 'beranda',
subItem: null subItem: null
}, },
{ {
img: '', img: Images.manajemenDokumen,
label: 'Manajemen Dokumen', label: 'Manajemen Dokumen',
path: 'beranda', path: 'beranda',
subItem: null subItem: null
}, },
{ {
img: '', img: Images.laporan,
label: 'Laporan', label: 'Laporan',
path: '', path: '',
subItem: [ subItem: [
...@@ -52,7 +54,7 @@ const arraySide = [ ...@@ -52,7 +54,7 @@ const arraySide = [
subItem: null subItem: null
}, },
{ {
img: '', img: Images.masterdata,
label: 'Master Data', label: 'Master Data',
path: '', path: '',
subItem: [ subItem: [
...@@ -84,7 +86,7 @@ const arraySide = [ ...@@ -84,7 +86,7 @@ const arraySide = [
] ]
}, },
{ {
img: '', img: Images.otorisasi,
label: 'Otorisasi', label: 'Otorisasi',
path: '', path: '',
subItem: [ subItem: [
...@@ -101,7 +103,7 @@ const arraySide = [ ...@@ -101,7 +103,7 @@ const arraySide = [
] ]
}, },
{ {
img: '', img: Images.approvalmatrix,
label: 'Approval Matrix', label: 'Approval Matrix',
path: 'approval-matrix', path: 'approval-matrix',
subItem: null subItem: null
......
...@@ -320,6 +320,20 @@ exports.customOptions = function () { ...@@ -320,6 +320,20 @@ exports.customOptions = function () {
} }
} }
exports.customOptions2 = function () {
return {
// selectableRows: false,
selectableRows: 'none',
filterType: 'multiselect',
responsive: 'scrollMaxHeight',
rowsPerPage: 5,
rowsPerPageOptions: [5, 10, 20, 50],
print: false,
download: false,
elevation: 5,
}
}
exports.customOptionsFixedColumn = function () { exports.customOptionsFixedColumn = function () {
return { return {
// selectableRows: false, // selectableRows: false,
......
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