Commit 3a73dc83 authored by EKSAD's avatar EKSAD

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

parents 479478bf b98fc12c
...@@ -176,6 +176,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -176,6 +176,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
// MANAGEMENT DOCUMENT // MANAGEMENT DOCUMENT
const getDocumentCategory = () => api.get('document_category/get_all_document_category') const getDocumentCategory = () => api.get('document_category/get_all_document_category')
const getAllDocument = (body) => api.post('document/get_all_document', body) const getAllDocument = (body) => api.post('document/get_all_document', body)
const uploadDocument = (body) => api.post('document/upload_document', body)
// ------ // ------
// STEP 3 // STEP 3
...@@ -281,7 +282,8 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -281,7 +282,8 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
deletePerusahaan, deletePerusahaan,
deleteReportItems, deleteReportItems,
getDocumentCategory, getDocumentCategory,
getAllDocument getAllDocument,
uploadDocument
} }
} }
......
...@@ -45,6 +45,7 @@ export default class ApprovalMatrix extends Component { ...@@ -45,6 +45,7 @@ export default class ApprovalMatrix extends Component {
messageAlert: '', messageAlert: '',
btncreate: false, btncreate: false,
btnedit: false, btnedit: false,
btndelete: false,
load: false, load: false,
judul: '', judul: '',
popupDel: false, popupDel: false,
...@@ -68,7 +69,7 @@ export default class ApprovalMatrix extends Component { ...@@ -68,7 +69,7 @@ export default class ApprovalMatrix extends Component {
payload.push({ payload.push({
id: index + 1, id: index + 1,
approval_type_name: item[0] === undefined ? "" : item[0], approval_type_name: item[0] === undefined ? "" : item[0],
orders: item[1] === undefined ? "" : item[1], orders: item[1] === undefined ? null: item[1],
email: item[2] === undefined ? "" : item[2], email: item[2] === undefined ? "" : item[2],
// fullname: item[2] === undefined ? "" : item[2], // fullname: item[2] === undefined ? "" : item[2],
operator_type_name: item[3] === undefined ? "" : item[3], operator_type_name: item[3] === undefined ? "" : item[3],
...@@ -146,9 +147,9 @@ export default class ApprovalMatrix extends Component { ...@@ -146,9 +147,9 @@ export default class ApprovalMatrix extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[7] != null && check > -1 ? {tableMeta.rowData[7] != null && check > -1 ?
<a data-tip={tableMeta.rowData[7][check].message} data-for="order"> <a data-tip={tableMeta.rowData[7][check].message} data-for="order">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === null ? "Empty" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === null ? "Empty" : val}</span>
} }
<ReactTooltip border={true} id="order" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="order" place="bottom" type="light" effect="solid" />
</div > </div >
...@@ -334,6 +335,7 @@ export default class ApprovalMatrix extends Component { ...@@ -334,6 +335,7 @@ export default class ApprovalMatrix extends Component {
this.setState({ this.setState({
btncreate: response.data.data.create, btncreate: response.data.data.create,
btnedit: response.data.data.edit, btnedit: response.data.data.edit,
btndelete: response.data.data.delete,
load: true load: true
}) })
} else { } else {
...@@ -610,8 +612,8 @@ export default class ApprovalMatrix extends Component { ...@@ -610,8 +612,8 @@ export default class ApprovalMatrix extends Component {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
console.log(tableMeta) console.log(tableMeta)
return ( return (
this.state.btnedit && (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{this.state.btnedit && <span>
<a data-tip={'Edit'} data-for="edit"> <a data-tip={'Edit'} data-for="edit">
<button <button
style={{ style={{
...@@ -627,6 +629,8 @@ export default class ApprovalMatrix extends Component { ...@@ -627,6 +629,8 @@ export default class ApprovalMatrix extends Component {
</button> </button>
</a> </a>
<ReactTooltip border={true} id="edit" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="edit" place="bottom" type="light" effect="solid" />
</span>}
{this.state.btndelete && <span>
<a data-tip={'Delete'} data-for="delete"> <a data-tip={'Delete'} data-for="delete">
<button <button
style={{ style={{
...@@ -641,8 +645,8 @@ export default class ApprovalMatrix extends Component { ...@@ -641,8 +645,8 @@ export default class ApprovalMatrix extends Component {
</button> </button>
</a> </a>
<ReactTooltip border={true} id="delete" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="delete" place="bottom" type="light" effect="solid" />
</span>}
</div > </div >
)
); );
} }
} }
......
...@@ -2,6 +2,7 @@ import React, { Component } from 'react' ...@@ -2,6 +2,7 @@ import React, { Component } from 'react'
import MUIDataTable from 'mui-datatables' import MUIDataTable from 'mui-datatables'
import { createMuiTheme, MuiThemeProvider } from '@material-ui/core'; import { createMuiTheme, MuiThemeProvider } from '@material-ui/core';
import api from '../../api'; import api from '../../api';
import CreateManagementDoc from './CreateManagementDoc';
var ct = require("../../library/CustomTable"); var ct = require("../../library/CustomTable");
...@@ -12,7 +13,8 @@ export default class AuditTahunan extends Component { ...@@ -12,7 +13,8 @@ export default class AuditTahunan extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
dataTable: [] dataTable: [],
visibleCreate: false
} }
} }
...@@ -50,17 +52,6 @@ export default class AuditTahunan extends Component { ...@@ -50,17 +52,6 @@ export default class AuditTahunan extends Component {
] ]
return ( return (
<div style={{ width: '100%' }}> <div style={{ width: '100%' }}>
<div style={{ display: 'grid', justifyContent: 'flex-end' }}>
<button
type="button"
onClick={() => null}
style={{ marginRight: 25 }}
>
<div style={{ width: 150, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#fff', fontSize: 11 }}>Add</span>
</div>
</button>
</div>
<div style={{ padding: 25 }}> <div style={{ padding: 25 }}>
<MuiThemeProvider theme={getMuiTheme()}> <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
......
This diff is collapsed.
...@@ -5,6 +5,7 @@ import Images from '../../assets/Images' ...@@ -5,6 +5,7 @@ import Images from '../../assets/Images'
import ManualBookTia from './ManualBookTia' import ManualBookTia from './ManualBookTia'
import api from '../../api' import api from '../../api'
import AuditTahunan from './AuditTahunan' import AuditTahunan from './AuditTahunan'
import CreateManagementDoc from './CreateManagementDoc'
export default class DocumentManagement extends Component { export default class DocumentManagement extends Component {
constructor(props) { constructor(props) {
...@@ -47,6 +48,17 @@ export default class DocumentManagement extends Component { ...@@ -47,6 +48,17 @@ export default class DocumentManagement extends Component {
</div> </div>
<div style={{ padding: 20 }}> <div style={{ padding: 20 }}>
<Paper style={{ padding: 20 }}> <Paper style={{ padding: 20 }}>
<div style={{ display: 'grid', justifyContent: 'flex-end' }}>
<button
type="button"
onClick={() => this.setState({ visibleCreate: true })}
style={{ marginRight: 25 }}
>
<div style={{ width: 150, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#fff', fontSize: 11 }}>Add</span>
</div>
</button>
</div>
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<Tabs <Tabs
orientation="vertical" orientation="vertical"
...@@ -79,6 +91,11 @@ export default class DocumentManagement extends Component { ...@@ -79,6 +91,11 @@ export default class DocumentManagement extends Component {
</Paper> </Paper>
</div> </div>
{this.state.visibleCreate && (
<CreateManagementDoc
onClickClose={() => this.setState({ visibleCreate: false })}
/>
)}
</div> </div>
) )
} }
......
...@@ -21,17 +21,6 @@ export default class ManualBookTia extends Component { ...@@ -21,17 +21,6 @@ export default class ManualBookTia extends Component {
] ]
return ( return (
<div style={{ width: '100%' }}> <div style={{ width: '100%' }}>
<div style={{ display: 'grid', justifyContent: 'flex-end' }}>
<button
type="button"
onClick={() => null}
style={{ marginRight: 25 }}
>
<div style={{ width: 150, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#fff', fontSize: 11 }}>Add</span>
</div>
</button>
</div>
<div style={{ padding: 25 }}> <div style={{ padding: 25 }}>
<MuiThemeProvider theme={getMuiTheme()}> <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
......
...@@ -58,9 +58,6 @@ export default class CreateParameter extends Component { ...@@ -58,9 +58,6 @@ export default class CreateParameter extends Component {
componentDidMount() { componentDidMount() {
if (this.props.type === 'edit') { if (this.props.type === 'edit') {
this.setState({
getSettingTypeID: this.props.data[0],
})
this.getDetailParameter() this.getDetailParameter()
} else { } else {
let date = format(new Date, 'yyyy-MM-dd') let date = format(new Date, 'yyyy-MM-dd')
...@@ -85,6 +82,7 @@ export default class CreateParameter extends Component { ...@@ -85,6 +82,7 @@ export default class CreateParameter extends Component {
getSettingGroupID: response.data.data.setting_group_id, getSettingGroupID: response.data.data.setting_group_id,
getCompanyID: data.company_id, getCompanyID: data.company_id,
settingType: data.setting_type, settingType: data.setting_type,
getSettingTypeID: data.setting_type_id
}, () => { }, () => {
this.getAllGroup() this.getAllGroup()
this.getPerusahaan() this.getPerusahaan()
...@@ -169,7 +167,7 @@ export default class CreateParameter extends Component { ...@@ -169,7 +167,7 @@ export default class CreateParameter extends Component {
options: perusahaanData, options: perusahaanData,
getOptionLabel: (option) => option.company_name, getOptionLabel: (option) => option.company_name,
}; };
this.setState({ perusahaan: typeProps, perusahaanData: response.data.data, getPerusahaan: index == -1 ? null : perusahaanData[index], msgErrorPerusahaan: index === -1 ? 'Company has been inactive' : "", errorPerusahaan: index === -1 ? true : false }) this.setState({ perusahaan: typeProps, perusahaanData: response.data.data, getPerusahaan: index == -1 ? null : perusahaanData[index], msgErrorPerusahaan: index === -1 ? 'Company has been Inactive' : "", errorPerusahaan: index === -1 ? true : false })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) { if (response.data.message.includes("Someone Logged In")) {
...@@ -283,7 +281,7 @@ export default class CreateParameter extends Component { ...@@ -283,7 +281,7 @@ export default class CreateParameter extends Component {
options: typeData, options: typeData,
getOptionLabel: (option) => option.setting_type_name, getOptionLabel: (option) => option.setting_type_name,
}; };
this.setState({ enableParameter: true, parameter: typeProps, parameterData: response.data.data, getParameter: index == -1 ? typeData[0] : typeData[index] }) this.setState({ enableParameter: true, parameter: typeProps, parameterData: response.data.data, getParameter: index == -1 ? null : typeData[index] })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) { if (response.data.message.includes("Someone Logged In")) {
......
...@@ -36,6 +36,7 @@ export default class Parameter extends Component { ...@@ -36,6 +36,7 @@ export default class Parameter extends Component {
messageAlert: '', messageAlert: '',
create: false, create: false,
edit: false, edit: false,
delete: false,
load: false, load: false,
judul: '' judul: ''
} }
...@@ -58,6 +59,7 @@ export default class Parameter extends Component { ...@@ -58,6 +59,7 @@ export default class Parameter extends Component {
this.setState({ this.setState({
create: response.data.data.create, create: response.data.data.create,
edit: response.data.data.edit, edit: response.data.data.edit,
delete: response.data.data.delete,
load: true load: true
}) })
} else { } else {
...@@ -682,8 +684,9 @@ export default class Parameter extends Component { ...@@ -682,8 +684,9 @@ export default class Parameter extends Component {
filter: false, filter: false,
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
this.state.edit && (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{this.state.edit &&
<span>
<a data-tip={'Edit'} data-for="edit"> <a data-tip={'Edit'} data-for="edit">
<button <button
style={{ style={{
...@@ -699,6 +702,10 @@ export default class Parameter extends Component { ...@@ -699,6 +702,10 @@ export default class Parameter extends Component {
</button> </button>
</a> </a>
<ReactTooltip border={true} id="edit" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="edit" place="bottom" type="light" effect="solid" />
</span>
}
{this.state.delete &&
<span>
<a data-tip={'Delete'} data-for="delete"> <a data-tip={'Delete'} data-for="delete">
<button <button
style={{ style={{
...@@ -713,8 +720,10 @@ export default class Parameter extends Component { ...@@ -713,8 +720,10 @@ export default class Parameter extends Component {
</button> </button>
</a> </a>
<ReactTooltip border={true} id="delete" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="delete" place="bottom" type="light" effect="solid" />
</span>
}
</div > </div >
)
); );
} }
} }
......
...@@ -143,7 +143,7 @@ export default class CreatePerusahaan extends Component { ...@@ -143,7 +143,7 @@ export default class CreatePerusahaan extends Component {
options: perusahaanData, options: perusahaanData,
getOptionLabel: (option) => option.company_name, getOptionLabel: (option) => option.company_name,
}; };
this.setState({ perusahaan: typeProps, perusahaanData: response.data.data, getPerusahaan: index == -1 ? null : perusahaanData[index] }) this.setState({ perusahaan: typeProps, perusahaanData: response.data.data, getPerusahaan: index == -1 ? null : perusahaanData[index], msgErrorPC: index === -1 ? 'Company has been Inactive' : "", errorPC: index === -1 ? true : false })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) { if (response.data.message.includes("Someone Logged In")) {
...@@ -183,7 +183,7 @@ export default class CreatePerusahaan extends Component { ...@@ -183,7 +183,7 @@ export default class CreatePerusahaan extends Component {
options: typeData, options: typeData,
getOptionLabel: (option) => option.business_unit_name, getOptionLabel: (option) => option.business_unit_name,
}; };
this.setState({ types: typeProps, typeData: response.data.data, getTypes: index == -1 ? null : typeData[index] }) this.setState({ types: typeProps, typeData: response.data.data, getTypes: index == -1 ? null : typeData[index], msgErrorUB: index === -1 ? 'Business Unit has been Inactive' : "", errorUB: index === -1 ? true : false })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) { if (response.data.message.includes("Someone Logged In")) {
......
...@@ -49,6 +49,7 @@ export default class Perusahaan extends Component { ...@@ -49,6 +49,7 @@ export default class Perusahaan extends Component {
messageAlert: '', messageAlert: '',
create: false, create: false,
edit: false, edit: false,
delete: false,
load: false, load: false,
judul: '', judul: '',
rowData: [], rowData: [],
...@@ -281,6 +282,7 @@ export default class Perusahaan extends Component { ...@@ -281,6 +282,7 @@ export default class Perusahaan extends Component {
this.setState({ this.setState({
create: response.data.data.create, create: response.data.data.create,
edit: response.data.data.edit, edit: response.data.data.edit,
delete: response.data.data.delete,
load: true load: true
}) })
} else { } else {
...@@ -525,8 +527,9 @@ export default class Perusahaan extends Component { ...@@ -525,8 +527,9 @@ export default class Perusahaan extends Component {
sort: false, sort: false,
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
this.state.edit && (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{this.state.edit &&
<span>
<a data-tip={'Edit'} data-for="edit"> <a data-tip={'Edit'} data-for="edit">
<button <button
style={{ style={{
...@@ -546,6 +549,10 @@ export default class Perusahaan extends Component { ...@@ -546,6 +549,10 @@ export default class Perusahaan extends Component {
</button> </button>
</a> </a>
<ReactTooltip border={true} id="edit" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="edit" place="bottom" type="light" effect="solid" />
</span>
}
{this.state.delete &&
<span>
<a data-tip={'Delete'} data-for="delete"> <a data-tip={'Delete'} data-for="delete">
<button <button
style={{ style={{
...@@ -566,8 +573,9 @@ export default class Perusahaan extends Component { ...@@ -566,8 +573,9 @@ export default class Perusahaan extends Component {
</button> </button>
</a> </a>
<ReactTooltip border={true} id="delete" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="delete" place="bottom" type="light" effect="solid" />
</span>
}
</div> </div>
)
); );
} }
} }
......
...@@ -44,6 +44,7 @@ export default class ReportItems extends Component { ...@@ -44,6 +44,7 @@ export default class ReportItems extends Component {
messageAlert: '', messageAlert: '',
buttonCreate: false, buttonCreate: false,
buttonEdit: false, buttonEdit: false,
buttonDelete: false,
load: false, load: false,
judul: '', judul: '',
reportNameDelete: '', reportNameDelete: '',
...@@ -585,6 +586,7 @@ export default class ReportItems extends Component { ...@@ -585,6 +586,7 @@ export default class ReportItems extends Component {
this.setState({ this.setState({
buttonCreate: response.data.data.create, buttonCreate: response.data.data.create,
buttonEdit: response.data.data.edit, buttonEdit: response.data.data.edit,
buttonDelete: response.data.data.delete,
load: true load: true
}) })
} else { } else {
...@@ -829,8 +831,9 @@ export default class ReportItems extends Component { ...@@ -829,8 +831,9 @@ export default class ReportItems extends Component {
sort: false, sort: false,
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
this.state.buttonEdit && (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{this.state.buttonEdit &&
<span>
<a data-tip={'Edit'} data-for="edit"> <a data-tip={'Edit'} data-for="edit">
<button <button
style={{ style={{
...@@ -845,6 +848,10 @@ export default class ReportItems extends Component { ...@@ -845,6 +848,10 @@ export default class ReportItems extends Component {
</button> </button>
</a> </a>
<ReactTooltip border={true} id="edit" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="edit" place="bottom" type="light" effect="solid" />
</span>
}
{this.state.buttonDelete &&
<span>
<a data-tip={'Delete'} data-for="delete"> <a data-tip={'Delete'} data-for="delete">
<button <button
style={{ style={{
...@@ -860,8 +867,9 @@ export default class ReportItems extends Component { ...@@ -860,8 +867,9 @@ export default class ReportItems extends Component {
</button> </button>
</a> </a>
<ReactTooltip border={true} id="delete" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="delete" place="bottom" type="light" effect="solid" />
</span>
}
</div > </div >
)
); );
} }
} }
......
...@@ -45,6 +45,7 @@ export default class UnitBisnis extends Component { ...@@ -45,6 +45,7 @@ export default class UnitBisnis extends Component {
messageAlert: '', messageAlert: '',
create: false, create: false,
edit: false, edit: false,
delete: false,
load: false, load: false,
judul: '', judul: '',
rowData: [], rowData: [],
...@@ -228,6 +229,7 @@ export default class UnitBisnis extends Component { ...@@ -228,6 +229,7 @@ export default class UnitBisnis extends Component {
this.setState({ this.setState({
create: response.data.data.create, create: response.data.data.create,
edit: response.data.data.edit, edit: response.data.data.edit,
delete: response.data.data.delete,
load: true load: true
}) })
} else { } else {
...@@ -477,8 +479,9 @@ export default class UnitBisnis extends Component { ...@@ -477,8 +479,9 @@ export default class UnitBisnis extends Component {
sort: false, sort: false,
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
this.state.edit && (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{this.state.edit &&
<span>
<a data-tip={'Edit'} data-for="edit"> <a data-tip={'Edit'} data-for="edit">
<button <button
style={{ style={{
...@@ -494,6 +497,10 @@ export default class UnitBisnis extends Component { ...@@ -494,6 +497,10 @@ export default class UnitBisnis extends Component {
</button> </button>
</a> </a>
<ReactTooltip border={true} id="edit" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="edit" place="bottom" type="light" effect="solid" />
</span>
}
{this.state.delete &&
<span>
<a data-tip={'Delete'} data-for="delete"> <a data-tip={'Delete'} data-for="delete">
<button <button
style={{ style={{
...@@ -508,8 +515,9 @@ export default class UnitBisnis extends Component { ...@@ -508,8 +515,9 @@ export default class UnitBisnis extends Component {
</button> </button>
</a> </a>
<ReactTooltip border={true} id="delete" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="delete" place="bottom" type="light" effect="solid" />
</span>
}
</div > </div >
)
); );
} }
} }
......
This diff is collapsed.
...@@ -254,7 +254,7 @@ export default class EditUser extends Component { ...@@ -254,7 +254,7 @@ export default class EditUser extends Component {
let index = roleData.findIndex((val) => val.role_id === id) let index = roleData.findIndex((val) => val.role_id === id)
console.log(index) console.log(index)
this.setState({ listRole: defaultProps, role: index === -1 ? null : roleData[index], msgErrorRN: index === -1 ? 'Role has been inactive' : '', errorRoleName: index === -1 ? true : false }) this.setState({ listRole: defaultProps, role: index === -1 ? null : roleData[index], msgErrorRN: index === -1 ? 'Role has been Inactive' : '', errorRoleName: index === -1 ? true : false })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) { if (response.data.message.includes("Someone Logged In")) {
......
...@@ -36,6 +36,7 @@ class UserRole extends Component { ...@@ -36,6 +36,7 @@ class UserRole extends Component {
messageAlert: '', messageAlert: '',
buttonCreate: false, buttonCreate: false,
buttonEdit: false, buttonEdit: false,
buttonDelete: false,
load: false load: false
} }
} }
...@@ -98,6 +99,7 @@ class UserRole extends Component { ...@@ -98,6 +99,7 @@ class UserRole extends Component {
this.setState({ this.setState({
buttonCreate: response.data.data.create, buttonCreate: response.data.data.create,
buttonEdit: response.data.data.edit, buttonEdit: response.data.data.edit,
buttonDelete: response.data.data.delete,
load: true load: true
}) })
} else { } else {
...@@ -215,7 +217,7 @@ class UserRole extends Component { ...@@ -215,7 +217,7 @@ class UserRole extends Component {
</div > </div >
</button> </button>
)} )}
{this.state.buttonEdit && ( {this.state.buttonDelete && (
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -361,35 +363,69 @@ class UserRole extends Component { ...@@ -361,35 +363,69 @@ class UserRole extends Component {
)} )}
{this.state.popupDel && ( {this.state.popupDel && (
<div className="test app-popup-show"> <div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8, padding: 50 }}> <div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
<div style={{ display: 'flex', justifyContent: 'center' }}> <div style={{ display: 'flex', justifyContent: 'center', paddingTop: 20 }}>
<img src={Images.failedCopy} /> <img src={Images.failed} />
</div> </div>
<div style={{ display: 'grid', justifyContent: 'center', marginTop: 20 }}> <div style={{ display: 'grid', justifyContent: 'center', marginTop: 20, paddingBottom: 20 }}>
<span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}> <span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold', fontFamily: 'Nunito Sans, sans-serif' }}>
Delete {this.state.rowData[2]} ? Delete {titleCase(this.state.rowData[2])} ?
</span> </span>
{/* <span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}>
{`Please try again later.`}
</span> */}
</div> </div>
<div style={{ display: 'flex', justifyContent: 'center', marginTop: 24 }}> <div className="border-top grid grid-2x" style={{ height: 56, backgroundColor: '#f5f5f5', paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1" style={{ alignSelf: 'center' }}>
<button <button
className={"btn-save"} type="button"
onClick={()=> this.setState({popupDel: false})} onClick={()=> this.setState({popupDel: false})}
> >
<span style={{ color: 'white' }}>Cancel</span> <div style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#354960', fontSize: 11 }}>Cancel</span>
</div>
</button> </button>
</div>
<div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
<button <button
className={"btn-save"} type="button"
style={{ marginLeft: 50}}
onClick={()=> this.deleteRole()} onClick={()=> this.deleteRole()}
> >
<span style={{ color: 'white' }}>Delete</span> <div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#fff', fontSize: 11 }}>Delete</span>
</div>
</button> </button>
</div> </div>
</div> </div>
</div> </div>
</div>
// <div className="test app-popup-show">
// <div className="popup-content background-white border-radius" style={{ borderRadius: 8, padding: 50 }}>
// <div style={{ display: 'flex', justifyContent: 'center' }}>
// <img src={Images.failed} />
// </div>
// <div style={{ display: 'grid', justifyContent: 'center', marginTop: 20 }}>
// <span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}>
// Delete {titleCase(this.state.rowData[2])} ?
// </span>
// {/* <span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}>
// {`Please try again later.`}
// </span> */}
// </div>
// <div style={{ display: 'flex', justifyContent: 'center', marginTop: 24 }}>
// <button
// className={"btn-save"}
// onClick={()=> this.setState({popupDel: false})}
// >
// <span style={{ color: 'white' }}>Cancel</span>
// </button>
// <button
// className={"btn-save"}
// style={{ marginLeft: 50}}
// onClick={()=> this.deleteRole()}
// >
// <span style={{ color: 'white' }}>Delete</span>
// </button>
// </div>
// </div>
// </div>
)} )}
</div> </div>
); );
......
...@@ -142,6 +142,7 @@ export default class AddRole extends Component { ...@@ -142,6 +142,7 @@ export default class AddRole extends Component {
setTimeout(() => { setTimeout(() => {
this.props.onClickClose() this.props.onClickClose()
this.props.refresh() this.props.refresh()
window.location.reload();
}, 750); }, 750);
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
......
...@@ -168,6 +168,7 @@ export default class EditRole extends Component { ...@@ -168,6 +168,7 @@ export default class EditRole extends Component {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
setTimeout(() => { setTimeout(() => {
this.props.onClickClose() this.props.onClickClose()
window.location.reload();
this.props.refresh() this.props.refresh()
}, 750); }, 750);
} else { } else {
...@@ -621,6 +622,9 @@ export default class EditRole extends Component { ...@@ -621,6 +622,9 @@ export default class EditRole extends Component {
<div className="column 3"> <div className="column 3">
<Typography style={{ fontSize: 12, color: 'white' }}>Edit</Typography> <Typography style={{ fontSize: 12, color: 'white' }}>Edit</Typography>
</div> </div>
<div className="column 4">
<Typography style={{ fontSize: 12, color: 'white' }}>Delete</Typography>
</div>
</div> </div>
</div> </div>
......
...@@ -49,7 +49,42 @@ class Upload extends Component { ...@@ -49,7 +49,42 @@ class Upload extends Component {
let length = acceptedFiles[0].name.split(".").length let length = acceptedFiles[0].name.split(".").length
let fileType = acceptedFiles[0].name.split(".")[length - 1] let fileType = acceptedFiles[0].name.split(".")[length - 1]
formData.append('file', acceptedFiles[0]) formData.append('file', acceptedFiles[0])
console.log(acceptedFiles); console.log(fileType);
if (this.props.intent === 'management') {
if (acceptedFiles) {
if (this.props.acceptedFiles.includes(fileType)) {
if (this.state.sizeFile < 10000) {
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({ alertMessage: 'The file is too large. Allowed maximum size is 10MB', alert: true })
// alert('File Tidak Boleh Lebih Dari 1MB')
}
} else {
this.setState({ alertMessage: 'File extension not allowed.', alert: true })
// alert('File Tidak Mendukung')
}
}
else {
this.setState({
previewVisible: false,
inputVisible: true,
uploadProgress: false,
percentage: '0'
})
this.setState({ alertMessage: "File extension not allowed.", alert: true })
// alert("Unsupported Media Type")
}
} else {
if (acceptedFiles) { if (acceptedFiles) {
this.setState({ this.setState({
file: acceptedFiles[0], file: acceptedFiles[0],
...@@ -74,14 +109,25 @@ class Upload extends Component { ...@@ -74,14 +109,25 @@ class Upload extends Component {
// alert("Unsupported Media Type") // alert("Unsupported Media Type")
} }
} }
}
onRemove = () => { onRemove = () => {
if (this.props.intent === "management") {
this.setState({ this.setState({
previewVisible: false, previewVisible: false,
inputVisible: true, inputVisible: true,
uploadProgress: false, uploadProgress: false,
percentage: '0' percentage: '0'
}) })
this.props.onDelete("delete")
} else {
this.setState({
previewVisible: false,
inputVisible: true,
uploadProgress: false,
percentage: '0'
})
}
} }
onUpload = () => { onUpload = () => {
...@@ -92,12 +138,21 @@ class Upload extends Component { ...@@ -92,12 +138,21 @@ class Upload extends Component {
// console.log(strState); // console.log(strState);
if (strProps.includes(strState)) { if (strProps.includes(strState)) {
if (this.props.intent === 'management') {
if (this.state.sizeFile < 10000) {
this.props.onUpload()
} else {
this.setState({ alertMessage: 'The file is too large. Allowed maximum size is 10MB', alert: true })
// alert('File Tidak Boleh Lebih Dari 1MB')
}
} else {
if (this.state.sizeFile < 1000) { if (this.state.sizeFile < 1000) {
this.props.onUpload() this.props.onUpload()
} else { } else {
this.setState({ alertMessage: 'The file is too large. Allowed maximum size is 1MB', alert: true }) this.setState({ alertMessage: 'The file is too large. Allowed maximum size is 1MB', alert: true })
// alert('File Tidak Boleh Lebih Dari 1MB') // alert('File Tidak Boleh Lebih Dari 1MB')
} }
}
} else { } else {
this.setState({ alertMessage: 'File extension not allowed.', alert: true }) this.setState({ alertMessage: 'File extension not allowed.', alert: true })
// alert('File Tidak Mendukung') // alert('File Tidak Mendukung')
...@@ -171,7 +226,7 @@ class Upload extends Component { ...@@ -171,7 +226,7 @@ class Upload extends Component {
onClick={this.state.uploadProgress === true ? null : this.onUpload}> onClick={this.state.uploadProgress === true ? null : this.onUpload}>
{/*<i className={this.state.iconButtonUpload} />*/} {/*<i className={this.state.iconButtonUpload} />*/}
{this.state.uploadProgress === true {this.state.uploadProgress === true
? <i className={'fa fa-1x fa-spinner fa-spin'} /> : ? <i className={'fa fa-1x fa-spinner fa-spin'} /> : this.props.intent === 'management' ? null :
<img src={Images.upload} />} <img src={Images.upload} />}
</button> </button>
</div> </div>
......
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