Commit 714cf0d5 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 1e92aec5 f5ec6c7b
...@@ -79,6 +79,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -79,6 +79,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
//Menu //Menu
const getMenu = () => api.get('menu/get_menu_hierarki') const getMenu = () => api.get('menu/get_menu_hierarki')
const getMenuByRole = () => api.get('menu/get_menu_hierarki_by_role') const getMenuByRole = () => api.get('menu/get_menu_hierarki_by_role')
const getMenuByUser = () => api.get('menu/get_menu')
//UNIT BISNIS //UNIT BISNIS
const getUnitBisnis = () => api.get('business_unit/get_all_business_unit') const getUnitBisnis = () => api.get('business_unit/get_all_business_unit')
...@@ -87,6 +88,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -87,6 +88,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const searchUnitBisnis = (body) => api.post('/business_unit/search_business_unit', body) const searchUnitBisnis = (body) => api.post('/business_unit/search_business_unit', body)
const checkUploadUnitBisnis = (body) => api.post('/business_unit/check_import', body) const checkUploadUnitBisnis = (body) => api.post('/business_unit/check_import', body)
const uploadUnitBisnis = (body) => api.post('/business_unit/import_business_unit', body) const uploadUnitBisnis = (body) => api.post('/business_unit/import_business_unit', body)
const getUnitBisnisActive = () => api.get('business_unit/get_all_business_unit_active')
// Perusahaan // Perusahaan
const getPerusahaan = () => api.get('company/get_all_company') const getPerusahaan = () => api.get('company/get_all_company')
...@@ -94,6 +96,11 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -94,6 +96,11 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const createPerusahaan = (body) => api.post('/company/create_company', body) const createPerusahaan = (body) => api.post('/company/create_company', body)
const updatePerusahaan = (body) => api.post('/company/update_company', body) const updatePerusahaan = (body) => api.post('/company/update_company', body)
const getPerusahaanHierarki = () => api.get('company/get_company_hierarki') const getPerusahaanHierarki = () => api.get('company/get_company_hierarki')
const saveVisualisasiPerusahaan = (body) => api.post('company/save_visualization', body)
const checkUploadPerusahaan = (body) => api.post('company/check_import', body)
const getDetailPerusahaan = (id) => api.get(`company/get_company_by_id/${id}`)
const uploadPerusahaan = (body) => api.post('company/import_company', body)
const searchPerusahaan = (body) => api.post('company/search_company', body)
// APPROVAL MATRIX // APPROVAL MATRIX
const getAM = () => api.get('approval_matrix/get_all_approval_matrix') const getAM = () => api.get('approval_matrix/get_all_approval_matrix')
...@@ -119,11 +126,15 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -119,11 +126,15 @@ 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_report/get_all_type_report') const getInputType = () => api.get('type_report/get_all_type_report')
const getReportType = () => api.get('report/get_all_report') const getReportType = () => api.get('report/get_all_report')
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)
const updateReportItems = (body) => api.post('/item_report/update_item_report', body)
const checkUploadReportItems = (body) => api.post('/item_report/check_import', body) const checkUploadReportItems = (body) => api.post('/item_report/check_import', body)
const uploadReportItems = (body) => api.post('/item_report/import_item_report', body) const uploadReportItems = (body) => api.post('/item_report/import_item_report', body)
const getItemReportHierarki = () => api.get('item_report/get_item_report_hierarki') const getItemReportHierarki = (body) => api.post('item_report/get_item_report_hierarki', body)
const saveVisualisasiReport = (body) => api.post('item_report/save_visualization', body)
const getReportParent = (body) => api.post('item_report/get_parent_item_report', body)
//PARAMETER //PARAMETER
const getAllParameter = () => api.get('/setting/get_all_setting') const getAllParameter = () => api.get('/setting/get_all_setting')
...@@ -134,6 +145,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -134,6 +145,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const updateParameter = (body) => api.post('setting/update_setting', body) const updateParameter = (body) => api.post('setting/update_setting', body)
const checkUploadParameter = (body) => api.post('setting/check_import', body) const checkUploadParameter = (body) => api.post('setting/check_import', body)
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)
//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}`)
...@@ -193,6 +205,8 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -193,6 +205,8 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
getReportItems, getReportItems,
searchReportItems, searchReportItems,
createReportItems, createReportItems,
updateReportItems,
getDetailReportItems,
getInputType, getInputType,
getReportType, getReportType,
checkUploadReportItems, checkUploadReportItems,
...@@ -208,7 +222,17 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -208,7 +222,17 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
checkUploadParameter, checkUploadParameter,
uploadParameter, uploadParameter,
getItemReportHierarki, getItemReportHierarki,
getMenuByRole getMenuByRole,
saveVisualisasiReport,
saveVisualisasiPerusahaan,
getReportParent,
searchParameter,
checkUploadPerusahaan,
getDetailPerusahaan,
uploadPerusahaan,
searchPerusahaan,
getUnitBisnisActive,
getMenuByUser
} }
} }
......
...@@ -43,6 +43,7 @@ const Images = { ...@@ -43,6 +43,7 @@ const Images = {
logout: require('./setting.png'), logout: require('./setting.png'),
setting: require('./logout.png'), setting: require('./logout.png'),
failedCopy: require('./failed-copy.svg'), failedCopy: require('./failed-copy.svg'),
triputraLogo: require('./triputra-logo.png')
} }
......
This diff is collapsed.
...@@ -124,6 +124,36 @@ export default class Parameter extends Component { ...@@ -124,6 +124,36 @@ export default class Parameter extends Component {
} }
} }
handleInputChange(e) {
this.setState({ search: e })
let body = {
"keyword": e
}
api.create().searchParameter(body).then(response => {
console.log(response.data);
if (response.data.status == 'success') {
let data = response.data.data
let listData = data.map((item, index) => {
return [
index,
item.setting_group,
item.setting_type,
item.company_name,
item.description,
item.order,
item.value,
item.min_value,
item.max_value,
item.status
]
})
this.setState({ dataTable: listData, listData: response.data.data })
} else {
alert(response.data.message)
}
})
}
fileHandler = (event) => { fileHandler = (event) => {
let fileObj = event let fileObj = event
ExcelRenderer(fileObj, (err, resp) => { ExcelRenderer(fileObj, (err, resp) => {
...@@ -612,6 +642,8 @@ export default class Parameter extends Component { ...@@ -612,6 +642,8 @@ export default class Parameter extends Component {
<InputBase <InputBase
style={{ width: '100%' }} style={{ width: '100%' }}
placeholder="Search" placeholder="Search"
value={this.state.search}
onChange={(e) => this.handleInputChange(e.target.value)}
inputProps={{ 'aria-label': 'naked' }} inputProps={{ 'aria-label': 'naked' }}
/> />
</div> </div>
......
This diff is collapsed.
...@@ -8,20 +8,97 @@ import TreeView from '@material-ui/lab/TreeView'; ...@@ -8,20 +8,97 @@ import TreeView from '@material-ui/lab/TreeView';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import ChevronRightIcon from '@material-ui/icons/ChevronRight'; import ChevronRightIcon from '@material-ui/icons/ChevronRight';
import TreeItem from '@material-ui/lab/TreeItem'; import TreeItem from '@material-ui/lab/TreeItem';
import Nestable from 'react-nestable/dist/Nestable';
import AddIcon from '@material-ui/icons/Add';
import RemoveIcon from '@material-ui/icons/Remove';
import api from '../../../api';
export default class VisualPerusahaan extends Component { export default class VisualPerusahaan extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
items: [
{ id: 0, GG: 'Accumulated Depreciation (negative value)', collapse: false,
children: [
{ id: 3, GG: 'Beginning Balance', collapse: false },
{ id: 4, GG: 'Depreciation expense MTD (please fill in, if any)', collapse: false },
{ id: 5, GG: 'Depreciation expense MTD (please fill in, if any)', collapse: false }
]
},{
id: 1, GG: 'Control Gain/(Loss) on Fixed Assets', collapse: false
},{
id: 2, GG: 'Gain/(Loss) on Fixed Assets', collapse: false,
children: [
{ id: 6, GG: 'NBV', collapse: false,
children : [
{ id: 8, GG: 'Cost', collapse: false },
{ id: 9, GG: 'Accm. Depreciation', collapse: false },
]
},
{ id: 7, GG: 'Proceed from sale or disposal of Fixed Assets (please fill in, if any)', collapse: false },
]
},
],
arrayCollapse: [],
defaultCollapsed: false
} }
} }
componentDidMount() { componentDidMount() {
console.log(this.props.height) this.getPerusahaan()
}
getPerusahaan() {
api.create().getPerusahaanHierarki().then((response) => {
if (response.data.status == 'success') {
this.setState({ items: response.data.data })
console.log(response.data.data)
}
})
} }
onDefaultCollapsed = () => this.setState({
defaultCollapsed: !this.state.defaultCollapsed
});
collapse = (collapseCase) => {
let arrayCollapse = this.state.arrayCollapse
let index = arrayCollapse.findIndex((val) => val.id === collapseCase)
if (arrayCollapse.includes(collapseCase)) {
arrayCollapse.splice(index, 1)
} else {
arrayCollapse.push(collapseCase)
}
if (this.refNestable) {
this.refNestable.collapse(arrayCollapse.length > 0? arrayCollapse : 'NONE');
}
};
handleSave() {
let payload = {
"company": this.state.items
}
api.create().saveVisualisasiPerusahaan(payload).then((response) => {
// if (response.data.status == 'ucces') {
this.props.onClickClose()
// } else {
// alert(response.data.message)
// }
})
}
renderItem = ({ item, collapseIcon }) => {
return (
<div>
<button type="button" onClick={() => this.collapse(item.id)}>
{collapseIcon ? (this.state.arrayCollapse.includes(item.id)? <AddIcon/> : <RemoveIcon/>) : null}
</button>
<label style={{marginLeft: collapseIcon ? 10 : 0}}>{item.company_name}</label>
</div>
)
};
render() { render() {
return ( return (
...@@ -34,7 +111,15 @@ export default class VisualPerusahaan extends Component { ...@@ -34,7 +111,15 @@ export default class VisualPerusahaan extends Component {
</div> </div>
<div style={{ padding: 25, width: '100%' }}> <div style={{ padding: 25, width: '100%' }}>
<div style={{ width: '100%', padding: 25, backgroundColor: 'white', borderRadius: 6, border: 'solid 1px #c4c4c4'}}> <div style={{ width: '100%', padding: 25, backgroundColor: 'white', borderRadius: 6, border: 'solid 1px #c4c4c4'}}>
<TreeView <Nestable
items={this.state.items}
collapsed={this.state.defaultCollapsed}
renderItem={this.renderItem}
ref={el => this.refNestable = el}
onChange={(e) => this.setState({items: e}, () => console.log(JSON.stringify(e)))}
/>
{/* <TreeView
defaultCollapseIcon={<ExpandMoreIcon />} defaultCollapseIcon={<ExpandMoreIcon />}
defaultExpandIcon={<ChevronRightIcon />} defaultExpandIcon={<ChevronRightIcon />}
> >
...@@ -68,7 +153,7 @@ export default class VisualPerusahaan extends Component { ...@@ -68,7 +153,7 @@ export default class VisualPerusahaan extends Component {
</TreeItem> </TreeItem>
</TreeItem> </TreeItem>
</TreeItem> </TreeItem>
</TreeView> </TreeView> */}
</div> </div>
</div> </div>
<div className="row" style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 15, paddingLeft: 15, paddingBottom: 25 }}> <div className="row" style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 15, paddingLeft: 15, paddingBottom: 25 }}>
...@@ -79,7 +164,7 @@ export default class VisualPerusahaan extends Component { ...@@ -79,7 +164,7 @@ export default class VisualPerusahaan extends Component {
<div onClick={() => this.props.onClickClose()} style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center', cursor:"pointer" }}> <div onClick={() => this.props.onClickClose()} style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center', cursor:"pointer" }}>
<span style={{ color: '#354960', fontSize: 11 }} >Batal</span> <span style={{ color: '#354960', fontSize: 11 }} >Batal</span>
</div> </div>
<div style={{ width: 102, height: 30, marginLeft: 25, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center', cursor:"pointer" }}> <div onClick={() => this.handleSave()} style={{ width: 102, height: 30, marginLeft: 25, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center', cursor:"pointer" }}>
<span style={{ color: '#fff', fontSize: 11 }}>Simpan</span> <span style={{ color: '#fff', fontSize: 11 }}>Simpan</span>
</div> </div>
</div> </div>
......
This diff is collapsed.
...@@ -24,7 +24,6 @@ export default class CreateReportItems extends Component { ...@@ -24,7 +24,6 @@ export default class CreateReportItems extends Component {
formula: '', formula: '',
realVal: '', realVal: '',
condition: null, condition: null,
inputValue: '',
date: new Date(), date: new Date(),
listInputType: null, listInputType: null,
listCompany: null, listCompany: null,
...@@ -54,7 +53,7 @@ export default class CreateReportItems extends Component { ...@@ -54,7 +53,7 @@ export default class CreateReportItems extends Component {
this.getInputType() this.getInputType()
this.getPerusahaan() this.getPerusahaan()
this.getReportType() this.getReportType()
this.getParent() // this.getParent()
} }
...@@ -137,7 +136,6 @@ export default class CreateReportItems extends Component { ...@@ -137,7 +136,6 @@ export default class CreateReportItems extends Component {
else { else {
this.addReportItems() this.addReportItems()
} }
} }
addReportItems() { addReportItems() {
...@@ -171,7 +169,7 @@ export default class CreateReportItems extends Component { ...@@ -171,7 +169,7 @@ export default class CreateReportItems extends Component {
getInputType() { getInputType() {
api.create().getInputType().then((response) => { api.create().getInputType().then((response) => {
// console.log(response) console.log(response.data)
if(response.data.status === 'success') { if(response.data.status === 'success') {
let data = response.data.data let data = response.data.data
let inputData = data.map((item) => { let inputData = data.map((item) => {
...@@ -236,25 +234,31 @@ export default class CreateReportItems extends Component { ...@@ -236,25 +234,31 @@ export default class CreateReportItems extends Component {
} }
getParent() { getParent() {
api.create().getReportItems().then((response) => { if (this.state.reportType !== null && this.state.company !== null) {
// console.log(response) let payload = {
if(response.data.status === 'success') { "report_id": this.state.reportType.report_id,
let data = response.data.data "company_id": this.state.company.company_id
let parentData = data.map((item) => {
return {
item_report_id: item.item_report_id,
report_name: item.report_name
}
})
let defaultProps = {
options: parentData,
getOptionLabel: (option) => titleCase(option.report_name),
};
this.setState({listParent: defaultProps, parentData: response.data.data})
} else {
alert(response.data.message)
} }
}) api.create().getReportParent(payload).then((response) => {
console.log(response)
if(response.data.status === 'success') {
let data = response.data.data
let parentData = data.map((item) => {
return {
item_report_id: item.item_report_id,
description: item.description
}
})
let defaultProps = {
options: parentData,
getOptionLabel: (option) => titleCase(option.description),
};
this.setState({listParent: defaultProps, parentData: response.data.data})
} else {
alert(response.data.message)
}
})
}
} }
handleDate(item) { handleDate(item) {
...@@ -316,7 +320,7 @@ export default class CreateReportItems extends Component { ...@@ -316,7 +320,7 @@ export default class CreateReportItems extends Component {
<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.getParent())}
debug debug
renderInput={(params) => renderInput={(params) =>
<TextField {...params} <TextField {...params}
...@@ -395,8 +399,8 @@ export default class CreateReportItems extends Component { ...@@ -395,8 +399,8 @@ export default class CreateReportItems extends Component {
id="inputType" id="inputType"
onChange={(event, newInputValue) => this.setState({InputType: newInputValue}, onChange={(event, newInputValue) => this.setState({InputType: newInputValue},
() => newInputValue === null ? this.setState({disabledFormula: true, disabledCondt: true, disabledValue: true, formula: '', condition: '', realVal: ''}) () => newInputValue === null ? this.setState({disabledFormula: true, disabledCondt: true, disabledValue: true, formula: '', condition: '', realVal: ''})
: newInputValue.type_report_name === 'FORMULA' ? this.setState({disabledFormula: false, disabledCondt: true, disabledValue: true, formula: '', condition: '', realVal: ''}) : newInputValue.type_report_name === 'Formula' ? this.setState({disabledFormula: false, disabledCondt: true, disabledValue: true, formula: '', condition: '', realVal: ''})
: newInputValue.type_report_name === 'VALIDATION' ? this.setState({disabledFormula: false, disabledCondt: false, disabledValue: false, formula: '', condition: '', realVal: ''}) : newInputValue.type_report_name === 'Validation' ? this.setState({disabledFormula: false, disabledCondt: false, disabledValue: false, formula: '', condition: '', realVal: ''})
: this.setState({disabledFormula: true, disabledCondt: true, disabledValue: true, formula: '', condition: '', realVal: ''}) : this.setState({disabledFormula: true, disabledCondt: true, disabledValue: true, formula: '', condition: '', realVal: ''})
)} )}
debug debug
...@@ -572,6 +576,7 @@ export default class CreateReportItems extends Component { ...@@ -572,6 +576,7 @@ export default class CreateReportItems extends Component {
id="parentId" id="parentId"
onChange={(event, newInputValue) => this.setState({parent: newInputValue})} onChange={(event, newInputValue) => this.setState({parent: newInputValue})}
debug debug
disabled={this.state.reportType == null || this.state.company == null}
renderInput={(params) => renderInput={(params) =>
<TextField {...params} <TextField {...params}
label="Parent ID" label="Parent ID"
......
...@@ -11,8 +11,13 @@ export default class CreateUnitBisnis extends Component { ...@@ -11,8 +11,13 @@ export default class CreateUnitBisnis extends Component {
id: '', id: '',
name: '', name: '',
startDate: '', startDate: '',
endDate: '' endDate: '',
errorName: false,
errorStartDate: false,
errorEndDate: false,
msgErrorName: "",
msgErrorStartDate: "",
msgErrorEndDate: ""
} }
} }
render() { render() {
...@@ -36,11 +41,13 @@ export default class CreateUnitBisnis extends Component { ...@@ -36,11 +41,13 @@ export default class CreateUnitBisnis extends Component {
let data = this.state let data = this.state
let isDate = type !== '' ? true : false let isDate = type !== '' ? true : false
if (isDate && type == 'start_date') { if (isDate && type == 'start_date') {
this.setState({ startDate: format(e, 'yyyy-MM-dd') }, () => { this.setState({ startDate: format(e, 'yyyy-MM-dd'), endDate: null }, () => {
this.clearError()
console.log(this.state.startDate) console.log(this.state.startDate)
}) })
} else if (isDate && type == 'end_date') { } else if (isDate && type == 'end_date') {
this.setState({ endDate: format(e, 'yyyy-MM-dd') }, () => { this.setState({ endDate: format(e, 'yyyy-MM-dd') }, () => {
this.clearError()
console.log(this.state.endDate) console.log(this.state.endDate)
}) })
} else { } else {
...@@ -49,13 +56,25 @@ export default class CreateUnitBisnis extends Component { ...@@ -49,13 +56,25 @@ export default class CreateUnitBisnis extends Component {
} }
clearError() {
this.setState({
errorName: false,
errorStartDate: false,
errorEndDate: false,
msgErrorName: "",
msgErrorStartDate: "",
msgErrorEndDate: ""
})
}
validasi() { validasi() {
if (R.isEmpty(this.state.name)) return alert("Unit Bisnis Name is Required."); if (R.isEmpty(this.state.name)) {
if (!R.isEmpty(this.state.startDate) && !R.isEmpty(this.state.endDate) && (this.state.startDate > this.state.endDate)) return alert("Masa Berlaku Tidak Boleh Kurang Dari Tanggal Mulai"); this.setState({ errorName: true, msgErrorName: 'Unit Bisnis tidak boleh kosong' })
if (R.isEmpty(this.state.startDate)) return alert("Tanggal Mulai is Required."); } else if (R.isEmpty(this.state.startDate)) {
if (R.isEmpty(this.state.endDate)) return alert("Tanggal Berakhir is Required."); this.setState({ errorStartDate: true, msgErrorStartDate: 'Tanggal Mulai tidak boleh kosong' })
console.log('masuk'); } else if (R.isEmpty(this.state.endDate) || this.state.endDate === null) {
if (this.props.type == 'edit') { this.setState({ errorEndDate: true, msgErrorEndDate: 'Tanggal Berakhir tidak boleh kosong' })
} else {
let payload = { let payload = {
"business_unit_id": this.state.id, "business_unit_id": this.state.id,
"business_unit_name": this.state.name, "business_unit_name": this.state.name,
...@@ -63,7 +82,17 @@ export default class CreateUnitBisnis extends Component { ...@@ -63,7 +82,17 @@ export default class CreateUnitBisnis extends Component {
"end_date": this.state.endDate "end_date": this.state.endDate
} }
this.props.updateUnitBisnis(payload) this.props.updateUnitBisnis(payload)
} else if (this.props.type == 'create') { }
}
validasiCreate() {
if (R.isEmpty(this.state.name)) {
this.setState({ errorName: true, msgErrorName: 'Unit Bisnis tidak boleh kosong' })
} else if (R.isEmpty(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorStartDate: 'Tanggal Mulai tidak boleh kosong' })
} else if (R.isEmpty(this.state.endDate)) {
this.setState({ errorEndDate: true, msgErrorEndDate: 'Tanggal Berakhir tidak boleh kosong' })
} else {
let payload = { let payload = {
"business_unit_name": this.state.name, "business_unit_name": this.state.name,
"start_date": this.state.startDate, "start_date": this.state.startDate,
...@@ -71,7 +100,6 @@ export default class CreateUnitBisnis extends Component { ...@@ -71,7 +100,6 @@ export default class CreateUnitBisnis extends Component {
} }
this.props.createUnitBisnis(payload) this.props.createUnitBisnis(payload)
} }
} }
renderEdit() { renderEdit() {
...@@ -140,7 +168,8 @@ export default class CreateUnitBisnis extends Component { ...@@ -140,7 +168,8 @@ export default class CreateUnitBisnis extends Component {
color: '#7e8085' color: '#7e8085'
} }
}} }}
error={this.state.errorStartDate}
helperText={this.state.msgErrorStartDate}
style={{ padding: 0, margin: 0, width: '100%' }} style={{ padding: 0, margin: 0, width: '100%' }}
/> />
</div> </div>
...@@ -196,7 +225,9 @@ export default class CreateUnitBisnis extends Component { ...@@ -196,7 +225,9 @@ export default class CreateUnitBisnis extends Component {
color: '#7e8085' color: '#7e8085'
} }
}} }}
onChange={(e) => this.setState({ name: e.target.value })} error={this.state.errorName}
helperText={this.state.msgErrorName}
onChange={(e) => this.setState({ name: e.target.value }, () => this.clearError())}
> >
</TextField> </TextField>
</div> </div>
...@@ -206,6 +237,9 @@ export default class CreateUnitBisnis extends Component { ...@@ -206,6 +237,9 @@ export default class CreateUnitBisnis extends Component {
id="startDate" id="startDate"
label="Berakhir Hingga" label="Berakhir Hingga"
format="dd MMMM yyyy" format="dd MMMM yyyy"
error={this.state.errorEndDate}
helperText={this.state.msgErrorEndDate}
minDate={this.state.startDate}
value={this.state.endDate} value={this.state.endDate}
onChange={(e) => this.handleChange(e, 'end_date')} onChange={(e) => this.handleChange(e, 'end_date')}
KeyboardButtonProps={{ KeyboardButtonProps={{
...@@ -222,7 +256,6 @@ export default class CreateUnitBisnis extends Component { ...@@ -222,7 +256,6 @@ export default class CreateUnitBisnis extends Component {
color: '#7e8085' color: '#7e8085'
} }
}} }}
style={{ padding: 0, margin: 0, width: '100%' }} style={{ padding: 0, margin: 0, width: '100%' }}
/> />
</div> </div>
...@@ -323,7 +356,8 @@ export default class CreateUnitBisnis extends Component { ...@@ -323,7 +356,8 @@ export default class CreateUnitBisnis extends Component {
color: '#7e8085' color: '#7e8085'
} }
}} }}
error={this.state.errorStartDate}
helperText={this.state.msgErrorStartDate}
style={{ padding: 0, margin: 0, width: '100%' }} style={{ padding: 0, margin: 0, width: '100%' }}
/> />
</div> </div>
...@@ -373,7 +407,9 @@ export default class CreateUnitBisnis extends Component { ...@@ -373,7 +407,9 @@ export default class CreateUnitBisnis extends Component {
color: '#7e8085' color: '#7e8085'
} }
}} }}
onChange={(e) => this.setState({ name: e.target.value })} error={this.state.errorName}
helperText={this.state.msgErrorName}
onChange={(e) => this.setState({ name: e.target.value }, () => this.clearError())}
> >
</TextField> </TextField>
</div> </div>
...@@ -383,6 +419,9 @@ export default class CreateUnitBisnis extends Component { ...@@ -383,6 +419,9 @@ export default class CreateUnitBisnis extends Component {
id="endDate" id="endDate"
label="Berakhir Hingga" label="Berakhir Hingga"
format="dd MMMM yyyy" format="dd MMMM yyyy"
error={this.state.errorEndDate}
helperText={this.state.msgErrorEndDate}
minDate={this.state.startDate}
value={this.state.endDate == "" ? null : this.state.endDate} value={this.state.endDate == "" ? null : this.state.endDate}
onChange={(e) => this.handleChange(e, 'end_date')} onChange={(e) => this.handleChange(e, 'end_date')}
KeyboardButtonProps={{ KeyboardButtonProps={{
...@@ -421,7 +460,7 @@ export default class CreateUnitBisnis extends Component { ...@@ -421,7 +460,7 @@ export default class CreateUnitBisnis extends Component {
<div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}> <div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
<button <button
type="button" type="button"
onClick={() => this.validasi()} onClick={() => this.validasiCreate()}
> >
<div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}> <div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#fff', fontSize: 11 }}>Simpan</span> <span style={{ color: '#fff', fontSize: 11 }}>Simpan</span>
......
...@@ -152,15 +152,15 @@ export default class AddUser extends Component { ...@@ -152,15 +152,15 @@ export default class AddUser extends Component {
} }
handleItemChecked(item) { handleItemChecked(item) {
let indexID = this.state.company.findIndex((val) => val === item.company_id) let indexID = this.state.company.findIndex((val) => val === item.id)
return indexID === -1 ? false : true return indexID === -1 ? false : true
} }
handleItemClick(item) { handleItemClick(item) {
let indexID = this.state.company.findIndex((val) => val === item.company_id) let indexID = this.state.company.findIndex((val) => val === item.id)
let company = this.state.company let company = this.state.company
if (indexID === -1) { if (indexID === -1) {
company.push(item.company_id) company.push(item.id)
} else { } else {
company.splice(indexID, 1) company.splice(indexID, 1)
} }
...@@ -176,14 +176,21 @@ export default class AddUser extends Component { ...@@ -176,14 +176,21 @@ export default class AddUser extends Component {
} }
return ( return (
<ul> <ul>
{item.child.map((data, index) => { {item.children.map((data, index) => {
return ( return (
<li> // <li>
<Collapse key={index} timeout="auto" unmountOnExit in={item.collapse}> <Collapse key={index} timeout="auto" unmountOnExit in={item.collapse}>
<div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start', paddingLeft: R.isNil(data.child) ? (padding + 20) : padding }}> <div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start', paddingLeft: R.isNil(data.children) ? (padding + 20) : padding }}>
{!R.isNil(data.child) && <span onClick={() => this.handleCollapse(data)} style={{ marginLeft: 7, marginRight: 2 }}> {R.isNil(data.children)?
{data.collapse? <RemoveIcon color={'action'} fontSize={'small'} /> : <AddIcon color={'action'} fontSize={'small'} />} null
</span>} :
data.children.length < 1?
null
:
<span onClick={() => this.handleCollapse(data)} style={{ marginLeft: 7, marginRight: 2 }}>
{data.collapse? <RemoveIcon color={'action'} fontSize={'small'} /> : <AddIcon color={'action'} fontSize={'small'} />}
</span>
}
<span> <span>
<CustomCheckbox <CustomCheckbox
checked={this.handleItemChecked(data)} checked={this.handleItemChecked(data)}
...@@ -192,9 +199,9 @@ export default class AddUser extends Component { ...@@ -192,9 +199,9 @@ export default class AddUser extends Component {
</span> </span>
<Typography style={{ fontSize: 12 }}>{titleCase(data.company_name)}</Typography> <Typography style={{ fontSize: 12 }}>{titleCase(data.company_name)}</Typography>
</div> </div>
{!R.isNil(data.child) && this.renderChildren(data, padding + 20)} {!R.isNil(data.children) && this.renderChildren(data, padding + 20)}
</Collapse> </Collapse>
</li> // </li>
) )
})} })}
</ul> </ul>
...@@ -202,7 +209,7 @@ export default class AddUser extends Component { ...@@ -202,7 +209,7 @@ export default class AddUser extends Component {
} }
handleCollapse(item) { handleCollapse(item) {
let path = this.searchIt({child: this.state.listCompany}, item.company_id) let path = this.searchIt({children: this.state.listCompany}, item.id)
let listCompany = this.state.listCompany let listCompany = this.state.listCompany
let arrayPath = [] let arrayPath = []
...@@ -217,17 +224,17 @@ export default class AddUser extends Component { ...@@ -217,17 +224,17 @@ export default class AddUser extends Component {
if (arrayPath.length == 1) { if (arrayPath.length == 1) {
pathSelect= listCompany[arrayPath[0]] pathSelect= listCompany[arrayPath[0]]
} else if (arrayPath.length == 2) { } else if (arrayPath.length == 2) {
pathSelect= listCompany[arrayPath[0]].child[arrayPath[1]] pathSelect= listCompany[arrayPath[0]].children[arrayPath[1]]
} else if (arrayPath.length == 3) { } else if (arrayPath.length == 3) {
pathSelect= listCompany[arrayPath[0]].child[arrayPath[1]].child[arrayPath[2]] pathSelect= listCompany[arrayPath[0]].children[arrayPath[1]].children[arrayPath[2]]
} else if (arrayPath.length == 4) { } else if (arrayPath.length == 4) {
pathSelect= listCompany[arrayPath[0]].child[arrayPath[1]].child[arrayPath[2]].child[arrayPath[3]] pathSelect= listCompany[arrayPath[0]].children[arrayPath[1]].children[arrayPath[2]].children[arrayPath[3]]
} else if (arrayPath.length == 5) { } else if (arrayPath.length == 5) {
pathSelect= listCompany[arrayPath[0]].child[arrayPath[1]].child[arrayPath[2]].child[arrayPath[3]].child[arrayPath[4]] pathSelect= listCompany[arrayPath[0]].children[arrayPath[1]].children[arrayPath[2]].children[arrayPath[3]].children[arrayPath[4]]
} else if (arrayPath.length == 6) { } else if (arrayPath.length == 6) {
pathSelect= listCompany[arrayPath[0]].child[arrayPath[1]].child[arrayPath[2]].child[arrayPath[3]].child[arrayPath[4]].child[arrayPath[5]] pathSelect= listCompany[arrayPath[0]].children[arrayPath[1]].children[arrayPath[2]].children[arrayPath[3]].children[arrayPath[4]].children[arrayPath[5]]
} else if (arrayPath.length == 7) { } else if (arrayPath.length == 7) {
pathSelect= listCompany[arrayPath[0]].child[arrayPath[1]].child[arrayPath[2]].child[arrayPath[3]].child[arrayPath[4]].child[arrayPath[5]].child[arrayPath[6]] pathSelect= listCompany[arrayPath[0]].children[arrayPath[1]].children[arrayPath[2]].children[arrayPath[3]].children[arrayPath[4]].children[arrayPath[5]].children[arrayPath[6]]
} }
pathSelect.collapse = !pathSelect.collapse pathSelect.collapse = !pathSelect.collapse
...@@ -236,14 +243,14 @@ export default class AddUser extends Component { ...@@ -236,14 +243,14 @@ export default class AddUser extends Component {
} }
searchIt = (node, search, path = '', position = 0) => { searchIt = (node, search, path = '', position = 0) => {
if (node.company_id && node.company_id === search) {return path !== '' ? `${path}-${position}` : position;} if (node.id && node.id === search) {return path !== '' ? `${path}-${position}` : position;}
if (!node.child) {return false} if (!node.children) {return false}
const index = node.child.findIndex((x) => x.company_id && x.company_id === search); const index = node.children.findIndex((x) => x.id && x.id === search);
if (index >= 0) { if (index >= 0) {
return path !== '' ? `${path}-${index}` : index; return path !== '' ? `${path}-${index}` : index;
} }
for (let i = 0; i < node.child.length; i++) { for (let i = 0; i < node.children.length; i++) {
const result = this.searchIt(node.child[i], search, path !== '' ? `${path}-${i}` : i , i); const result = this.searchIt(node.children[i], search, path !== '' ? `${path}-${i}` : i , i);
if (result){ if (result){
return result; return result;
} }
...@@ -436,10 +443,10 @@ export default class AddUser extends Component { ...@@ -436,10 +443,10 @@ export default class AddUser extends Component {
{this.state.listCompany.map((item,index) => { {this.state.listCompany.map((item,index) => {
return( return(
<div> <div>
<ul> {/* <ul>
<li> <li> */}
<div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start' }}> <div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start' }}>
{item.child.length > 0 && <span onClick={() => this.handleCollapse(item)} style={{ marginLeft: 7, marginRight: 2 }}> {item.children.length > 0 && <span onClick={() => this.handleCollapse(item)} style={{ marginLeft: 7, marginRight: 2 }}>
{item.collapse ? <RemoveIcon color={'action'} fontSize={'small'} /> : <AddIcon color={'action'} fontSize={'small'} />} {item.collapse ? <RemoveIcon color={'action'} fontSize={'small'} /> : <AddIcon color={'action'} fontSize={'small'} />}
</span>} </span>}
<span> <span>
...@@ -450,9 +457,9 @@ export default class AddUser extends Component { ...@@ -450,9 +457,9 @@ export default class AddUser extends Component {
</span> </span>
<Typography style={{ fontSize: 12 }}>{titleCase(item.company_name)}</Typography> <Typography style={{ fontSize: 12 }}>{titleCase(item.company_name)}</Typography>
</div> </div>
{!R.isNil(item.child) && this.renderChildren(item)} {!R.isNil(item.children) && this.renderChildren(item)}
</li> {/* </li>
</ul> </ul> */}
</div> </div>
) )
})} })}
......
...@@ -188,15 +188,15 @@ export default class EditUser extends Component { ...@@ -188,15 +188,15 @@ export default class EditUser extends Component {
} }
handleItemChecked(item) { handleItemChecked(item) {
let indexID = this.state.company.findIndex((val) => val === item.company_id) let indexID = this.state.company.findIndex((val) => val === item.id)
return indexID === -1 ? false : true return indexID === -1 ? false : true
} }
handleItemClick(item) { handleItemClick(item) {
let indexID = this.state.company.findIndex((val) => val === item.company_id) let indexID = this.state.company.findIndex((val) => val === item.id)
let company = this.state.company let company = this.state.company
if (indexID === -1) { if (indexID === -1) {
company.push(item.company_id) company.push(item.id)
} else { } else {
company.splice(indexID, 1) company.splice(indexID, 1)
} }
...@@ -212,14 +212,21 @@ export default class EditUser extends Component { ...@@ -212,14 +212,21 @@ export default class EditUser extends Component {
} }
return ( return (
<ul> <ul>
{item.child.map((data, index) => { {item.children.map((data, index) => {
return ( return (
<li> // <li>
<Collapse key={index} timeout="auto" unmountOnExit in={item.collapse}> <Collapse key={index} timeout="auto" unmountOnExit in={item.collapse}>
<div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start', paddingLeft: R.isNil(data.child) ? (padding + 20) : padding }}> <div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start', paddingLeft: R.isNil(data.children) ? (padding + 20) : padding }}>
{!R.isNil(data.child) && <span onClick={() => this.handleCollapse(data)} style={{ marginLeft: 7, marginRight: 2 }}> {R.isNil(data.children)?
{data.collapse? <RemoveIcon color={'action'} fontSize={'small'} /> : <AddIcon color={'action'} fontSize={'small'} />} null
</span>} :
data.children.length < 1?
null
:
<span onClick={() => this.handleCollapse(data)} style={{ marginLeft: 7, marginRight: 2 }}>
{data.collapse? <RemoveIcon color={'action'} fontSize={'small'} /> : <AddIcon color={'action'} fontSize={'small'} />}
</span>
}
<span> <span>
<CustomCheckbox <CustomCheckbox
checked={this.handleItemChecked(data)} checked={this.handleItemChecked(data)}
...@@ -228,9 +235,9 @@ export default class EditUser extends Component { ...@@ -228,9 +235,9 @@ export default class EditUser extends Component {
</span> </span>
<Typography style={{ fontSize: 12 }}>{titleCase(data.company_name)}</Typography> <Typography style={{ fontSize: 12 }}>{titleCase(data.company_name)}</Typography>
</div> </div>
{!R.isNil(data.child) && this.renderChildren(data, padding + 20)} {!R.isNil(data.children) && this.renderChildren(data, padding + 20)}
</Collapse> </Collapse>
</li> // </li>
) )
})} })}
</ul> </ul>
...@@ -238,7 +245,7 @@ export default class EditUser extends Component { ...@@ -238,7 +245,7 @@ export default class EditUser extends Component {
} }
handleCollapse(item) { handleCollapse(item) {
let path = this.searchIt({child: this.state.listCompany}, item.company_id) let path = this.searchIt({children: this.state.listCompany}, item.id)
let listCompany = this.state.listCompany let listCompany = this.state.listCompany
let arrayPath = [] let arrayPath = []
...@@ -253,17 +260,17 @@ export default class EditUser extends Component { ...@@ -253,17 +260,17 @@ export default class EditUser extends Component {
if (arrayPath.length == 1) { if (arrayPath.length == 1) {
pathSelect= listCompany[arrayPath[0]] pathSelect= listCompany[arrayPath[0]]
} else if (arrayPath.length == 2) { } else if (arrayPath.length == 2) {
pathSelect= listCompany[arrayPath[0]].child[arrayPath[1]] pathSelect= listCompany[arrayPath[0]].children[arrayPath[1]]
} else if (arrayPath.length == 3) { } else if (arrayPath.length == 3) {
pathSelect= listCompany[arrayPath[0]].child[arrayPath[1]].child[arrayPath[2]] pathSelect= listCompany[arrayPath[0]].children[arrayPath[1]].children[arrayPath[2]]
} else if (arrayPath.length == 4) { } else if (arrayPath.length == 4) {
pathSelect= listCompany[arrayPath[0]].child[arrayPath[1]].child[arrayPath[2]].child[arrayPath[3]] pathSelect= listCompany[arrayPath[0]].children[arrayPath[1]].children[arrayPath[2]].children[arrayPath[3]]
} else if (arrayPath.length == 5) { } else if (arrayPath.length == 5) {
pathSelect= listCompany[arrayPath[0]].child[arrayPath[1]].child[arrayPath[2]].child[arrayPath[3]].child[arrayPath[4]] pathSelect= listCompany[arrayPath[0]].children[arrayPath[1]].children[arrayPath[2]].children[arrayPath[3]].children[arrayPath[4]]
} else if (arrayPath.length == 6) { } else if (arrayPath.length == 6) {
pathSelect= listCompany[arrayPath[0]].child[arrayPath[1]].child[arrayPath[2]].child[arrayPath[3]].child[arrayPath[4]].child[arrayPath[5]] pathSelect= listCompany[arrayPath[0]].children[arrayPath[1]].children[arrayPath[2]].children[arrayPath[3]].children[arrayPath[4]].children[arrayPath[5]]
} else if (arrayPath.length == 7) { } else if (arrayPath.length == 7) {
pathSelect= listCompany[arrayPath[0]].child[arrayPath[1]].child[arrayPath[2]].child[arrayPath[3]].child[arrayPath[4]].child[arrayPath[5]].child[arrayPath[6]] pathSelect= listCompany[arrayPath[0]].children[arrayPath[1]].children[arrayPath[2]].children[arrayPath[3]].children[arrayPath[4]].children[arrayPath[5]].children[arrayPath[6]]
} }
pathSelect.collapse = !pathSelect.collapse pathSelect.collapse = !pathSelect.collapse
...@@ -272,14 +279,14 @@ export default class EditUser extends Component { ...@@ -272,14 +279,14 @@ export default class EditUser extends Component {
} }
searchIt = (node, search, path = '', position = 0) => { searchIt = (node, search, path = '', position = 0) => {
if (node.company_id && node.company_id === search) {return path !== '' ? `${path}-${position}` : position;} if (node.id && node.id === search) {return path !== '' ? `${path}-${position}` : position;}
if (!node.child) {return false} if (!node.children) {return false}
const index = node.child.findIndex((x) => x.company_id && x.company_id === search); const index = node.children.findIndex((x) => x.id && x.id === search);
if (index >= 0) { if (index >= 0) {
return path !== '' ? `${path}-${index}` : index; return path !== '' ? `${path}-${index}` : index;
} }
for (let i = 0; i < node.child.length; i++) { for (let i = 0; i < node.children.length; i++) {
const result = this.searchIt(node.child[i], search, path !== '' ? `${path}-${i}` : i , i); const result = this.searchIt(node.children[i], search, path !== '' ? `${path}-${i}` : i , i);
if (result){ if (result){
return result; return result;
} }
...@@ -473,10 +480,10 @@ export default class EditUser extends Component { ...@@ -473,10 +480,10 @@ export default class EditUser extends Component {
{this.state.listCompany.map((item, index) => { {this.state.listCompany.map((item, index) => {
return ( return (
<div> <div>
<ul> {/* <ul>
<li> <li> */}
<div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start' }}> <div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start' }}>
{item.child.length > 0 && <span onClick={() => this.handleCollapse(item)} style={{ marginLeft: 7, marginRight: 2 }}> {item.children.length > 0 && <span onClick={() => this.handleCollapse(item)} style={{ marginLeft: 7, marginRight: 2 }}>
{item.collapse ? <RemoveIcon color={'action'} fontSize={'small'} /> : <AddIcon color={'action'} fontSize={'small'} />} {item.collapse ? <RemoveIcon color={'action'} fontSize={'small'} /> : <AddIcon color={'action'} fontSize={'small'} />}
</span>} </span>}
<span> <span>
...@@ -487,9 +494,9 @@ export default class EditUser extends Component { ...@@ -487,9 +494,9 @@ export default class EditUser extends Component {
</span> </span>
<Typography style={{ fontSize: 12 }}>{titleCase(item.company_name)}</Typography> <Typography style={{ fontSize: 12 }}>{titleCase(item.company_name)}</Typography>
</div> </div>
{!R.isNil(item.child) && this.renderChildren(item)} {!R.isNil(item.children) && this.renderChildren(item)}
</li> {/* </li>
</ul> </ul> */}
</div> </div>
) )
})} })}
......
This diff is collapsed.
...@@ -17,7 +17,7 @@ const routes = [ ...@@ -17,7 +17,7 @@ const routes = [
main: HomePage main: HomePage
}, },
{ {
path: "/home/userrole", path: "/home/user-role",
main: UserRole main: UserRole
}, },
{ {
...@@ -29,7 +29,7 @@ const routes = [ ...@@ -29,7 +29,7 @@ const routes = [
main: ReportItems main: ReportItems
}, },
{ {
path: "/home/budget-tahunan", path: "/home/master-budget",
main: BalanceSheet main: BalanceSheet
}, },
{ {
...@@ -37,7 +37,7 @@ const routes = [ ...@@ -37,7 +37,7 @@ const routes = [
main: Profile main: Profile
}, },
{ {
path: "/home/perusahaan", path: "/home/company",
main: Perusahaan main: Perusahaan
}, },
{ {
...@@ -45,15 +45,15 @@ const routes = [ ...@@ -45,15 +45,15 @@ const routes = [
main: User main: User
}, },
{ {
path: "/home/unit-bisnis", path: "/home/business-unit",
main: UnitBisnis main: UnitBisnis
}, },
{ {
path: "/home/parameter", path: "/home/parameters",
main: Parameter main: Parameter
}, },
{ {
path: "/home/dashboard-cat", path: "/home/cat-dashboard",
main: DashboardCAT main: DashboardCAT
}, },
{ {
......
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