Commit e409c78c authored by EKSAD's avatar EKSAD

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

parents 4f5d5456 21ce0aae
...@@ -161,6 +161,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -161,6 +161,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const getRevision = (body) => api.post('transaction/get_revision', body) const getRevision = (body) => api.post('transaction/get_revision', body)
const getPeriodeTransaction = () => api.get('transaction/get_periode') const getPeriodeTransaction = () => api.get('transaction/get_periode')
const deleteAttachment = (id) => api.post(`transaction/delete_attachment/${id}`) const deleteAttachment = (id) => api.post(`transaction/delete_attachment/${id}`)
const getDetailReportMB = (body) => api.post('/transaction/master_budget/get_report_hierarki', body)
//Template //Template
const downloadTemplate = (fileName, fileType) => api.get(`attachment/download_file?fileName=${fileName}&&fileType=${fileType}`) const downloadTemplate = (fileName, fileType) => api.get(`attachment/download_file?fileName=${fileName}&&fileType=${fileType}`)
...@@ -264,7 +265,8 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -264,7 +265,8 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
uploadAttachment, uploadAttachment,
getPeriodeTransaction, getPeriodeTransaction,
getRevision, getRevision,
deleteAttachment deleteAttachment,
getDetailReportMB
} }
} }
......
...@@ -7,6 +7,7 @@ import format from "date-fns/format"; ...@@ -7,6 +7,7 @@ import format from "date-fns/format";
import localeID from "date-fns/locale/id" import localeID from "date-fns/locale/id"
import api from "../../api"; import api from "../../api";
import Images from '../../assets/Images'; import Images from '../../assets/Images';
import Constant from '../../library/Constant';
export default class CreateApprovalMatrix extends Component { export default class CreateApprovalMatrix extends Component {
constructor(props) { constructor(props) {
...@@ -53,72 +54,119 @@ export default class CreateApprovalMatrix extends Component { ...@@ -53,72 +54,119 @@ export default class CreateApprovalMatrix extends Component {
getUserData() { getUserData() {
api.create().getApprovedByAM().then((response) => { api.create().getApprovedByAM().then((response) => {
if(response.status == null){ if(response.data) {
// alert(response.problem) if (response.ok) {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' }) if (response.data.status == 'success') {
} let data = response.data.data
else if (response.data.status == 'success') { let userData = data.map((item) => {
let data = response.data.data return {
let userData = data.map((item) => { user_id: item.user_id,
return { fullname: item.fullname
user_id: item.user_id, }
fullname: item.fullname })
// console.log(userData)
let defaultProps = {
options: userData,
getOptionLabel: (option) => option.fullname,
};
this.setState({ approvedBy: defaultProps, userData: response.data.data})
} else {
// alert('Approver Name: ' +response.data.message)
if (response.data.message.includes("Token")) {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
})
} else {
this.setState({ alert: true, messageAlert: 'Approver Name: ' + response.data.message, tipeAlert: 'error' })
}
} }
}) } else {
// console.log(userData) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
let defaultProps = { }
options: userData,
getOptionLabel: (option) => option.fullname,
};
this.setState({ approvedBy: defaultProps, userData: response.data.data})
} else { } else {
// alert('Approver Name: ' +response.data.message) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
this.setState({ alert: true, messageAlert: 'Approver Name: ' +response.problem, tipeAlert: 'error' })
} }
}) })
} }
getTypeData() { getTypeData() {
api.create().getTypeAM().then((response) => { api.create().getTypeAM().then((response) => {
if (response.data.status == 'success') { if (response.data) {
let data = response.data.data if (response.ok) {
let typeData = data.map((item) => { if (response.data.status == 'success') {
return { let data = response.data.data
approval_type_id: item.approval_type_id, let typeData = data.map((item) => {
approval_type_name: item.approval_type_name return {
approval_type_id: item.approval_type_id,
approval_type_name: item.approval_type_name
}
})
let typeProps = {
options: typeData,
getOptionLabel: (option) => option.approval_type_name,
};
this.setState({ types: typeProps, typeData: response.data.data })
} else {
// alert('Approval Type: ' +response.data.message)
if (response.data.message.includes("Token")) {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
})
} else {
this.setState({ alert: true, messageAlert: 'Approval Type: ' + response.data.message, tipeAlert: 'warning' })
}
} }
}) } else {
let typeProps = { this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
options: typeData, }
getOptionLabel: (option) => option.approval_type_name,
};
this.setState({ types: typeProps, typeData: response.data.data })
} else { } else {
// alert('Approval Type: ' +response.data.message) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
this.setState({ alert: true, messageAlert: 'Approval Type: ' +response.problem, tipeAlert: 'error' })
} }
}) })
} }
getOperatorData() { getOperatorData() {
api.create().getOperatorAM().then((response) => { api.create().getOperatorAM().then((response) => {
if (response.data.status == 'success') { if (response.data) {
let data = response.data.data if (response.ok) {
let operatorData = data.map((item) => { if (response.data.status == 'success') {
return { let data = response.data.data
operator_type_id: item.operator_type_id, let operatorData = data.map((item) => {
operator_type_name: item.operator_type_name return {
operator_type_id: item.operator_type_id,
operator_type_name: item.operator_type_name
}
})
// console.log(userData)
let operatorProps = {
options: operatorData,
getOptionLabel: (option) => option.operator_type_name,
};
this.setState({ operators: operatorProps, operatorData: response.data.data })
} else {
// alert('Operator: ' +response.data.message)
if (response.data.message.includes("Token")) {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
})
} else {
this.setState({ alert: true, messageAlert: 'Operator: ' + response.data.message, tipeAlert: 'warning' })
}
} }
}) } else {
// console.log(userData) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
let operatorProps = { }
options: operatorData,
getOptionLabel: (option) => option.operator_type_name,
};
this.setState({ operators: operatorProps, operatorData: response.data.data })
} else { } else {
// alert('Operator: ' +response.data.message) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
this.setState({ alert: true, messageAlert: 'Operator: ' +response.problem, tipeAlert: 'error' })
} }
}) })
} }
......
...@@ -7,6 +7,7 @@ import ReactDragListView from 'react-drag-listview'; ...@@ -7,6 +7,7 @@ import ReactDragListView from 'react-drag-listview';
import Autocomplete from '@material-ui/lab/Autocomplete'; import Autocomplete from '@material-ui/lab/Autocomplete';
import api from "../../api"; import api from "../../api";
import { none } from 'ramda'; import { none } from 'ramda';
import Constant from '../../library/Constant';
const type = [ const type = [
...@@ -46,22 +47,33 @@ export default class VisualisasiAM extends Component { ...@@ -46,22 +47,33 @@ export default class VisualisasiAM extends Component {
getTypeData() { getTypeData() {
api.create().getTypeAM().then((response) => { api.create().getTypeAM().then((response) => {
if (response.data) { if (response.data) {
if (response.data.status == 'success') { if (response.ok) {
let data = response.data.data if (response.data.status == 'success') {
// console.log(data) let data = response.data.data
let typeData = data.map((item) => { // console.log(data)
return { let typeData = data.map((item) => {
approval_type_id: item.approval_type_id, return {
approval_type_name: item.approval_type_name approval_type_id: item.approval_type_id,
} approval_type_name: item.approval_type_name
}) }
let typeProps = { })
options: typeData, let typeProps = {
getOptionLabel: (option) => option.approval_type_name, options: typeData,
}; getOptionLabel: (option) => option.approval_type_name,
this.setState({ types: typeProps, typeData: response.data.data }) };
this.setState({ types: typeProps, typeData: response.data.data })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
...@@ -76,28 +88,39 @@ export default class VisualisasiAM extends Component { ...@@ -76,28 +88,39 @@ export default class VisualisasiAM extends Component {
} }
api.create().searchAM(body).then(response => { api.create().searchAM(body).then(response => {
if (response.data) { if (response.data) {
if (response.data.status == 'success') { if (response.ok) {
let data = response.data.data if (response.data.status == 'success') {
// console.log(data) let data = response.data.data
let listVisual = [] // console.log(data)
data.map((item, index) => { let listVisual = []
let indexId = listVisual.findIndex((val) => val.orderId == item.orders) data.map((item, index) => {
if(indexId == -1){ let indexId = listVisual.findIndex((val) => val.orderId == item.orders)
listVisual.push({ if(indexId == -1){
orderId: item.orders, listVisual.push({
data: [item] orderId: item.orders,
}) data: [item]
// console.log(listVisual); })
} else { // console.log(listVisual);
listVisual[indexId].data.push(item) } else {
// console.log('listVisual'); listVisual[indexId].data.push(item)
// console.log(listVisual); // console.log('listVisual');
} // console.log(listVisual);
}) }
this.setState({ listApproval: listVisual}) })
// console.log(listVisual); this.setState({ listApproval: listVisual})
// console.log(listVisual);
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
......
...@@ -32,7 +32,8 @@ export default class BudgetTahunan extends Component { ...@@ -32,7 +32,8 @@ export default class BudgetTahunan extends Component {
visibleFAM: false, visibleFAM: false,
visibleCAT: false, visibleCAT: false,
listAttachment: [], listAttachment: [],
visibleUpload: false visibleUpload: false,
revisionTable: null
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -161,54 +162,59 @@ export default class BudgetTahunan extends Component { ...@@ -161,54 +162,59 @@ export default class BudgetTahunan extends Component {
}) })
} }
clickDetail(item, id) { clickDetail(item, id, revision) {
this.setState({ report_id: id }) console.log(item);
if (item === 'Balance Sheet') { this.setState({
this.setState({ report_id: id,
visibleBudgetTahunan: false, revisionTable: revision,
visibleBS: true, }, () => {
visiblePL: false, if (item === 'Balance Sheet') {
visibleCAT: false, this.setState({
visibleFAM: false, visibleBudgetTahunan: false,
visibleTP: false, visibleBS: true,
}) visiblePL: false,
} else if (item === 'Profit Loss') { visibleCAT: false,
this.setState({ visibleFAM: false,
visibleBudgetTahunan: false, visibleTP: false,
visibleBS: false, })
visiblePL: true, } else if (item === 'Profit Loss') {
visibleCAT: false, this.setState({
visibleFAM: false, visibleBudgetTahunan: false,
visibleTP: false visibleBS: false,
}) visiblePL: true,
} else if (item === 'Tax Planning') { visibleCAT: false,
this.setState({ visibleFAM: false,
visibleBudgetTahunan: false, visibleTP: false
visibleBS: false, })
visiblePL: false, } else if (item === 'Tax Planning') {
visibleCAT: false, this.setState({
visibleFAM: false, visibleBudgetTahunan: false,
visibleTP: true visibleBS: false,
}) visiblePL: false,
} else if (item === 'Fixed Assets Movement') { visibleCAT: false,
this.setState({ visibleFAM: false,
visibleBudgetTahunan: false, visibleTP: true
visibleBS: false, })
visiblePL: false, } else if (item === 'Fixed Assets Movement') {
visibleCAT: false, this.setState({
visibleFAM: true, visibleBudgetTahunan: false,
visibleTP: false visibleBS: false,
}) visiblePL: false,
} else if (item === 'CAT') { visibleCAT: false,
this.setState({ visibleFAM: true,
visibleBudgetTahunan: false, visibleTP: false
visibleBS: false, })
visiblePL: false, } else if (item === 'CAT') {
visibleCAT: true, this.setState({
visibleFAM: false, visibleBudgetTahunan: false,
visibleTP: false visibleBS: false,
}) visiblePL: false,
} visibleCAT: true,
visibleFAM: false,
visibleTP: false
})
}
})
} }
handleChange(value, tableMeta) { handleChange(value, tableMeta) {
...@@ -323,7 +329,7 @@ export default class BudgetTahunan extends Component { ...@@ -323,7 +329,7 @@ export default class BudgetTahunan extends Component {
borderColor: 'transparent' borderColor: 'transparent'
}} }}
onClick={() => onClick={() =>
tableMeta.rowData[5] ? this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4]) : null tableMeta.rowData[5] ? this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4], tableMeta.rowData[2]) : null
} }
> >
<Typography style={{ color: tableMeta.rowData[5] ? '#5198ea' : 'GrayText', fontSize: 12, }}>Detail</Typography> <Typography style={{ color: tableMeta.rowData[5] ? '#5198ea' : 'GrayText', fontSize: 12, }}>Detail</Typography>
...@@ -554,6 +560,8 @@ export default class BudgetTahunan extends Component { ...@@ -554,6 +560,8 @@ export default class BudgetTahunan extends Component {
<BalanceSheet <BalanceSheet
report_id={this.state.report_id} report_id={this.state.report_id}
company={this.state.company} company={this.state.company}
revision={this.state.revisionTable}
periode={this.state.periode.periode}
onClickClose={() => this.setState({ visibleBS: false, visibleBudgetTahunan: true })} onClickClose={() => this.setState({ visibleBS: false, visibleBudgetTahunan: true })}
/> />
)} )}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -113,7 +113,7 @@ class Login extends Component { ...@@ -113,7 +113,7 @@ class Login extends Component {
this.props.history.push('/home/beranda') this.props.history.push('/home/beranda')
} else { } else {
if (response.data.message == 'Password is Not Correct') { if (response.data.message == 'Password is Not Correct') {
this.setState({ errorPassword: true, msgPassword: response.data.message }) this.setState({ errorPassword: true, msgPassword: 'Incorrect Password' })
} else { } else {
this.setState({ errorEmail: true, msgEmail: response.data.message }) this.setState({ errorEmail: true, msgEmail: response.data.message })
} }
......
...@@ -7,6 +7,7 @@ import Autocomplete from '@material-ui/lab/Autocomplete'; ...@@ -7,6 +7,7 @@ import Autocomplete from '@material-ui/lab/Autocomplete';
import MuiAlert from '@material-ui/lab/Alert'; import MuiAlert from '@material-ui/lab/Alert';
import api from '../../../api'; import api from '../../../api';
import Images from '../../../assets/Images'; import Images from '../../../assets/Images';
import Constant from '../../../library/Constant';
const Alert = withStyles({ const Alert = withStyles({
})((props) => <MuiAlert elevation={6} variant="filled" {...props} />); })((props) => <MuiAlert elevation={6} variant="filled" {...props} />);
...@@ -71,23 +72,34 @@ export default class CreatePerusahaan extends Component { ...@@ -71,23 +72,34 @@ export default class CreatePerusahaan extends Component {
api.create().getDetailPerusahaan(this.props.data[1]).then(response => { api.create().getDetailPerusahaan(this.props.data[1]).then(response => {
console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.ok) {
this.setState({ if (response.data.status === "success") {
businessID: response.data.data.business_unit_id, this.setState({
companyID: response.data.data.company_id, businessID: response.data.data.business_unit_id,
status: response.data.data.status, companyID: response.data.data.company_id,
company: response.data.data.company_name, status: response.data.data.status,
parentID: response.data.data.parent, company: response.data.data.company_name,
parent: response.data.data.parent_name, parentID: response.data.data.parent,
startDate: response.data.data.start_date, parent: response.data.data.parent_name,
endDate: response.data.data.end_date, startDate: response.data.data.start_date,
totalReport: response.data.data.total_report, endDate: response.data.data.end_date,
created: response.data.data.created, totalReport: response.data.data.total_report,
updated: response.data.data.updated === null ? "" : response.data.data.updated created: response.data.data.created,
}, () => this.getAllUnitBisnis(), this.getCompanyActive()) updated: response.data.data.updated === null ? "" : response.data.data.updated
}, () => this.getAllUnitBisnis(), this.getCompanyActive())
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
} }
...@@ -103,23 +115,34 @@ export default class CreatePerusahaan extends Component { ...@@ -103,23 +115,34 @@ export default class CreatePerusahaan extends Component {
api.create().getPerusahaanActive(payload).then(response => { api.create().getPerusahaanActive(payload).then(response => {
console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.data.status == 'success') { if (response.ok) {
let data = response.data.data if (response.data.status == 'success') {
let perusahaanData = data.map((item) => { let data = response.data.data
return { let perusahaanData = data.map((item) => {
company_id: item.company_id, return {
company_name: item.company_name company_id: item.company_id,
} company_name: item.company_name
}) }
let index = perusahaanData.sort((a, b) => a.company_id - b.company_id).findIndex((val) => val.company_id == this.state.parentID) })
let typeProps = { let index = perusahaanData.sort((a, b) => a.company_id - b.company_id).findIndex((val) => val.company_id == this.state.parentID)
options: perusahaanData, let typeProps = {
getOptionLabel: (option) => option.company_name, options: perusahaanData,
}; 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] })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
} }
...@@ -130,25 +153,36 @@ export default class CreatePerusahaan extends Component { ...@@ -130,25 +153,36 @@ export default class CreatePerusahaan extends Component {
getAllUnitBisnis() { getAllUnitBisnis() {
api.create().getUnitBisnisActive().then(response => { api.create().getUnitBisnisActive().then(response => {
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.ok) {
let data = response.data.data if (response.data.status === 'success') {
let typeData = data.map((item) => { let data = response.data.data
return { let typeData = data.map((item) => {
business_unit_id: item.business_unit_id, return {
business_unit_name: item.business_unit_name business_unit_id: item.business_unit_id,
} business_unit_name: item.business_unit_name
}) }
// console.log(typeData) })
let index = typeData.findIndex((val) => val.business_unit_id == this.state.businessID) // console.log(typeData)
console.log(index) let index = typeData.findIndex((val) => val.business_unit_id == this.state.businessID)
let typeProps = { console.log(index)
options: typeData, let typeProps = {
getOptionLabel: (option) => option.business_unit_name, options: typeData,
}; 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] })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
} }
......
...@@ -7,6 +7,7 @@ import Nestable from 'react-nestable/dist/Nestable'; ...@@ -7,6 +7,7 @@ import Nestable from 'react-nestable/dist/Nestable';
import AddIcon from '@material-ui/icons/Add'; import AddIcon from '@material-ui/icons/Add';
import RemoveIcon from '@material-ui/icons/Remove'; import RemoveIcon from '@material-ui/icons/Remove';
import api from '../../../api'; import api from '../../../api';
import Constant from '../../../library/Constant';
const Alert = withStyles({ const Alert = withStyles({
})((props) => <MuiAlert elevation={6} variant="filled" {...props} />); })((props) => <MuiAlert elevation={6} variant="filled" {...props} />);
...@@ -55,11 +56,22 @@ export default class VisualPerusahaan extends Component { ...@@ -55,11 +56,22 @@ export default class VisualPerusahaan extends Component {
api.create().getPerusahaanHierarki().then((response) => { api.create().getPerusahaanHierarki().then((response) => {
console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.data.status == 'success') { if (response.ok) {
this.setState({ items: response.data.data }) if (response.data.status == 'success') {
console.log(response.data.data) this.setState({ items: response.data.data })
console.log(response.data.data)
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
...@@ -89,8 +101,30 @@ export default class VisualPerusahaan extends Component { ...@@ -89,8 +101,30 @@ export default class VisualPerusahaan extends Component {
"company": this.state.items "company": this.state.items
} }
api.create().saveVisualisasiPerusahaan(payload).then((response) => { api.create().saveVisualisasiPerusahaan(payload).then((response) => {
// if (response.data.status == 'ucces') { if (response.data) {
this.props.onClickClose() if (response.ok) {
if (response.data.status == 'success') {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' }, () => {
setTimeout(() => {
this.props.onClickClose()
}, 1000);
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
// } else { // } else {
// alert(response.data.message) // alert(response.data.message)
// } // }
......
This diff is collapsed.
This diff is collapsed.
...@@ -9,6 +9,7 @@ import api from '../../../api'; ...@@ -9,6 +9,7 @@ import api from '../../../api';
import { titleCase } from '../../../library/Utils'; import { titleCase } from '../../../library/Utils';
import Autocomplete from '@material-ui/lab/Autocomplete'; import Autocomplete from '@material-ui/lab/Autocomplete';
import MuiAlert from '@material-ui/lab/Alert'; import MuiAlert from '@material-ui/lab/Alert';
import Constant from '../../../library/Constant';
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
root: { root: {
...@@ -94,7 +95,14 @@ export default class VisualReportItems extends Component { ...@@ -94,7 +95,14 @@ export default class VisualReportItems extends Component {
this.setState({ listReport: defaultProps, report: reportData[0] }) this.setState({ listReport: defaultProps, report: reportData[0] })
} 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("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
...@@ -125,7 +133,14 @@ export default class VisualReportItems extends Component { ...@@ -125,7 +133,14 @@ export default class VisualReportItems extends Component {
this.getItemHierarki() this.getItemHierarki()
}) })
} 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("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
...@@ -212,7 +227,14 @@ export default class VisualReportItems extends Component { ...@@ -212,7 +227,14 @@ export default class VisualReportItems extends Component {
}, 1000); }, 1000);
}) })
} 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("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
......
...@@ -6,6 +6,7 @@ import format from "date-fns/format"; ...@@ -6,6 +6,7 @@ import format from "date-fns/format";
import Images from '../../../assets/Images'; import Images from '../../../assets/Images';
import api from '../../../api'; import api from '../../../api';
import MuiAlert from '@material-ui/lab/Alert'; import MuiAlert from '@material-ui/lab/Alert';
import Constant from '../../../library/Constant';
const Alert = withStyles({ const Alert = withStyles({
})((props) => <MuiAlert elevation={6} variant="filled" {...props} />); })((props) => <MuiAlert elevation={6} variant="filled" {...props} />);
...@@ -59,21 +60,32 @@ export default class CreateUnitBisnis extends Component { ...@@ -59,21 +60,32 @@ export default class CreateUnitBisnis extends Component {
api.create().getDetailUnitBisnis(this.props.data[1]).then(response => { api.create().getDetailUnitBisnis(this.props.data[1]).then(response => {
console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.ok) {
let data = response.data.data if (response.data.status === "success") {
this.setState({ let data = response.data.data
id: data.business_unit_id, this.setState({
name: data.business_unit_name, id: data.business_unit_id,
startDate: data.start_date, name: data.business_unit_name,
endDate: data.end_date, startDate: data.start_date,
status: data.status, endDate: data.end_date,
created: data.created, status: data.status,
updated: data.updated === null ? "" : data.updated created: data.created,
}) updated: data.updated === null ? "" : data.updated
} })
else { }
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }) else {
} this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else { } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
} }
......
This diff is collapsed.
...@@ -11,6 +11,7 @@ import { DatePicker } from '@material-ui/pickers'; ...@@ -11,6 +11,7 @@ import { DatePicker } from '@material-ui/pickers';
import * as R from 'ramda' import * as R from 'ramda'
import Images from '../../../assets/Images'; import Images from '../../../assets/Images';
import MuiAlert from '@material-ui/lab/Alert'; import MuiAlert from '@material-ui/lab/Alert';
import Constant from '../../../library/Constant';
const CustomCheckbox = withStyles({ const CustomCheckbox = withStyles({
root: { root: {
...@@ -200,7 +201,14 @@ export default class AddUser extends Component { ...@@ -200,7 +201,14 @@ export default class AddUser extends Component {
this.props.refresh() this.props.refresh()
}, 750); }, 750);
} 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("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
...@@ -235,7 +243,14 @@ export default class AddUser extends Component { ...@@ -235,7 +243,14 @@ export default class AddUser extends Component {
}; };
this.setState({ listRole: defaultProps }) this.setState({ listRole: defaultProps })
} 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("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
...@@ -254,7 +269,14 @@ export default class AddUser extends Component { ...@@ -254,7 +269,14 @@ export default class AddUser extends Component {
this.setState({ listCompany: response.data.data }) this.setState({ listCompany: response.data.data })
console.log(response.data.data) console.log(response.data.data)
} 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("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
......
...@@ -10,6 +10,7 @@ import AddIcon from '@material-ui/icons/Add'; ...@@ -10,6 +10,7 @@ import AddIcon from '@material-ui/icons/Add';
import * as R from 'ramda' import * as R from 'ramda'
import Images from '../../../assets/Images'; import Images from '../../../assets/Images';
import MuiAlert from '@material-ui/lab/Alert'; import MuiAlert from '@material-ui/lab/Alert';
import Constant from '../../../library/Constant';
const CustomCheckbox = withStyles({ const CustomCheckbox = withStyles({
root: { root: {
...@@ -145,7 +146,14 @@ export default class EditUser extends Component { ...@@ -145,7 +146,14 @@ export default class EditUser extends Component {
this.getRole(response.data.data.role_id)) this.getRole(response.data.data.role_id))
console.log(response.data.data) console.log(response.data.data)
} 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("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
...@@ -220,7 +228,14 @@ export default class EditUser extends Component { ...@@ -220,7 +228,14 @@ export default class EditUser extends Component {
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("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
...@@ -238,7 +253,14 @@ export default class EditUser extends Component { ...@@ -238,7 +253,14 @@ export default class EditUser extends Component {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({ listCompany: response.data.data }) this.setState({ listCompany: response.data.data })
} 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("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
......
...@@ -13,6 +13,7 @@ import { InputBase, Snackbar } from "@material-ui/core"; ...@@ -13,6 +13,7 @@ import { InputBase, Snackbar } from "@material-ui/core";
import ReactTooltip from "react-tooltip"; import ReactTooltip from "react-tooltip";
import MuiAlert from '@material-ui/lab/Alert'; import MuiAlert from '@material-ui/lab/Alert';
import { withStyles } from '@material-ui/core/styles'; import { withStyles } from '@material-ui/core/styles';
import Constant from "../../library/Constant";
var ct = require("../../library/CustomTable"); var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable()); const getMuiTheme = () => createMuiTheme(ct.customTable());
...@@ -68,7 +69,14 @@ class UserRole extends Component { ...@@ -68,7 +69,14 @@ class UserRole extends Component {
// }) // })
} 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("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
...@@ -113,7 +121,14 @@ class UserRole extends Component { ...@@ -113,7 +121,14 @@ class UserRole extends Component {
}) })
this.setState({ listRole: listData }) this.setState({ listRole: listData })
} 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("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
......
...@@ -9,6 +9,7 @@ import localeID from "date-fns/locale/id" ...@@ -9,6 +9,7 @@ import localeID from "date-fns/locale/id"
import * as R from 'ramda' import * as R from 'ramda'
import Images from '../../../assets/Images'; import Images from '../../../assets/Images';
import MuiAlert from '@material-ui/lab/Alert'; import MuiAlert from '@material-ui/lab/Alert';
import Constant from '../../../library/Constant';
const CustomCheckbox = withStyles({ const CustomCheckbox = withStyles({
root: { root: {
...@@ -143,7 +144,14 @@ export default class AddRole extends Component { ...@@ -143,7 +144,14 @@ export default class AddRole extends Component {
this.props.refresh() this.props.refresh()
}, 750); }, 750);
} 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("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
...@@ -188,7 +196,14 @@ export default class AddRole extends Component { ...@@ -188,7 +196,14 @@ export default class AddRole extends Component {
this.setState({ application: app, setting: set, isLoad: true }, () => console.log(this.state.application)) this.setState({ application: app, setting: set, isLoad: true }, () => console.log(this.state.application))
// this.setState({ menuData: response.data.data }) // this.setState({ menuData: response.data.data })
} 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("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
......
This diff is collapsed.
...@@ -70,7 +70,7 @@ class Upload extends Component { ...@@ -70,7 +70,7 @@ class Upload extends Component {
uploadProgress: false, uploadProgress: false,
percentage: '0' percentage: '0'
}) })
this.setState({ alertMessage: "Unsupported File", alert: true }) this.setState({ alertMessage: "File extension not allowed.", alert: true })
// alert("Unsupported Media Type") // alert("Unsupported Media Type")
} }
} }
...@@ -95,11 +95,11 @@ class Upload extends Component { ...@@ -95,11 +95,11 @@ class Upload extends Component {
if (this.state.sizeFile < 1000) { if (this.state.sizeFile < 1000) {
this.props.onUpload() this.props.onUpload()
} else { } else {
this.setState({ alertMessage: 'File cannot be more than 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: 'Unsupported File', alert: true }) this.setState({ alertMessage: 'File extension not allowed.', alert: true })
// alert('File Tidak Mendukung') // alert('File Tidak Mendukung')
} }
} }
......
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