Commit cbe9be65 authored by Rifka Kurnia Irfiana's avatar Rifka Kurnia Irfiana

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

parents a1ee31dd ef36863f
...@@ -133,7 +133,6 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -133,7 +133,6 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const getReportItems = () => api.get('item_report/get_all_item_report') const getReportItems = () => api.get('item_report/get_all_item_report')
const getInputType = () => api.get('type_item_report/get_all_type_item_report') const getInputType = () => api.get('type_item_report/get_all_type_item_report')
const getReportType = () => api.get('report/get_all_report') const getReportType = () => api.get('report/get_all_report')
const getReportTypeBody = (body) => api.post('report/get_all_report', body)
const getDetailReportItems = (userId) => api.get(`item_report/get_item_report_by_id/${userId}`) const getDetailReportItems = (userId) => api.get(`item_report/get_item_report_by_id/${userId}`)
const searchReportItems = (body) => api.post('/item_report/search_item_report', body) const searchReportItems = (body) => api.post('/item_report/search_item_report', body)
const createReportItems = (body) => api.post('/item_report/create_item_report', body) const createReportItems = (body) => api.post('/item_report/create_item_report', body)
...@@ -155,6 +154,13 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -155,6 +154,13 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const uploadParameter = (body) => api.post('/setting/import_setting', body) const uploadParameter = (body) => api.post('/setting/import_setting', body)
const searchParameter = (body) => api.post('setting/search_setting', body) const searchParameter = (body) => api.post('setting/search_setting', body)
//Transaction
const getReportTypeBody = (body) => api.post('transaction/get_all_report', body)
const getMasterBudgetAtt = (body) => api.post('transaction/get_report_attachment', body)
const uploadAttachment = (body) => api.post('transaction/upload_attachment', body)
const getRevision = (body) => api.post('transaction/get_revision', body)
const getPeriodeTransaction = () => api.get('transaction/get_periode')
//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}`)
...@@ -252,7 +258,11 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -252,7 +258,11 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
getDetailUnitBisnis, getDetailUnitBisnis,
uploadFoto, uploadFoto,
getReportTypeBody, getReportTypeBody,
getPermission getPermission,
getMasterBudgetAtt,
uploadAttachment,
getPeriodeTransaction,
getRevision
} }
} }
......
...@@ -46,7 +46,9 @@ const Images = { ...@@ -46,7 +46,9 @@ const Images = {
failedCopy: require('./failed-copy.svg'), failedCopy: require('./failed-copy.svg'),
triputraLogo: require('./triputra-logo.png'), triputraLogo: require('./triputra-logo.png'),
photo: require('./photo.svg'), photo: require('./photo.svg'),
camera: require('./camera.svg') camera: require('./camera.svg'),
meeting: require('./meeting.jpg'),
triputraBlack: require('./triputra-black.jpg'),
} }
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Typography, Paper, TextField, MenuItem } from '@material-ui/core'; import { Typography, Paper, TextField, MenuItem, Select, FormControlLabel } from '@material-ui/core';
import MUIDataTable from 'mui-datatables'; import MUIDataTable from 'mui-datatables';
import Images from '../assets/Images'; import Images from '../assets/Images';
import BalanceSheet from './BudgetTahunan/BalanceSheet'; import BalanceSheet from './BudgetTahunan/BalanceSheet';
...@@ -10,47 +10,75 @@ import ProfitLoss from './BudgetTahunan/ProfitLoss'; ...@@ -10,47 +10,75 @@ import ProfitLoss from './BudgetTahunan/ProfitLoss';
import TaxPlanning from './BudgetTahunan/TaxPlanning'; import TaxPlanning from './BudgetTahunan/TaxPlanning';
import FixedAssetsMovement from './BudgetTahunan/FixedAssetsMovement'; import FixedAssetsMovement from './BudgetTahunan/FixedAssetsMovement';
import CorporateAnnualTarget from './BudgetTahunan/CorporateAnnualTarget'; import CorporateAnnualTarget from './BudgetTahunan/CorporateAnnualTarget';
import { ExcelRenderer } from 'react-excel-renderer';
import UploadFile from "../library/Upload";
import { format } from 'date-fns';
export default class BudgetTahunan extends Component { export default class BudgetTahunan extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
periode: '2020',
perusahaan: 'TAP Group', perusahaan: 'TAP Group',
revisi: '0', listRevision: null,
revision: null,
visibleBudgetTahunan: true, visibleBudgetTahunan: true,
visibleBS: false, visibleBS: false,
listPeriode: null,
periode: null,
listCompany: null, listCompany: null,
company: null, company: null,
report_id: null, report_id: null,
visiblePL: false, visiblePL: false,
visibleFAM: false, visibleFAM: false,
visibleCAT: false visibleCAT: false,
listAttachment: [],
visibleUpload: false
} }
this.fileHandler = this.fileHandler.bind(this);
} }
componentDidMount() { componentDidMount() {
this.getCompanyActive() this.getCompanyActive()
} }
getReportAttachment() {
let payload = {
"company_id": this.state.company.company_id,
"periode": this.state.periode.periode,
"revision": this.state.revision.revision,
}
api.create().getMasterBudgetAtt(payload).then(response => {
if (response.data) {
if (response.data.status === "success") {
this.setState({ listAttachment: response.data.data })
}
}
// console.log(response);
})
}
getReport() { getReport() {
let payload = { let payload = {
"company_id": this.state.company.company_id, "company_id": this.state.company.company_id,
"periode": this.state.periode, "periode": this.state.periode.periode,
"report_type": "Master Budget", "report_type": "Master Budget",
} }
api.create().getReportTypeBody(payload).then(response => { api.create().getReportTypeBody(payload).then(response => {
// console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
let dataTable = response.data.data.map((item, index) => { let dataTable = response.data.data.map((item, index) => {
return [ return [
index + 1, item.number,
item.report_name, item.report_name,
"", item.revision,
item.report_id item.current_status,
item.report_id,
item.is_can_upload,
item.revision
] ]
}) })
// console.log(dataTable);
this.setState({ dataTable }) this.setState({ dataTable })
} }
} }
...@@ -71,13 +99,68 @@ export default class BudgetTahunan extends Component { ...@@ -71,13 +99,68 @@ export default class BudgetTahunan extends Component {
options: companyData, options: companyData,
getOptionLabel: (option) => titleCase(option.company_name), getOptionLabel: (option) => titleCase(option.company_name),
}; };
this.setState({ listCompany: defaultProps, company: companyData[0] }, ()=> this.getReport()) this.setState({ listCompany: defaultProps, company: companyData[0] }, () => {
this.getPeriode()
})
} else { } else {
alert(response.data.message) alert(response.data.message)
} }
}) })
} }
getPeriode() {
api.create().getPeriodeTransaction().then(response => {
let dateNow = new Date
let year = format(dateNow, 'yyyy')
if (response.data) {
if (response.data.status === "success") {
let data = response.data.data
let periodeData = data.map((item) => {
return {
periode: item,
}
})
let defaultProps = {
options: periodeData,
getOptionLabel: (option) => option.periode,
};
let index = data.sort((a, b) => a - b).findIndex((val) => val == year)
this.setState({ listPeriode: defaultProps, periode: index == -1 ? periodeData[0] : periodeData[index] }, () => {
this.getRevision()
})
}
}
})
}
getRevision() {
let payload = {
"company_id": this.state.company.company_id,
"periode": this.state.periode.periode
}
api.create().getRevision(payload).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
let data = response.data.data
let revisionData = data.map((item) => {
return {
revision: item,
}
})
let defaultProps = {
options: revisionData,
getOptionLabel: (option) => option.revision,
};
this.setState({ listRevision: defaultProps, revision: revisionData[0] }, () => {
this.getReport()
this.getReportAttachment()
})
}
}
})
}
clickDetail(item, id) { clickDetail(item, id) {
this.setState({ report_id: id }) this.setState({ report_id: id })
if (item === 'Balance Sheet') { if (item === 'Balance Sheet') {
...@@ -91,7 +174,7 @@ export default class BudgetTahunan extends Component { ...@@ -91,7 +174,7 @@ export default class BudgetTahunan extends Component {
}) })
} else if (item === 'Profit & Loss') { } else if (item === 'Profit & Loss') {
this.setState({ this.setState({
visibleBudgetTahunan: false, visibleBudgetTahunan: false,
visibleBS: false, visibleBS: false,
visiblePL: true, visiblePL: true,
visibleCAT: false, visibleCAT: false,
...@@ -100,7 +183,7 @@ export default class BudgetTahunan extends Component { ...@@ -100,7 +183,7 @@ export default class BudgetTahunan extends Component {
}) })
} else if (item === 'Tax Planning') { } else if (item === 'Tax Planning') {
this.setState({ this.setState({
visibleBudgetTahunan: false, visibleBudgetTahunan: false,
visibleBS: false, visibleBS: false,
visiblePL: false, visiblePL: false,
visibleCAT: false, visibleCAT: false,
...@@ -108,8 +191,8 @@ export default class BudgetTahunan extends Component { ...@@ -108,8 +191,8 @@ export default class BudgetTahunan extends Component {
visibleTP: true visibleTP: true
}) })
} else if (item === 'Fixed Assets Movement') { } else if (item === 'Fixed Assets Movement') {
this.setState({ this.setState({
visibleBudgetTahunan: false, visibleBudgetTahunan: false,
visibleBS: false, visibleBS: false,
visiblePL: false, visiblePL: false,
visibleCAT: false, visibleCAT: false,
...@@ -117,8 +200,8 @@ export default class BudgetTahunan extends Component { ...@@ -117,8 +200,8 @@ export default class BudgetTahunan extends Component {
visibleTP: false visibleTP: false
}) })
} else if (item === 'CAT') { } else if (item === 'CAT') {
this.setState({ this.setState({
visibleBudgetTahunan: false, visibleBudgetTahunan: false,
visibleBS: false, visibleBS: false,
visiblePL: false, visiblePL: false,
visibleCAT: true, visibleCAT: true,
...@@ -128,17 +211,88 @@ export default class BudgetTahunan extends Component { ...@@ -128,17 +211,88 @@ export default class BudgetTahunan extends Component {
} }
} }
handleChange(value, tableMeta) {
let data = this.state.dataTable
data[tableMeta.rowIndex][tableMeta.columnIndex] = value
}
fileHandler = (event) => {
let fileObj = event
ExcelRenderer(fileObj, (err, resp) => {
// console.log(resp)
if (err) {
console.log(err);
}
else {
const formData = new FormData();
formData.append("revision", Number(this.state.revisi));
formData.append("companyId", this.state.company.company_id);
formData.append("periode", Number(this.state.periode.periode));
formData.append("file", event);
this.setState({ formData })
}
})
}
uploadAttachment(formData) {
api.create().uploadAttachment(formData).then(response => {
if (response.data) {
if (response.data.status === "success") {
this.setState({ visibleUpload: false }, () => {
this.getReport()
this.getReportAttachment()
})
}
}
// console.log(response)
})
}
render() { render() {
const columns = ["#", "Jenis Laporan", const columns = ["#", "Jenis Laporan",
{ {
name: "Revision",
options: {
customBodyRender: (val, tableMeta, updateValue) => {
var list = [];
for (var i = 0; i <= tableMeta.rowData[6]; i++) {
list.push(i);
}
return (
<div style={{ display: 'flex' }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<Select
value={val}
onChange={event => {
// console.log(event.target)
updateValue(event.target.value)
this.handleChange(event.target.value, tableMeta)
}}
autoWidth
>
{list.map((item, index) =>
<MenuItem key={index} value={item}>{item}</MenuItem>
)}
</Select>
}
/>
</div >
);
}
}
}, {
name: "Status", name: "Status",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{val === "acc" ? {val === "submitted" || val === "approved" ?
<img src={Images.ceklis} style={{ width: 31, height: 24 }} /> : <img src={Images.ceklis} style={{ width: 31, height: 24 }} /> :
val === "revision" ?
<span>Revisi</span> :
null null
} }
</div > </div >
...@@ -155,17 +309,25 @@ export default class BudgetTahunan extends Component { ...@@ -155,17 +309,25 @@ export default class BudgetTahunan extends Component {
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: tableMeta.rowData[5] ? 'pointer' : null,
borderColor: 'transparent' borderColor: 'transparent'
}} }}
onClick={() => this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[3])} onClick={() =>
tableMeta.rowData[5] ? this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4]) : null
}
> >
<Typography style={{ color: '#5198ea', fontSize: 12, }}>Detail</Typography> <Typography style={{ color: tableMeta.rowData[5] ? '#5198ea' : 'GrayText', fontSize: 12, }}>Detail</Typography>
</button> </button>
</div > </div >
); );
} }
} }
}, {
name: "",
options: { display: false }
}, {
name: "",
options: { display: false }
}] }]
const dataTable = [ const dataTable = [
["1", "Balance Sheet", "done"], ["1", "Balance Sheet", "done"],
...@@ -197,6 +359,7 @@ export default class BudgetTahunan extends Component { ...@@ -197,6 +359,7 @@ export default class BudgetTahunan extends Component {
search: false search: false
} }
const periode = [ const periode = [
{ value: '2021', label: '2021' },
{ value: '2020', label: '2020' }, { value: '2020', label: '2020' },
{ value: '2019', label: '2019' }, { value: '2019', label: '2019' },
{ value: '2018', label: '2018' }, { value: '2018', label: '2018' },
...@@ -228,26 +391,28 @@ export default class BudgetTahunan extends Component { ...@@ -228,26 +391,28 @@ export default class BudgetTahunan extends Component {
</div> </div>
<div style={{ padding: 20 }}> <div style={{ padding: 20 }}>
<div> <div>
<TextField <Autocomplete
style={{ width: 250, }} {...this.state.listPeriode}
id="periode" id="periode"
select onChange={(event, newInputValue) => this.setState({ periode: newInputValue }, () => {
label="Periode" this.getReport()
this.getReportAttachment()
})}
debug
disableClearable
style={{ width: 250 }}
renderInput={(params) => <TextField {...params} label="Periode" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.periode} value={this.state.periode}
onChange={(e) => this.setState({ periode: e.target.value })} />
>
{periode.map((option) => (
<MenuItem key={option.value} value={option.value}>
{option.label}
</MenuItem>
))}
</TextField>
</div> </div>
<div style={{ marginTop: 20 }}> <div style={{ marginTop: 20 }}>
<Autocomplete <Autocomplete
{...this.state.listCompany} {...this.state.listCompany}
id="company" id="company"
onChange={(event, newInputValue) => this.setState({ company: newInputValue })} onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => {
this.getReport()
this.getReportAttachment()
})}
debug debug
disableClearable disableClearable
style={{ width: 250 }} style={{ width: 250 }}
...@@ -256,20 +421,19 @@ export default class BudgetTahunan extends Component { ...@@ -256,20 +421,19 @@ export default class BudgetTahunan extends Component {
/> />
</div> </div>
<div style={{ marginTop: 20 }}> <div style={{ marginTop: 20 }}>
<TextField <Autocomplete
style={{ width: 250, }} {...this.state.listRevision}
id="reivisi" id="revision"
select onChange={(event, newInputValue) => this.setState({ revision: newInputValue }, () => {
label="Revisi" this.getReport()
value={this.state.revisi} this.getReportAttachment()
onChange={(e) => this.setState({ revisi: e.target.value })} })}
> debug
{revisi.map((option) => ( disableClearable
<MenuItem key={option.value} value={option.value}> style={{ width: 250 }}
{option.label} renderInput={(params) => <TextField {...params} label="Revision" margin="normal" style={{ marginTop: 7 }} />}
</MenuItem> value={this.state.revision}
))} />
</TextField>
</div> </div>
<div style={{ marginTop: 20 }}> <div style={{ marginTop: 20 }}>
...@@ -284,17 +448,39 @@ export default class BudgetTahunan extends Component { ...@@ -284,17 +448,39 @@ export default class BudgetTahunan extends Component {
<Typography style={{ fontSize: '16px', color: '#4b4b4b', fontWeight: 'bold' }}>Attachment: </Typography> <Typography style={{ fontSize: '16px', color: '#4b4b4b', fontWeight: 'bold' }}>Attachment: </Typography>
</div> </div>
<div style={{ width: '50%' }}> <div style={{ width: '50%' }}>
<Typography style={{ fontSize: '16px', color: '#5198ea' }}>Upload File</Typography> <button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none'
}}
onClick={() => this.setState({ visibleUpload: true })}
>
<Typography style={{ fontSize: '16px', color: '#5198ea' }}>Upload File</Typography>
</button>
</div> </div>
</div> </div>
<div style={{ display: 'flex', marginTop: 10 }}> <div style={{ display: 'flex', marginTop: 10 }}>
<div style={{ width: '50%', paddingLeft: 20 }}> <div style={{ width: '50%', paddingLeft: 20 }}>
<Typography style={{ fontSize: '16px', color: '#4b4b4b' }}>File 1.xls </Typography> {this.state.listAttachment.length > 0 ?
<Typography style={{ fontSize: '16px', color: '#4b4b4b' }}>File 2.xls </Typography> this.state.listAttachment.map((item) => {
return (
<Typography style={{ fontSize: '16px', color: '#4b4b4b' }}>{item.attachment_name}</Typography>
)
})
: null
}
</div> </div>
<div style={{ width: '50%' }}> <div style={{ width: '50%' }}>
<Typography style={{ fontSize: '16px', color: '#ff3939' }}>Delete</Typography> {this.state.listAttachment.length > 0 ?
<Typography style={{ fontSize: '16px', color: '#ff3939' }}>Delete</Typography> this.state.listAttachment.map((item) => {
return (
<Typography style={{ fontSize: '16px', color: '#ff3939' }}>Delete</Typography>
)
})
: null
}
</div> </div>
</div> </div>
</div> </div>
...@@ -309,36 +495,70 @@ export default class BudgetTahunan extends Component { ...@@ -309,36 +495,70 @@ export default class BudgetTahunan extends Component {
</div> </div>
)} )}
{this.state.visibleUpload && (
<div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
<div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
<div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
<div className="popup-title">
<span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Upload File</span>
</div>
</div>
<div className="col-2 content-right" style={{ maxWidth: "inherit", alignSelf: 'center' }}>
<button
type="button"
className="btn btn-circle btn-white"
onClick={() => this.setState({ visibleUpload: false })}
>
<img src={Images.close} />
</button>
</div>
</div>
<UploadFile
type={this.state.uploadStatus}
percentage={this.state.percentage}
result={this.state.result}
acceptedFiles={["xlsx"]}
onHandle={(dt) => {
this.fileHandler(dt)
this.setState({ uploadStatus: 'idle', percentage: '0' })
}}
onUpload={() => this.uploadAttachment(this.state.formData)}
/>
</div>
</div>
)}
{this.state.visibleBS && ( {this.state.visibleBS && (
<BalanceSheet <BalanceSheet
report_id={this.state.report_id} report_id={this.state.report_id}
company={this.state.company} company={this.state.company}
onClickClose={()=> this.setState({ visibleBS: false, visibleBudgetTahunan: true})} onClickClose={() => this.setState({ visibleBS: false, visibleBudgetTahunan: true })}
/> />
)} )}
{this.state.visiblePL && ( {this.state.visiblePL && (
<ProfitLoss <ProfitLoss
report_id={this.state.report_id} report_id={this.state.report_id}
company={this.state.company} company={this.state.company}
onClickClose={()=> this.setState({ visiblePL: false, visibleBudgetTahunan: true})} onClickClose={() => this.setState({ visiblePL: false, visibleBudgetTahunan: true })}
/> />
)} )}
{this.state.visibleTP && ( {this.state.visibleTP && (
<TaxPlanning <TaxPlanning
report_id={this.state.report_id} report_id={this.state.report_id}
company={this.state.company} company={this.state.company}
onClickClose={() => this.setState({ visibleTP: false, visibleBudgetTahunan: true })} onClickClose={() => this.setState({ visibleTP: false, visibleBudgetTahunan: true })}
/> />
)} )}
{this.state.visibleFAM && ( {this.state.visibleFAM && (
<FixedAssetsMovement <FixedAssetsMovement
onClickClose={() => this.setState({ visibleFAM: false, visibleBudgetTahunan: true })} onClickClose={() => this.setState({ visibleFAM: false, visibleBudgetTahunan: true })}
/> />
)} )}
{this.state.visibleCAT && ( {this.state.visibleCAT && (
<CorporateAnnualTarget <CorporateAnnualTarget
onClickClose={() => this.setState({ visibleCAT: false, visibleBudgetTahunan: true })} onClickClose={() => this.setState({ visibleCAT: false, visibleBudgetTahunan: true })}
/> />
)} )}
</div > </div >
......
...@@ -38,6 +38,7 @@ export default class BalanceSheet extends Component { ...@@ -38,6 +38,7 @@ export default class BalanceSheet extends Component {
// ["Trade Receivables - Third Party", "142,668", "77,480"], // ["Trade Receivables - Third Party", "142,668", "77,480"],
] ]
} }
this.handleValue = this.handleValue.bind(this)
} }
componentDidMount() { componentDidMount() {
...@@ -61,6 +62,7 @@ export default class BalanceSheet extends Component { ...@@ -61,6 +62,7 @@ export default class BalanceSheet extends Component {
item.type_report_id, item.type_report_id,
item.id, item.id,
item.parent, item.parent,
item.formula,
item.level, item.level,
item.description item.description
]) ])
...@@ -71,23 +73,48 @@ export default class BalanceSheet extends Component { ...@@ -71,23 +73,48 @@ export default class BalanceSheet extends Component {
i.type_report_id, i.type_report_id,
i.id, i.id,
i.parent, i.parent,
i.formula,
i.level, i.level,
i.description i.description
]) ])
i.children.map(val => { i.children.map(val => {
dataTable.push([ if (val.children && val.children.length > 0) {
val.type_report_id, dataTable.push([
val.id, val.type_report_id,
val.parent, val.id,
val.level, val.parent,
val.description val.formula,
]) val.level,
val.description
])
val.children.map(items => {
console.log(items)
dataTable.push([
items.type_report_id,
items.id,
items.parent,
items.formula,
items.level,
items.description
])
})
} else {
dataTable.push([
val.type_report_id,
val.id,
val.parent,
val.formula,
val.level,
val.description
])
}
}) })
} else { } else {
dataTable.push([ dataTable.push([
i.type_report_id, i.type_report_id,
i.id, i.id,
i.parent, i.parent,
i.formula,
i.level, i.level,
i.description i.description
]) ])
...@@ -97,6 +124,7 @@ export default class BalanceSheet extends Component { ...@@ -97,6 +124,7 @@ export default class BalanceSheet extends Component {
i.type_report_id, i.type_report_id,
i.id, i.id,
i.parent, i.parent,
i.formula,
i.level, i.level,
i.description i.description
]) ])
...@@ -107,6 +135,7 @@ export default class BalanceSheet extends Component { ...@@ -107,6 +135,7 @@ export default class BalanceSheet extends Component {
item.type_report_id, item.type_report_id,
item.id, item.id,
item.parent, item.parent,
item.formula,
item.level, item.level,
item.description item.description
]) ])
...@@ -137,12 +166,14 @@ export default class BalanceSheet extends Component { ...@@ -137,12 +166,14 @@ export default class BalanceSheet extends Component {
let data = this.state.dataTable let data = this.state.dataTable
let indexParent = data.findIndex((val) => val[1] == data[tableMeta.rowIndex][2]) let indexParent = data.findIndex((val) => val[1] == data[tableMeta.rowIndex][2])
if (indexParent > 0) { if (indexParent > 0) {
console.log(indexParent)
let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
let jagain = data[indexParent][tableMeta.columnIndex] let jagain = data[indexParent][tableMeta.columnIndex]
a = data[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val)) a = data[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val))
} else { } else {
data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
} }
this.forceUpdate()
// console.log(this.state.dataTable) // console.log(this.state.dataTable)
// this.setState({ // this.setState({
// data: a, // data: a,
...@@ -170,6 +201,11 @@ export default class BalanceSheet extends Component { ...@@ -170,6 +201,11 @@ export default class BalanceSheet extends Component {
options: { options: {
display: false display: false
} }
}, {
name: "",
options: {
display: false
}
}, { }, {
name: "Account", name: "Account",
options: { options: {
...@@ -182,12 +218,12 @@ export default class BalanceSheet extends Component { ...@@ -182,12 +218,12 @@ export default class BalanceSheet extends Component {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ width: 388 }}> <div style={{ width: 388 }}>
{tableMeta.rowData[3] == 0 ? {tableMeta.rowData[4] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(val).toUpperCase()}</span> <span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(val).toUpperCase()}</span>
: :
tableMeta.rowData[3] === 1 ? tableMeta.rowData[4] === 1 ?
<span style={{ fontSize: 12, marginLeft: 20 }}>{val}</span> : <span style={{ fontSize: 12, marginLeft: 20 * Number(tableMeta.rowData[4]) }}>{val}</span> :
<span style={{ fontSize: 12, marginLeft: 40 }}>{val}</span> <span style={{ fontSize: 12, marginLeft: 20 * Number(tableMeta.rowData[4]) }}>{val}</span>
} }
</div> </div>
) )
......
...@@ -56,8 +56,11 @@ export default class ProfitLoss extends Component { ...@@ -56,8 +56,11 @@ export default class ProfitLoss extends Component {
if (response.data.status === "success") { if (response.data.status === "success") {
let dataTable = [] let dataTable = []
response.data.data.map((item, index) => { response.data.data.map((item, index) => {
if (item.children.length > 0) { if (item.children && item.children.length > 0) {
dataTable.push([ dataTable.push([
item.type_report_id,
item.id,
item.parent,
item.level, item.level,
item.description item.description
]) ])
...@@ -65,23 +68,35 @@ export default class ProfitLoss extends Component { ...@@ -65,23 +68,35 @@ export default class ProfitLoss extends Component {
if (i.children) { if (i.children) {
if (i.children.length > 0) { if (i.children.length > 0) {
dataTable.push([ dataTable.push([
i.type_report_id,
i.id,
i.parent,
i.level, i.level,
i.description i.description
]) ])
i.children.map(val => { i.children.map(val => {
dataTable.push([ dataTable.push([
val.type_report_id,
val.id,
val.parent,
val.level, val.level,
val.description val.description
]) ])
}) })
} else { } else {
dataTable.push([ dataTable.push([
i.type_report_id,
i.id,
i.parent,
i.level, i.level,
i.description i.description
]) ])
} }
} else { } else {
dataTable.push([ dataTable.push([
i.type_report_id,
i.id,
i.parent,
i.level, i.level,
i.description i.description
]) ])
...@@ -89,6 +104,9 @@ export default class ProfitLoss extends Component { ...@@ -89,6 +104,9 @@ export default class ProfitLoss extends Component {
}) })
} else { } else {
dataTable.push([ dataTable.push([
item.type_report_id,
item.id,
item.parent,
item.level, item.level,
item.description item.description
]) ])
...@@ -101,14 +119,34 @@ export default class ProfitLoss extends Component { ...@@ -101,14 +119,34 @@ export default class ProfitLoss extends Component {
}) })
} }
handleValue(data) {
let total = 0
this.state.dataTable.map((item, index) => {
if (data.rowData[1] == item[2]) {
total = item[data.columnIndex] == undefined ? (total + 0) : (total + item[data.columnIndex])
}
})
let indexParent = this.state.dataTable.findIndex((val) => val[1] == this.state.dataTable[data.rowIndex][2])
let a = this.state.dataTable[data.rowIndex][data.columnIndex] = total
// console.log(indexParent);
return a
}
handleChange(value, tableMeta) { handleChange(value, tableMeta) {
let val = String(value).split(",").join("")
let data = this.state.dataTable let data = this.state.dataTable
let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = value let indexParent = data.findIndex((val) => val[1] == data[tableMeta.rowIndex][2])
this.setState({ if (indexParent > 0) {
data: a let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
}, () => console.log(this.state.dataTable)) let jagain = data[indexParent][tableMeta.columnIndex]
// let a = data[0].tableMeta.tableData[tableMeta.rowIndex] === value a = data[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val))
// console.log(data) } else {
data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
}
// console.log(this.state.dataTable)
// this.setState({
// data: a,
// }, () => console.log(this.state.dataTable))
} }
render() { render() {
...@@ -117,11 +155,26 @@ export default class ProfitLoss extends Component { ...@@ -117,11 +155,26 @@ export default class ProfitLoss extends Component {
options: { options: {
display: false display: false
} }
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, { }, {
name: "Account", name: "Account",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#354960', width: 388 }}> <TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#354960', width: 300 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'left' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'left' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
...@@ -129,10 +182,10 @@ export default class ProfitLoss extends Component { ...@@ -129,10 +182,10 @@ export default class ProfitLoss extends Component {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ width: 388 }}> <div style={{ width: 388 }}>
{tableMeta.rowData[0] == 0 ? {tableMeta.rowData[3] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(val).toUpperCase()}</span> <span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(val).toUpperCase()}</span>
: :
tableMeta.rowData[0] === 1? tableMeta.rowData[3] === 1 ?
<span style={{ fontSize: 12, marginLeft: 20 }}>{val}</span> : <span style={{ fontSize: 12, marginLeft: 20 }}>{val}</span> :
<span style={{ fontSize: 12, marginLeft: 40 }}>{val}</span> <span style={{ fontSize: 12, marginLeft: 40 }}>{val}</span>
} }
...@@ -140,22 +193,128 @@ export default class ProfitLoss extends Component { ...@@ -140,22 +193,128 @@ export default class ProfitLoss extends Component {
) )
} }
} }
}, {
name: "Keterangan",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<TextField
style={{ color: "#5198ea", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
InputProps={{ disableUnderline: true}}
inputProps={{
style: {
fontSize: 12,
color: "#5198ea"
}
}}
onChange={event => {
// console.log(event.target)
updateValue(event.target.value)
this.handleChange(event.target.value, tableMeta)
}}
/>
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<TextField
style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
InputProps={{ disableUnderline: true }}
placeholder=""
disabled={true}
/>
</span>
:
tableMeta.rowData[0] === 1 ?
<span>-</span>
:
<span>validasi</span>
}
</div>
)
}
}
}, { }, {
name: "31 Dec 2020 Actual", name: "31 Dec 2020 Actual",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell key={columnMeta.index} style={{ ...style2, top: 0, zIndex: 102, backgroundColor: '#354960', width: 96 }}> <TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
setCellProps: () => ({ // customHeadRender: (columnMeta) => (
style: { // <TableCell key={columnMeta.index} style={{ ...style2, top: 0, zIndex: 102, backgroundColor: '#354960', width: 96 }}>
position: "sticky", // <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
left: 420, // </TableCell>
background: "white", // ),
zIndex: 101 // setCellProps: () => ({
} // style: {
}) // position: "sticky",
// left: 420,
// background: "white",
// zIndex: 101
// }
// }),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
onChange={event => {
// console.log(event.target)
updateValue(event.target.value)
this.handleChange(event.target.value, tableMeta)
}}
/>
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={this.handleValue(tableMeta)}
/>
</span>
:
tableMeta.rowData[0] === 1 ?
<span>-</span>
:
<span>validasi</span>
}
</div>
)
}
} }
}, { }, {
name: "January 2021", name: "January 2021",
...@@ -168,25 +327,12 @@ export default class ProfitLoss extends Component { ...@@ -168,25 +327,12 @@ export default class ProfitLoss extends Component {
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
{tableMeta.rowIndex === 3 || tableMeta.rowIndex === 4 || tableMeta.rowIndex === 9 ? {tableMeta.rowData[0] === 4 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={value} value={value}
control={ control={
// <Input
// value={this.formatValue(value)}
// style={{}}
// inputProps={{
// style: {
// color: "#5198ea",
// fontSize: 12,
// textAlign: 'right'
// }
// }}
// disableUnderline={true}
// inputStyle={{ color: 'red' }}
// />
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
...@@ -194,6 +340,7 @@ export default class ProfitLoss extends Component { ...@@ -194,6 +340,7 @@ export default class ProfitLoss extends Component {
placeholder="" placeholder=""
value={value} value={value}
onChange={event => { onChange={event => {
// console.log(event.target)
updateValue(event.target.value) updateValue(event.target.value)
this.handleChange(event.target.value, tableMeta) this.handleChange(event.target.value, tableMeta)
}} }}
...@@ -201,7 +348,22 @@ export default class ProfitLoss extends Component { ...@@ -201,7 +348,22 @@ export default class ProfitLoss extends Component {
} }
/> />
</div> : </div> :
<span style={{ fontSize: 12, textAlign: 'right' }}>{value === "" ? "-" : value}</span> tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={this.handleValue(tableMeta)}
/>
</span>
:
tableMeta.rowData[0] === 1 ?
<span>-</span>
:
<span>validasi</span>
} }
</div> </div>
) )
...@@ -215,10 +377,47 @@ export default class ProfitLoss extends Component { ...@@ -215,10 +377,47 @@ export default class ProfitLoss extends Component {
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
customBodyRender: (val) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ width: 96 }}> <div style={{ textAlign: 'right' }}>
{val} {tableMeta.rowData[0] === 4 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
onChange={event => {
// console.log(event.target)
updateValue(event.target.value)
this.handleChange(event.target.value, tableMeta)
}}
/>
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={this.handleValue(tableMeta)}
/>
</span>
:
tableMeta.rowData[0] === 1 ?
<span>-</span>
:
<span>validasi</span>
}
</div> </div>
) )
} }
...@@ -231,10 +430,47 @@ export default class ProfitLoss extends Component { ...@@ -231,10 +430,47 @@ export default class ProfitLoss extends Component {
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
customBodyRender: (val) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ width: 96 }}> <div style={{ textAlign: 'right' }}>
{val} {tableMeta.rowData[0] === 4 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
onChange={event => {
// console.log(event.target)
updateValue(event.target.value)
this.handleChange(event.target.value, tableMeta)
}}
/>
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={this.handleValue(tableMeta)}
/>
</span>
:
tableMeta.rowData[0] === 1 ?
<span>-</span>
:
<span>validasi</span>
}
</div> </div>
) )
} }
...@@ -247,10 +483,47 @@ export default class ProfitLoss extends Component { ...@@ -247,10 +483,47 @@ export default class ProfitLoss extends Component {
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
customBodyRender: (val) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ width: 96 }}> <div style={{ textAlign: 'right' }}>
{val} {tableMeta.rowData[0] === 4 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
onChange={event => {
// console.log(event.target)
updateValue(event.target.value)
this.handleChange(event.target.value, tableMeta)
}}
/>
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={this.handleValue(tableMeta)}
/>
</span>
:
tableMeta.rowData[0] === 1 ?
<span>-</span>
:
<span>validasi</span>
}
</div> </div>
) )
} }
...@@ -263,10 +536,47 @@ export default class ProfitLoss extends Component { ...@@ -263,10 +536,47 @@ export default class ProfitLoss extends Component {
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
customBodyRender: (val) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ width: 96 }}> <div style={{ textAlign: 'right' }}>
{val} {tableMeta.rowData[0] === 4 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
onChange={event => {
// console.log(event.target)
updateValue(event.target.value)
this.handleChange(event.target.value, tableMeta)
}}
/>
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={this.handleValue(tableMeta)}
/>
</span>
:
tableMeta.rowData[0] === 1 ?
<span>-</span>
:
<span>validasi</span>
}
</div> </div>
) )
} }
...@@ -279,10 +589,47 @@ export default class ProfitLoss extends Component { ...@@ -279,10 +589,47 @@ export default class ProfitLoss extends Component {
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
customBodyRender: (val) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ width: 96 }}> <div style={{ textAlign: 'right' }}>
{val} {tableMeta.rowData[0] === 4 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
onChange={event => {
// console.log(event.target)
updateValue(event.target.value)
this.handleChange(event.target.value, tableMeta)
}}
/>
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={this.handleValue(tableMeta)}
/>
</span>
:
tableMeta.rowData[0] === 1 ?
<span>-</span>
:
<span>validasi</span>
}
</div> </div>
) )
} }
......
...@@ -39,7 +39,7 @@ class ForgotPassword extends Component { ...@@ -39,7 +39,7 @@ class ForgotPassword extends Component {
var isEmail = this.isEmail(this.state.email) var isEmail = this.isEmail(this.state.email)
if (this.state.email.trim() == "") { if (this.state.email.trim() == "") {
this.setState({ errorEmail: true, msgEmail: 'Email is required.' }) this.setState({ errorEmail: true, msgEmail: 'Email Cannot be Empty.' })
} else if (!isEmail) { } else if (!isEmail) {
this.setState({ errorEmail: true, msgEmail: 'Email format is not correct.' }) this.setState({ errorEmail: true, msgEmail: 'Email format is not correct.' })
} else { } else {
......
...@@ -36,7 +36,9 @@ class Login extends Component { ...@@ -36,7 +36,9 @@ class Login extends Component {
rememberMe: false, rememberMe: false,
alert: false, alert: false,
tipeAlert: '', tipeAlert: '',
messageAlert: '' messageAlert: '',
width: 0,
height: 0
} }
} }
...@@ -47,6 +49,14 @@ class Login extends Component { ...@@ -47,6 +49,14 @@ class Login extends Component {
console.log(email) console.log(email)
} }
getWindowDimensions() {
const { innerWidth: width, innerHeight: height } = window;
this.setState({
width,
height
})
}
handleChange(e) { handleChange(e) {
let data = this.state let data = this.state
this.setState({ ...data, [e.target.name]: e.target.value }) this.setState({ ...data, [e.target.name]: e.target.value })
...@@ -65,11 +75,11 @@ class Login extends Component { ...@@ -65,11 +75,11 @@ class Login extends Component {
validateLogin() { validateLogin() {
var isEmail = this.isEmail(this.state.email) var isEmail = this.isEmail(this.state.email)
if (this.state.email.trim() == "") { if (this.state.email.trim() == "") {
this.setState({ errorEmail: true, msgEmail: 'Email is required.' }) this.setState({ errorEmail: true, msgEmail: 'Email Cannot be Empty.' })
} else if (!isEmail) { } else if (!isEmail) {
this.setState({ errorEmail: true, msgEmail: 'Email format is not correct.' }) this.setState({ errorEmail: true, msgEmail: 'Email format is not correct.' })
} else if (this.state.password.trim() == "") { } else if (this.state.password.trim() == "") {
this.setState({ errorPassword: true, msgPassword: 'Password is required.' }) this.setState({ errorPassword: true, msgPassword: 'Password Cannot be Empty.' })
} else { } else {
this.login() this.login()
} }
...@@ -136,19 +146,19 @@ class Login extends Component { ...@@ -136,19 +146,19 @@ class Login extends Component {
{this.state.messageAlert} {this.state.messageAlert}
</Alert> </Alert>
</Snackbar> </Snackbar>
<div style={{ width: '50%', height: '100vh', display: 'flex', justifyContent: 'center', alignItems: 'center', flexDirection: 'column' }}> <div style={{ width: '50%', display: 'grid' }}>
<img src={Images.tia} /> <img src={Images.meeting} style={{ objectFit: 'fill', width: '100%', height: '100%' }}/>
<img src={Images.imageLogin} style={{ marginTop: 30 }} /> {/* <img src={Images.imageLogin} style={{ marginTop: 30 }} /> */}
</div> </div>
<div style={{ width: '50%', height: '100vh', backgroundColor: '#152d40', display: 'flex', justifyContent: 'center', alignItems: 'center', flexDirection: 'column' }}> <div style={{ width: '50%', height: '100vh', backgroundColor: '#263b80', display: 'flex', justifyContent: 'center', alignItems: 'center', flexDirection: 'column' }}>
<form onSubmit={(e) => { <form onSubmit={(e) => {
e.preventDefault() e.preventDefault()
this.validateLogin() this.validateLogin()
}} }}
> >
<div style={{ paddingTop: 56, paddingLeft: 54, paddingRight: 54, display: 'flex', flexDirection: 'column', width: 388, height: (this.state.msgEmail.length > 45 ? 466 : 441), borderRadius: 12, boxShadow: '0 2 4 0 rgba(0, 0, 0, 0.2)', backgroundColor: '#ffffff' }}> <div style={{ paddingTop: 56, padding: 65, display: 'flex', flexDirection: 'column', height: (this.state.msgEmail.length > 45 ? 466 : 441), borderRadius: 12, boxShadow: '0 2 4 0 rgba(0, 0, 0, 0.2)', backgroundColor: '#ffffff' }}>
<img src={Images.tia} /> <img src={Images.triputraBlack} style={{ height: 59, width: 175, alignSelf: 'center'}} />
<TextField <TextField
label={<Typography style={{ fontSize: 12, fontFamily: 'Nunito Sans, sans-serif' }}>Email *</Typography>} label={<Typography style={{ fontSize: 12, fontFamily: 'Nunito Sans, sans-serif' }}>Email *</Typography>}
...@@ -207,6 +217,7 @@ class Login extends Component { ...@@ -207,6 +217,7 @@ class Login extends Component {
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none'
}} }}
disabled={this.state.email.trim() == '' && this.state.password.trim() == '' ? true : false} disabled={this.state.email.trim() == '' && this.state.password.trim() == '' ? true : false}
// onClick={() => this.validateLogin()} // onClick={() => this.validateLogin()}
......
...@@ -346,13 +346,13 @@ export default class CreateParameter extends Component { ...@@ -346,13 +346,13 @@ export default class CreateParameter extends Component {
} else if ((!R.isNil(this.state.tempData.max_value) && R.isNil(this.state.tempData.min_value)) || (!R.isEmpty(this.state.tempData.max_value) && R.isEmpty(this.state.tempData.min_value))) { } else if ((!R.isNil(this.state.tempData.max_value) && R.isNil(this.state.tempData.min_value)) || (!R.isEmpty(this.state.tempData.max_value) && R.isEmpty(this.state.tempData.min_value))) {
this.setState({ errorMinValue: true, msgErrorMinValue: 'Min Value Cannot be Empty.' }) this.setState({ errorMinValue: true, msgErrorMinValue: 'Min Value Cannot be Empty.' })
} else if (R.isNil(this.state.tempData.start_date)) { } else if (R.isNil(this.state.tempData.start_date)) {
this.setState({ errorStartDate: true, msgErrorStartDate: 'Start date Cannot be Empty.' }) this.setState({ errorStartDate: true, msgErrorStartDate: 'Valid From Cannot be Empty.' })
// } else if (R.isNil(this.state.tempData.order)) { // } else if (R.isNil(this.state.tempData.order)) {
// this.setState({ errorOrder: true, msgErrorOrder: 'Order tidak boleh kosong' }) // this.setState({ errorOrder: true, msgErrorOrder: 'Order tidak boleh kosong' })
} else if ((!R.isNil(this.state.tempData.min_value) && R.isNil(this.state.tempData.max_value)) || (!R.isEmpty(this.state.tempData.min_value) && R.isEmpty(this.state.tempData.max_value))) { } else if ((!R.isNil(this.state.tempData.min_value) && R.isNil(this.state.tempData.max_value)) || (!R.isEmpty(this.state.tempData.min_value) && R.isEmpty(this.state.tempData.max_value))) {
this.setState({ errorMaxValue: true, msgErrorMaxValue: 'Max Value Cannot be Empty.' }) this.setState({ errorMaxValue: true, msgErrorMaxValue: 'Max Value Cannot be Empty.' })
} else if (R.isNil(this.state.tempData.end_date)) { } else if (R.isNil(this.state.tempData.end_date)) {
this.setState({ errorEndDate: true, msgErrorEndDate: 'End date Cannot be Empty.' }) this.setState({ errorEndDate: true, msgErrorEndDate: 'Valid To Cannot be Empty.' })
} else { } else {
this.updateParameter() this.updateParameter()
} }
...@@ -372,13 +372,13 @@ export default class CreateParameter extends Component { ...@@ -372,13 +372,13 @@ export default class CreateParameter extends Component {
} else if ((!R.isNil(this.state.maxValue) && R.isNil(this.state.minValue)) || (!R.isNil(this.state.maxValue) && R.isEmpty(this.state.minValue))) { } else if ((!R.isNil(this.state.maxValue) && R.isNil(this.state.minValue)) || (!R.isNil(this.state.maxValue) && R.isEmpty(this.state.minValue))) {
this.setState({ errorMinValue: true, msgErrorMinValue: 'Min Value Cannot be Empty.' }) this.setState({ errorMinValue: true, msgErrorMinValue: 'Min Value Cannot be Empty.' })
} else if (R.isNil(this.state.startDate)) { } else if (R.isNil(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorStartDate: 'Start date Cannot be Empty.' }) this.setState({ errorStartDate: true, msgErrorStartDate: 'Valid From Cannot be Empty.' })
// } else if (R.isNil(this.state.order)) { // } else if (R.isNil(this.state.order)) {
// this.setState({ errorOrder: true, msgErrorOrder: 'Order tidak boleh kosong' }) // this.setState({ errorOrder: true, msgErrorOrder: 'Order tidak boleh kosong' })
} else if ((!R.isNil(this.state.minValue) && R.isNil(this.state.maxValue)) || (!R.isNil(this.state.minValue) && R.isEmpty(this.state.maxValue))) { } else if ((!R.isNil(this.state.minValue) && R.isNil(this.state.maxValue)) || (!R.isNil(this.state.minValue) && R.isEmpty(this.state.maxValue))) {
this.setState({ errorMaxValue: true, msgErrorMaxValue: 'Max Value Cannot be Empty.' }) this.setState({ errorMaxValue: true, msgErrorMaxValue: 'Max Value Cannot be Empty.' })
} else if (R.isNil(this.state.endDate)) { } else if (R.isNil(this.state.endDate)) {
this.setState({ errorEndDate: true, msgErrorEndDate: 'End date Cannot be Empty' }) this.setState({ errorEndDate: true, msgErrorEndDate: 'Valid To Cannot be Empty' })
} else { } else {
this.createParameter() this.createParameter()
} }
...@@ -586,7 +586,7 @@ export default class CreateParameter extends Component { ...@@ -586,7 +586,7 @@ export default class CreateParameter extends Component {
<DatePicker <DatePicker
margin="normal" margin="normal"
id="start_date" id="start_date"
label="Start Date" label="Valid From"
format="dd MMMM yyyy" format="dd MMMM yyyy"
value={this.state.tempData === null ? '' : this.state.tempData.start_date} value={this.state.tempData === null ? '' : this.state.tempData.start_date}
error={this.state.errorStartDate} error={this.state.errorStartDate}
...@@ -753,7 +753,7 @@ export default class CreateParameter extends Component { ...@@ -753,7 +753,7 @@ export default class CreateParameter extends Component {
<DatePicker <DatePicker
margin="normal" margin="normal"
id="end_date" id="end_date"
label="End Date" label="Valid To"
format="dd MMMM yyyy" format="dd MMMM yyyy"
error={this.state.errorEndDate} error={this.state.errorEndDate}
helperText={this.state.msgErrorEndDate} helperText={this.state.msgErrorEndDate}
...@@ -962,7 +962,7 @@ export default class CreateParameter extends Component { ...@@ -962,7 +962,7 @@ export default class CreateParameter extends Component {
<DatePicker <DatePicker
margin="normal" margin="normal"
id="startDate" id="startDate"
label="Start Date" label="Valid From"
format="dd MMMM yyyy" format="dd MMMM yyyy"
error={this.state.errorStartDate} error={this.state.errorStartDate}
helperText={this.state.msgErrorStartDate} helperText={this.state.msgErrorStartDate}
...@@ -1119,7 +1119,7 @@ export default class CreateParameter extends Component { ...@@ -1119,7 +1119,7 @@ export default class CreateParameter extends Component {
<DatePicker <DatePicker
margin="normal" margin="normal"
id="endDate" id="endDate"
label="End Date" label="Valid To"
format="dd MMMM yyyy" format="dd MMMM yyyy"
error={this.state.errorEndDate} error={this.state.errorEndDate}
helperText={this.state.msgErrorEndDate} helperText={this.state.msgErrorEndDate}
......
...@@ -256,7 +256,7 @@ export default class Parameter extends Component { ...@@ -256,7 +256,7 @@ export default class Parameter extends Component {
] ]
}) })
let columns = [ let columns = [
"Data Ke-", "Data",
{ {
name: "Group", name: "Group",
options: { options: {
...@@ -458,7 +458,7 @@ export default class Parameter extends Component { ...@@ -458,7 +458,7 @@ export default class Parameter extends Component {
} }
}, },
{ {
name: "Berlaku Mulai", name: "Valid To",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
...@@ -483,7 +483,7 @@ export default class Parameter extends Component { ...@@ -483,7 +483,7 @@ export default class Parameter extends Component {
} }
}, },
{ {
name: "Berlaku Hingga", name: "Valid From",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
......
...@@ -666,7 +666,7 @@ export default class ReportItems extends Component { ...@@ -666,7 +666,7 @@ export default class ReportItems extends Component {
} }
}, },
{ {
name: "Company", name: "Company Name",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
......
...@@ -86,7 +86,7 @@ export default class UnitBisnis extends Component { ...@@ -86,7 +86,7 @@ export default class UnitBisnis extends Component {
] ]
}) })
let columns = [ let columns = [
"Data Ke-", "Data",
{ {
name: "Business Unit", name: "Business Unit",
options: { options: {
...@@ -113,7 +113,7 @@ export default class UnitBisnis extends Component { ...@@ -113,7 +113,7 @@ export default class UnitBisnis extends Component {
} }
}, },
{ {
name: "Berlaku Mulai", name: "Valid From",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
...@@ -138,7 +138,7 @@ export default class UnitBisnis extends Component { ...@@ -138,7 +138,7 @@ export default class UnitBisnis extends Component {
} }
}, },
{ {
name: "Berakhir Hingga", name: "Valid To",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
......
...@@ -147,32 +147,32 @@ export default class CreateReportItems extends Component { ...@@ -147,32 +147,32 @@ export default class CreateReportItems extends Component {
validasi() { validasi() {
// alert('coba ya') // alert('coba ya')
if (R.isNil(this.state.reportType)) { if (R.isNil(this.state.reportType)) {
this.setState({errorJenisLaporan: true, msgErrorJenisLaporan: 'Report type is required.'}) this.setState({errorJenisLaporan: true, msgErrorJenisLaporan: 'Report type cannot be empty.'})
} else if (R.isNil(this.state.company)){ } else if (R.isNil(this.state.company)){
this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company is required.'}) this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company name cannot be empty.'})
} else if (R.isEmpty(this.state.order)) { } else if (R.isEmpty(this.state.order)) {
this.setState({ errorOrder: true, msgErrorOrder: 'Order is required.' }) this.setState({ errorOrder: true, msgErrorOrder: 'Order cannot be empty.' })
} }
else if (R.isEmpty(this.state.description)) { else if (R.isEmpty(this.state.description)) {
this.setState({ errorDesc: true, msgErrorDesc: 'Description is required.' }) this.setState({ errorDesc: true, msgErrorDesc: 'Description cannot be empty.' })
} }
else if (R.isNil(this.state.InputType)) { else if (R.isNil(this.state.InputType)) {
this.setState({ errorTipeData: true, msgErrorTipeData: 'Data type is required.' }) this.setState({ errorTipeData: true, msgErrorTipeData: 'Data type cannot be empty.' })
} }
else if (this.state.disabledFormula === false && R.isEmpty(this.state.formula)) { else if (this.state.disabledFormula === false && R.isEmpty(this.state.formula)) {
this.setState({ errorFormula: true, msgErrorFormula: 'Formula is required.' }) this.setState({ errorFormula: true, msgErrorFormula: 'Formula cannot be empty.' })
} }
else if (this.state.disabledValue === false && R.isEmpty(this.state.realVal)) { else if (this.state.disabledValue === false && R.isEmpty(this.state.realVal)) {
this.setState({ errorRV: true, msgErrorRV: 'True value is required.' }) this.setState({ errorRV: true, msgErrorRV: 'True value cannot be empty.' })
} }
else if (this.state.disabledCondt === false && R.isEmpty(this.state.condition)) { else if (this.state.disabledCondt === false && R.isEmpty(this.state.condition)) {
this.setState({ errorCondition: true, msgErrorCondition: 'False condition is required.' }) this.setState({ errorCondition: true, msgErrorCondition: 'False condition cannot be empty.' })
} }
else if (R.isNil(this.state.startDate)) { else if (R.isNil(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorSD: 'Start date is required.' }) this.setState({ errorStartDate: true, msgErrorSD: 'Valid From cannot be empty.' })
} }
else if (R.isNil(this.state.endDate)) { else if (R.isNil(this.state.endDate)) {
this.setState({ errorEndDate: true, msgErrorED: 'End date is required.' }) this.setState({ errorEndDate: true, msgErrorED: 'Valid To cannot be empty.' })
} }
else { else {
this.addReportItems() this.addReportItems()
......
...@@ -128,25 +128,25 @@ export default class EditReportItems extends Component { ...@@ -128,25 +128,25 @@ export default class EditReportItems extends Component {
validasi() { validasi() {
// alert('coba ya') // alert('coba ya')
if (R.isNil(this.state.reportType)){ if (R.isNil(this.state.reportType)){
this.setState({errorJenisLaporan: true, msgErrorJenisLaporan: 'Report type is required.'}) this.setState({errorJenisLaporan: true, msgErrorJenisLaporan: 'Report type cannot be empty.'})
} else if (R.isNil(this.state.company)){ } else if (R.isNil(this.state.company)){
this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company is required.'}) this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company name cannot be empty.'})
} else if (R.isEmpty(this.state.tempData.order)) { } else if (R.isEmpty(this.state.tempData.order)) {
this.setState({ errorOrder: true, msgErrorOrder: 'Order is required..' }) this.setState({ errorOrder: true, msgErrorOrder: 'Order cannot be empty.' })
} else if (R.isEmpty(this.state.tempData.description)) { } else if (R.isEmpty(this.state.tempData.description)) {
this.setState({ errorDesc: true, msgErrorDesc: 'Description is required..' }) this.setState({ errorDesc: true, msgErrorDesc: 'Description cannot be empty.' })
} else if (R.isNil(this.state.InputType)) { } else if (R.isNil(this.state.InputType)) {
this.setState({ errorTipeData: true, msgErrorTipeData: 'Data type is required.' }) this.setState({ errorTipeData: true, msgErrorTipeData: 'Data type cannot be empty.' })
} else if ((this.state.InputType.type_item_report_name === 'Formula' && R.isEmpty(this.state.tempData.formula)) || (this.state.InputType.type_item_report_name === 'Validation' && R.isEmpty(this.state.tempData.formula))) { } else if ((this.state.InputType.type_item_report_name === 'Formula' && R.isEmpty(this.state.tempData.formula)) || (this.state.InputType.type_item_report_name === 'Validation' && R.isEmpty(this.state.tempData.formula))) {
this.setState({ errorFormula: true, msgErrorFormula: 'Formula is required.' }) this.setState({ errorFormula: true, msgErrorFormula: 'Formula cannot be empty.' })
} else if (this.state.InputType.type_item_report_name === 'Validation' && R.isEmpty(this.state.tempData.condition_it_should_be)) { } else if (this.state.InputType.type_item_report_name === 'Validation' && R.isEmpty(this.state.tempData.condition_it_should_be)) {
this.setState({ errorRV: true, msgErrorRV: 'True value is required.' }) this.setState({ errorRV: true, msgErrorRV: 'True value cannot be empty.' })
} else if (this.state.InputType.type_item_report_name === 'Validation' && R.isNil(this.state.tempData.condition_if_wrong)) { } else if (this.state.InputType.type_item_report_name === 'Validation' && R.isNil(this.state.tempData.condition_if_wrong)) {
this.setState({ errorCondition: true, msgErrorCondition: 'False condition is required.' }) this.setState({ errorCondition: true, msgErrorCondition: 'False condition cannot be empty.' })
} else if (R.isNil(this.state.tempData.start_date)) { } else if (R.isNil(this.state.tempData.start_date)) {
this.setState({ errorStartDate: true, msgErrorSD: 'Start date is required.' }) this.setState({ errorStartDate: true, msgErrorSD: 'Valid From cannot be empty.' })
} else if (R.isNil(this.state.tempData.end_date)) { } else if (R.isNil(this.state.tempData.end_date)) {
this.setState({ errorEndDate: true, msgErrorED: 'End date is required.' }) this.setState({ errorEndDate: true, msgErrorED: 'Valid To cannot be empty.' })
} else { } else {
this.updateReportItems() this.updateReportItems()
} }
......
...@@ -114,9 +114,9 @@ export default class CreateUnitBisnis extends Component { ...@@ -114,9 +114,9 @@ export default class CreateUnitBisnis extends Component {
if (R.isEmpty(this.state.name)) { if (R.isEmpty(this.state.name)) {
this.setState({ errorName: true, msgErrorName: 'Business unit Cannot be Empty.' }) this.setState({ errorName: true, msgErrorName: 'Business unit Cannot be Empty.' })
} else if (R.isEmpty(this.state.startDate)) { } else if (R.isEmpty(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorStartDate: 'Start date Cannot be Empty.' }) this.setState({ errorStartDate: true, msgErrorStartDate: 'Valid From Cannot be Empty.' })
} else if (R.isEmpty(this.state.endDate) || this.state.endDate === null) { } else if (R.isEmpty(this.state.endDate) || this.state.endDate === null) {
this.setState({ errorEndDate: true, msgErrorEndDate: 'End date Cannot be Empty.' }) this.setState({ errorEndDate: true, msgErrorEndDate: 'Valid To Cannot be Empty.' })
} else { } else {
let payload = { let payload = {
"business_unit_id": this.state.id, "business_unit_id": this.state.id,
...@@ -132,9 +132,9 @@ export default class CreateUnitBisnis extends Component { ...@@ -132,9 +132,9 @@ export default class CreateUnitBisnis extends Component {
if (R.isEmpty(this.state.name)) { if (R.isEmpty(this.state.name)) {
this.setState({ errorName: true, msgErrorName: 'Business unit Cannot be Empty.' }) this.setState({ errorName: true, msgErrorName: 'Business unit Cannot be Empty.' })
} else if (R.isNil(this.state.startDate)) { } else if (R.isNil(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorStartDate: 'Start date Cannot be Empty.' }) this.setState({ errorStartDate: true, msgErrorStartDate: 'Valid From Cannot be Empty.' })
} else if (R.isNil(this.state.endDate)) { } else if (R.isNil(this.state.endDate)) {
this.setState({ errorEndDate: true, msgErrorEndDate: 'End date Cannot be Empty.' }) this.setState({ errorEndDate: true, msgErrorEndDate: 'Valid To Cannot be Empty.' })
} else { } else {
let payload = { let payload = {
"business_unit_name": this.state.name, "business_unit_name": this.state.name,
...@@ -202,7 +202,7 @@ export default class CreateUnitBisnis extends Component { ...@@ -202,7 +202,7 @@ export default class CreateUnitBisnis extends Component {
<DatePicker <DatePicker
margin="normal" margin="normal"
id="startDate" id="startDate"
label="Start Date" label="Valid From"
format="dd MMMM yyyy" format="dd MMMM yyyy"
value={this.state.startDate} value={this.state.startDate}
onChange={(e) => this.handleChange(e, 'start_date')} onChange={(e) => this.handleChange(e, 'start_date')}
...@@ -287,7 +287,7 @@ export default class CreateUnitBisnis extends Component { ...@@ -287,7 +287,7 @@ export default class CreateUnitBisnis extends Component {
<DatePicker <DatePicker
margin="normal" margin="normal"
id="startDate" id="startDate"
label="End Date" label="Valid To"
format="dd MMMM yyyy" format="dd MMMM yyyy"
error={this.state.errorEndDate} error={this.state.errorEndDate}
helperText={this.state.msgErrorEndDate} helperText={this.state.msgErrorEndDate}
...@@ -390,7 +390,7 @@ export default class CreateUnitBisnis extends Component { ...@@ -390,7 +390,7 @@ export default class CreateUnitBisnis extends Component {
<DatePicker <DatePicker
margin="normal" margin="normal"
id="startDate" id="startDate"
label="Start Date" label="Valid From"
format="dd MMMM yyyy" format="dd MMMM yyyy"
value={this.state.startDate == "" ? null : this.state.startDate} value={this.state.startDate == "" ? null : this.state.startDate}
onChange={(e) => this.handleChange(e, 'start_date')} onChange={(e) => this.handleChange(e, 'start_date')}
...@@ -469,7 +469,7 @@ export default class CreateUnitBisnis extends Component { ...@@ -469,7 +469,7 @@ export default class CreateUnitBisnis extends Component {
<DatePicker <DatePicker
margin="normal" margin="normal"
id="endDate" id="endDate"
label="End Date" label="Valid To"
format="dd MMMM yyyy" format="dd MMMM yyyy"
error={this.state.errorEndDate} error={this.state.errorEndDate}
helperText={this.state.msgErrorEndDate} helperText={this.state.msgErrorEndDate}
......
...@@ -141,7 +141,7 @@ export default class UserRole extends Component { ...@@ -141,7 +141,7 @@ export default class UserRole extends Component {
}) })
let columns = [ let columns = [
"Data Ke-", "Data",
"Full Name", "Full Name",
{ {
name: "Email", name: "Email",
...@@ -195,7 +195,7 @@ export default class UserRole extends Component { ...@@ -195,7 +195,7 @@ export default class UserRole extends Component {
} }
}, },
{ {
name: "Berlaku Mulai", name: "Valid From",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
...@@ -220,7 +220,7 @@ export default class UserRole extends Component { ...@@ -220,7 +220,7 @@ export default class UserRole extends Component {
} }
}, },
{ {
name: "Berakhir Hingga", name: "Valid To",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
...@@ -292,6 +292,27 @@ export default class UserRole extends Component { ...@@ -292,6 +292,27 @@ export default class UserRole extends Component {
} }
} }
updateUser(payload) {
api.create().updateUser(payload).then((response) => {
console.log(response.data.message)
console.log(response.data.status)
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
this.closeEdit()
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
_handleKeyDown(e) { _handleKeyDown(e) {
if (e.key === 'Enter') { if (e.key === 'Enter') {
if (this.state.search.length > 0) { if (this.state.search.length > 0) {
...@@ -308,7 +329,6 @@ export default class UserRole extends Component { ...@@ -308,7 +329,6 @@ export default class UserRole extends Component {
if (response.ok) { if (response.ok) {
if (response.data.status === "success") { if (response.data.status === "success") {
console.log(response) console.log(response)
alert(response.data.message)
this.getUser() this.getUser()
this.setState({ visibleUser: true }) this.setState({ visibleUser: true })
} else { } else {
...@@ -598,6 +618,7 @@ export default class UserRole extends Component { ...@@ -598,6 +618,7 @@ export default class UserRole extends Component {
<EditUser <EditUser
onClickClose={this.closeEdit.bind(this)} onClickClose={this.closeEdit.bind(this)}
refresh={this.getUser.bind(this)} refresh={this.getUser.bind(this)}
updateUser={this.updateUser.bind(this)}
data={this.state.indexData} data={this.state.indexData}
/> />
)} )}
......
...@@ -158,17 +158,17 @@ export default class AddUser extends Component { ...@@ -158,17 +158,17 @@ export default class AddUser extends Component {
var isEmail = this.isEmail(this.state.email) var isEmail = this.isEmail(this.state.email)
if (R.isEmpty(this.state.fullname)) { if (R.isEmpty(this.state.fullname)) {
this.setState({ errorFullname: true, msgErrorFN: 'Fullname is required' }) this.setState({ errorFullname: true, msgErrorFN: 'Fullname Cannot be Empty' })
} else if (R.isEmpty(this.state.email)) { } else if (R.isEmpty(this.state.email)) {
this.setState({ errorEmail: true, msgErrorEM: 'Email is required' }) this.setState({ errorEmail: true, msgErrorEM: 'Email Cannot be Empty' })
} else if (!isEmail) { } else if (!isEmail) {
this.setState({ errorEmail: true, msgErrorEM: 'Email format not recognized!' }) this.setState({ errorEmail: true, msgErrorEM: 'Email format not recognized!' })
} else if (R.isNil(this.state.role)) { } else if (R.isNil(this.state.role)) {
this.setState({ errorRoleName: true, msgErrorRN: 'Role name is required' }) this.setState({ errorRoleName: true, msgErrorRN: 'Role name Cannot be Empty' })
} else if (R.isNil(this.state.startDate)) { } else if (R.isNil(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorSD: 'Start date is required' }) this.setState({ errorStartDate: true, msgErrorSD: 'Start date Cannot be Empty' })
} else if (R.isNil(this.state.endDate)) { } else if (R.isNil(this.state.endDate)) {
this.setState({ errorEndDate: true, msgErrorED: 'End date is required' }) this.setState({ errorEndDate: true, msgErrorED: 'End date Cannot be Empty' })
} }
// else if (this.state.privileges.length < 1) { // else if (this.state.privileges.length < 1) {
// alert('Hak Akses belum di pilih !!') // alert('Hak Akses belum di pilih !!')
......
...@@ -166,17 +166,17 @@ export default class EditUser extends Component { ...@@ -166,17 +166,17 @@ export default class EditUser extends Component {
// console.log(this.state.tempData) // console.log(this.state.tempData)
if (R.isEmpty(this.state.tempData.fullname)) { if (R.isEmpty(this.state.tempData.fullname)) {
this.setState({ errorFullname: true, msgErrorFN: 'Full Name is Required' }) this.setState({ errorFullname: true, msgErrorFN: 'Full Name Cannot be Empty' })
} else if (R.isEmpty(this.state.tempData.email)) { } else if (R.isEmpty(this.state.tempData.email)) {
this.setState({ errorEmail: true, msgErrorEM: 'Email is Required' }) this.setState({ errorEmail: true, msgErrorEM: 'Email Cannot be Empty' })
} else if (!isEmail) { } else if (!isEmail) {
this.setState({ errorEmail: true, msgErrorEM: 'Email format not recognized!' }) this.setState({ errorEmail: true, msgErrorEM: 'Email format not recognized!' })
} else if (R.isNil(this.state.role)) { } else if (R.isNil(this.state.role)) {
this.setState({ errorRoleName: true, msgErrorRN: 'Role Name is Required' }) this.setState({ errorRoleName: true, msgErrorRN: 'Role Name Cannot be Empty' })
} else if (R.isNil(this.state.tempData.start_date)) { } else if (R.isNil(this.state.tempData.start_date)) {
this.setState({ errorStartDate: true, msgErrorSD: 'Start Date is Required' }) this.setState({ errorStartDate: true, msgErrorSD: 'Start Date Cannot be Empty' })
} else if (R.isNil(this.state.tempData.end_date)) { } else if (R.isNil(this.state.tempData.end_date)) {
this.setState({ errorEndDate: true, msgErrorED: 'End Date is Required' }) this.setState({ errorEndDate: true, msgErrorED: 'End Date Cannot be Empty' })
} }
// else if (this.state.privileges.length < 1) { // else if (this.state.privileges.length < 1) {
// alert('Hak Akses belum di pilih !!') // alert('Hak Akses belum di pilih !!')
...@@ -186,7 +186,7 @@ export default class EditUser extends Component { ...@@ -186,7 +186,7 @@ export default class EditUser extends Component {
} }
} }
updateUser() { updateUser(){
let payload = { let payload = {
"user_id": this.state.tempData.user_id, "user_id": this.state.tempData.user_id,
"role_id": this.state.role.role_id, "role_id": this.state.role.role_id,
...@@ -196,28 +196,7 @@ export default class EditUser extends Component { ...@@ -196,28 +196,7 @@ export default class EditUser extends Component {
"start_date": this.state.tempData.start_date, "start_date": this.state.tempData.start_date,
"end_date": this.state.tempData.end_date "end_date": this.state.tempData.end_date
} }
this.props.updateUser(payload)
api.create().updateUser(payload).then((response) => {
console.log(response.data.message)
console.log(response.data.status)
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
setTimeout(() => {
this.props.onClickClose()
this.props.refresh()
}, 750);
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
} }
getRole() { getRole() {
......
...@@ -110,11 +110,11 @@ export default class AddRole extends Component { ...@@ -110,11 +110,11 @@ export default class AddRole extends Component {
validasi() { validasi() {
if (R.isEmpty(this.state.roleName)) { if (R.isEmpty(this.state.roleName)) {
this.setState({ errorRoleName: true, msgErrorRN: 'Role name is required' }) this.setState({ errorRoleName: true, msgErrorRN: 'Role name Cannot be Empty' })
} else if (R.isNil(this.state.startDate)) { } else if (R.isNil(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorSD: 'Start date is required' }) this.setState({ errorStartDate: true, msgErrorSD: 'Start date Cannot be Empty' })
} else if (R.isNil(this.state.endDate)) { } else if (R.isNil(this.state.endDate)) {
this.setState({ errorEndDate: true, msgErrorED: 'End date is required' }) this.setState({ errorEndDate: true, msgErrorED: 'End date Cannot be Empty' })
} else if (this.state.privileges.length < 1) { } else if (this.state.privileges.length < 1) {
this.setState({ alert: true, messageAlert: 'You must choose the Access Rights!!', tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: 'You must choose the Access Rights!!', tipeAlert: 'warning' })
} else { } else {
......
...@@ -116,11 +116,11 @@ export default class EditRole extends Component { ...@@ -116,11 +116,11 @@ export default class EditRole extends Component {
validasi() { validasi() {
if (R.isEmpty(this.state.tempData.role_name)) { if (R.isEmpty(this.state.tempData.role_name)) {
this.setState({ errorRoleName: true, msgErrorRN: 'Role name is required' }) this.setState({ errorRoleName: true, msgErrorRN: 'Role name Cannot be Empty' })
} else if (R.isNil(this.state.tempData.start_date)) { } else if (R.isNil(this.state.tempData.start_date)) {
this.setState({ errorStartDate: true, msgErrorSD: 'Start date is required' }) this.setState({ errorStartDate: true, msgErrorSD: 'Start date Cannot be Empty' })
} else if (R.isNil(this.state.tempData.end_date)) { } else if (R.isNil(this.state.tempData.end_date)) {
this.setState({ errorEndDate: true, msgErrorED: 'End date is required' }) this.setState({ errorEndDate: true, msgErrorED: 'End date Cannot be Empty' })
} else if (this.state.privileges.length < 1) { } else if (this.state.privileges.length < 1) {
this.setState({ alert: true, messageAlert: 'You must choose the Access Rights', tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: 'You must choose the Access Rights', tipeAlert: 'warning' })
} else { } else {
......
...@@ -68,23 +68,23 @@ class ResetPassword extends Component { ...@@ -68,23 +68,23 @@ class ResetPassword extends Component {
validateReset() { validateReset() {
if (this.state.password.trim() == "") { if (this.state.password.trim() == "") {
this.setState({ errorPassword: true, msgPassword: 'Password is required' }) this.setState({ errorPassword: true, msgPassword: 'New Password Cannot be Empty.' })
} else if (this.state.password.length < 8) { } else if (this.state.password.length < 8) {
this.setState({ errorPassword: true, msgPassword: 'Password minimum 8 characters.' }) this.setState({ errorPassword: true, msgPassword: 'New Password minimum 8 characters.' })
} else if (this.isEmail(this.state.password)) { } else if (this.isEmail(this.state.password)) {
this.setState({ errorPassword: true, msgPassword: 'Password format should not use email.' }) this.setState({ errorPassword: true, msgPassword: 'New Password format should not use email.' })
} else if (!this.isRegex(this.state.password)) { } else if (!this.isRegex(this.state.password)) {
this.setState({ errorPassword: true, msgPassword: 'Password must be a combination of characters, letters and numbers.' }) this.setState({ errorPassword: true, msgPassword: 'New Password must be a combination of characters, letters and numbers.' })
} else if (this.state.confirmPassword.trim() == "") { } else if (this.state.confirmPassword.trim() == "") {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Confirm password is required.' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Confirmation Cannot be Empty.' })
} else if (this.state.confirmPassword.length < 8) { } else if (this.state.confirmPassword.length < 8) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Confirm password minimum 8 characters.' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Confirmation minimum 8 characters.' })
} else if (this.isEmail(this.state.confirmPassword)) { } else if (this.isEmail(this.state.confirmPassword)) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password confirmation format should not use email.' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password confirmation format should not use email.' })
} else if (!this.isRegex(this.state.confirmPassword)) { } else if (!this.isRegex(this.state.confirmPassword)) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password confirmation must be a combination of characters, letters and numbers.' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password confirmation must be a combination of characters, letters and numbers.' })
} else if (this.state.password !== this.state.confirmPassword) { } else if (this.state.password !== this.state.confirmPassword) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Confirmation password must match the password.' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Does Not Match.' })
} else { } else {
this.confirmPassword() this.confirmPassword()
} }
...@@ -127,7 +127,7 @@ class ResetPassword extends Component { ...@@ -127,7 +127,7 @@ class ResetPassword extends Component {
if (e.target.name == "password") { if (e.target.name == "password") {
this.setState({ errorPassword: false, msgPassword: 'Password consists of 8 characters with a combination of numbers.' }) this.setState({ errorPassword: false, msgPassword: 'Password consists of 8 characters with a combination of numbers.' })
} else if (e.target.name == "confirmPassword") { } else if (e.target.name == "confirmPassword") {
this.setState({ errorConfirmPassword: false, msgConfirmPassword: 'Confirm Password consists of 8 characters with a combination of numbers.' }) this.setState({ errorConfirmPassword: false, msgConfirmPassword: 'Password Confirmation consists of 8 characters with a combination of numbers.' })
} }
} }
......
import React, { Component } from 'react';
import { Typography, Paper, TextField, MenuItem } from '@material-ui/core';
import MUIDataTable from 'mui-datatables';
import Images from '../assets/Images';
import api from '../api';
import Autocomplete from '@material-ui/lab/Autocomplete';
import { titleCase } from '../library/Utils';
export default class RollingOutlook extends Component {
constructor(props) {
super(props)
this.state = {
periode: '2020',
perusahaan: 'TAP Group',
revisi: '0',
visibleRollingOutlook: true,
listCompany: null,
company: null,
report_id: null,
visibleBS: false,
visiblePL: false,
visibleTP: false,
visibleCAT: false
}
}
componentDidMount() {
this.getCompanyActive()
}
getReport() {
let payload = {
"company_id": this.state.company.company_id,
"periode": this.state.periode,
"report_type": "Rolling Outlook",
}
console.log(payload)
api.create().getReportTypeBody(payload).then(response => {
if (response.data) {
if (response.data.status === "success") {
let dataTable = response.data.data.map((item, index) => {
return [
index + 1,
item.report_name,
"",
item.report_id
]
})
this.setState({ dataTable })
}
}
})
}
getCompanyActive() {
api.create().getPerusahaanActive().then((response) => {
if (response.data.status === 'success') {
let data = response.data.data
let companyData = data.map((item) => {
return {
company_id: item.company_id,
company_name: item.company_name,
}
})
let defaultProps = {
options: companyData,
getOptionLabel: (option) => titleCase(option.company_name),
};
this.setState({ listCompany: defaultProps, company: companyData[0] }, ()=> this.getReport())
} else {
alert(response.data.message)
}
})
}
clickDetail(item, id) {
this.setState({ report_id: id })
if (item === 'Balance Sheet') {
this.setState({
visibleRollingOutlook: false,
visibleBS: true,
visiblePL: false,
visibleCAT: false,
visibleTP: false,
})
} else if (item === 'Profit & Loss') {
this.setState({
visibleRollingOutlook: false,
visibleBS: false,
visiblePL: true,
visibleCAT: false,
visibleTP: false
})
} else if (item === 'Tax Planning') {
this.setState({
visibleRollingOutlook: false,
visibleBS: false,
visiblePL: false,
visibleCAT: false,
visibleTP: true
})
} else if (item === 'Fixed Assets Movement') {
this.setState({
visibleRollingOutlook: false,
visibleBS: false,
visiblePL: false,
visibleCAT: false,
visibleFAM: true,
visibleTP: false
})
} else if (item === 'CAT') {
this.setState({
visibleRollingOutlook: false,
visibleBS: false,
visiblePL: false,
visibleCAT: true,
visibleFAM: false,
visibleTP: false
})
}
}
render() {
const columns = ["#", "Jenis Laporan",
{
name: "Status",
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
{val === "acc" ?
<img src={Images.ceklis} style={{ width: 31, height: 24 }} /> :
null
}
</div >
);
}
}
},
{
name: "Action",
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent'
}}
onClick={() => this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[3])}
>
<Typography style={{ color: '#5198ea', fontSize: 12, }}>Detail</Typography>
</button>
</div >
);
}
}
}]
const dataTable = [
["1", "Balance Sheet", "done"],
["2", "Profit & Loss", ""],
["3", "CAT", "done"],
["4", "Fixed Assets Movement", ""],
["5", "Tax Planning", "done"],
["6", "Balance Sheet", "done"],
["7", "Profit & Loss", ""],
["8", "CAT", "done"],
["9", "Fixed Assets Movement", ""],
["10", "Tax Planning", "done"],
["11", "Balance Sheet", "done"],
["12", "Profit & Loss", "done"],
["13", "CAT", "done"],
["14", "Fixed Assets Movement", "done"],
["15", "Tax Planning", "done"],
]
const options = {
filter: false,
sort: false,
responsive: "scroll",
print: false,
download: false,
selectableRows: false,
viewColumns: false,
rowsPerPage: 5,
rowsPerPageOptions: [5, 25, 100],
search: false
}
const periode = [
{ value: '2020', label: '2020' },
{ value: '2019', label: '2019' },
{ value: '2018', label: '2018' },
{ value: '2017', label: '2017' },
{ value: '2016', label: '2016' },
]
const perusahaan = [
{ value: 'TAP Group', label: 'TAP Group' },
{ value: '2019', label: '2019' },
{ value: '2018', label: '2018' },
{ value: '2017', label: '2017' },
{ value: '2016', label: '2016' },
]
const revisi = [
{ value: '0', label: '0' },
{ value: '1', label: '1' },
]
return (
<div style={{ flex: 1, backgroundColor: '#f8f8f8' }}>
{this.state.visibleRollingOutlook && (
<div>
<div className={"main-color"} style={{ height: 78, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
<Typography style={{ fontSize: '16px', color: 'white' }}>Rolling Outlook & Revisi CAT</Typography>
</div>
<div style={{ padding: 20, width: '100%' }}>
<Paper style={{ paddingTop: 10 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Rolling Outlook & Revisi CAT</Typography>
</div>
<div style={{ padding: 20 }}>
<div>
<TextField
style={{ width: 250, }}
id="periode"
select
label="Periode"
value={this.state.periode}
onChange={(e) => this.setState({ periode: e.target.value })}
>
{periode.map((option) => (
<MenuItem key={option.value} value={option.value}>
{option.label}
</MenuItem>
))}
</TextField>
</div>
<div style={{ marginTop: 20 }}>
<Autocomplete
{...this.state.listCompany}
id="company"
onChange={(event, newInputValue) => this.setState({ company: newInputValue })}
debug
disableClearable
style={{ width: 250 }}
renderInput={(params) => <TextField {...params} label="Company" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.company}
/>
</div>
<div style={{ marginTop: 20 }}>
<TextField
style={{ width: 250, }}
id="reivisi"
select
label="Revisi"
value={this.state.revisi}
onChange={(e) => this.setState({ revisi: e.target.value })}
>
{revisi.map((option) => (
<MenuItem key={option.value} value={option.value}>
{option.label}
</MenuItem>
))}
</TextField>
</div>
<div style={{ marginTop: 20 }}>
<MUIDataTable
data={this.state.dataTable}
columns={columns}
options={options}
/>
</div>
<div style={{ display: 'flex', marginTop: 20 }}>
<div style={{ width: '50%' }}>
<Typography style={{ fontSize: '16px', color: '#4b4b4b', fontWeight: 'bold' }}>Attachment: </Typography>
</div>
<div style={{ width: '50%' }}>
<Typography style={{ fontSize: '16px', color: '#5198ea' }}>Upload File</Typography>
</div>
</div>
<div style={{ display: 'flex', marginTop: 10 }}>
<div style={{ width: '50%', paddingLeft: 20 }}>
<Typography style={{ fontSize: '16px', color: '#4b4b4b' }}>File 1.xls </Typography>
<Typography style={{ fontSize: '16px', color: '#4b4b4b' }}>File 2.xls </Typography>
</div>
<div style={{ width: '50%' }}>
<Typography style={{ fontSize: '16px', color: '#ff3939' }}>Delete</Typography>
<Typography style={{ fontSize: '16px', color: '#ff3939' }}>Delete</Typography>
</div>
</div>
</div>
<div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Submit</Typography>
</div>
</div>
</Paper>
</div>
</div>
)}
</div >
);
}
}
...@@ -68,23 +68,23 @@ class SetPassword extends Component { ...@@ -68,23 +68,23 @@ class SetPassword extends Component {
validateReset() { validateReset() {
if (this.state.password.trim() == "") { if (this.state.password.trim() == "") {
this.setState({ errorPassword: true, msgPassword: 'Password is required' }) this.setState({ errorPassword: true, msgPassword: 'New Password Cannot be Empty.' })
} else if (this.state.password.length < 8) { } else if (this.state.password.length < 8) {
this.setState({ errorPassword: true, msgPassword: 'Password minimum 8 characters.' }) this.setState({ errorPassword: true, msgPassword: 'New Password minimum 8 characters.' })
} else if (this.isEmail(this.state.password)) { } else if (this.isEmail(this.state.password)) {
this.setState({ errorPassword: true, msgPassword: 'Password format should not use email.' }) this.setState({ errorPassword: true, msgPassword: 'New Password format should not use email.' })
} else if (!this.isRegex(this.state.password)) { } else if (!this.isRegex(this.state.password)) {
this.setState({ errorPassword: true, msgPassword: 'Password must be a combination of characters, letters and numbers.' }) this.setState({ errorPassword: true, msgPassword: 'New Password must be a combination of characters, letters and numbers.' })
} else if (this.state.confirmPassword.trim() == "") { } else if (this.state.confirmPassword.trim() == "") {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Confirm password is required.' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Confirmation Cannot be Empty.' })
} else if (this.state.confirmPassword.length < 8) { } else if (this.state.confirmPassword.length < 8) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Confirm password minimum 8 characters.' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Confirmation minimum 8 characters.' })
} else if (this.isEmail(this.state.confirmPassword)) { } else if (this.isEmail(this.state.confirmPassword)) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password confirmation format should not use email.' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password confirmation format should not use email.' })
} else if (!this.isRegex(this.state.confirmPassword)) { } else if (!this.isRegex(this.state.confirmPassword)) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password confirmation must be a combination of characters, letters and numbers.' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password confirmation must be a combination of characters, letters and numbers.' })
} else if (this.state.password !== this.state.confirmPassword) { } else if (this.state.password !== this.state.confirmPassword) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Confirmation password must match the password.' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password Does Not Match.' })
} else { } else {
this.confirmPassword() this.confirmPassword()
} }
...@@ -127,7 +127,7 @@ class SetPassword extends Component { ...@@ -127,7 +127,7 @@ class SetPassword extends Component {
if (e.target.name == "password") { if (e.target.name == "password") {
this.setState({ errorPassword: false, msgPassword: 'Password consists of 8 characters with a combination of numbers.' }) this.setState({ errorPassword: false, msgPassword: 'Password consists of 8 characters with a combination of numbers.' })
} else if (e.target.name == "confirmPassword") { } else if (e.target.name == "confirmPassword") {
this.setState({ errorConfirmPassword: false, msgConfirmPassword: 'Confirm Password consists of 8 characters with a combination of numbers.' }) this.setState({ errorConfirmPassword: false, msgConfirmPassword: 'Password Confirmation consists of 8 characters with a combination of numbers.' })
} }
} }
...@@ -197,7 +197,7 @@ class SetPassword extends Component { ...@@ -197,7 +197,7 @@ class SetPassword extends Component {
/> />
<Button name="submit" variant="contained" disabled={this.state.password.trim() == '' && this.state.confirmPassword.trim() == '' ? true : false} onClick={() => this.validateReset()} style={{ marginTop: 50, width: '100%', height: 35, borderRadius: 4, color: this.state.password.trim() == '' && this.state.confirmPassword.trim() == '' ? '#4b4b4b' : '#fff', backgroundColor: this.state.password.trim() == '' && this.state.confirmPassword.trim() == '' ? '#d8d8d8' : '#51c6ea' }}> <Button name="submit" variant="contained" disabled={this.state.password.trim() == '' && this.state.confirmPassword.trim() == '' ? true : false} onClick={() => this.validateReset()} style={{ marginTop: 50, width: '100%', height: 35, borderRadius: 4, color: this.state.password.trim() == '' && this.state.confirmPassword.trim() == '' ? '#4b4b4b' : '#fff', backgroundColor: this.state.password.trim() == '' && this.state.confirmPassword.trim() == '' ? '#d8d8d8' : '#51c6ea' }}>
<Typography style={{ fontSize: 12, fontFamily: 'Nunito Sans, sans-serif' }}>Lanjut</Typography> <Typography style={{ fontSize: 12, fontFamily: 'Nunito Sans, sans-serif' }}>Next</Typography>
</Button> </Button>
</div> </div>
</div> </div>
......
...@@ -22,7 +22,7 @@ const arraySide = [ ...@@ -22,7 +22,7 @@ const arraySide = [
{ {
img: Images.rolling, img: Images.rolling,
label: 'Rolling Outlook & CAT Revision', label: 'Rolling Outlook & CAT Revision',
path: 'beranda', path: 'rolling-outlook',
subItem: null subItem: null
}, },
{ {
......
...@@ -11,6 +11,7 @@ import Parameter from '../container/MasterData/Parameter/Parameter' ...@@ -11,6 +11,7 @@ import Parameter from '../container/MasterData/Parameter/Parameter'
import ReportItems from '../container/MasterData/ReportItems' import ReportItems from '../container/MasterData/ReportItems'
import DashboardCAT from '../container/Laporan/DashboardCAT' import DashboardCAT from '../container/Laporan/DashboardCAT'
import BudgetTahunan from '../container/BudgetTahunan'; import BudgetTahunan from '../container/BudgetTahunan';
import RollingOutlook from '../container/RollingOutlook';
import OperatingIndicator from '../container/OperatingIndicator/OperatingIndicator' import OperatingIndicator from '../container/OperatingIndicator/OperatingIndicator'
import MonthlyReport from '../container/MonthlyReport'; import MonthlyReport from '../container/MonthlyReport';
...@@ -35,6 +36,10 @@ const routes = [ ...@@ -35,6 +36,10 @@ const routes = [
path: "/home/master-budget", path: "/home/master-budget",
main: BudgetTahunan main: BudgetTahunan
}, },
{
path: "/home/rolling-outlook",
main: RollingOutlook
},
{ {
path: "/home/profile", path: "/home/profile",
main: Profile main: Profile
......
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