Commit a8ceac6f 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 102f3767 b6c52c49
...@@ -176,7 +176,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -176,7 +176,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const uploadFoto = (body) => api.post('attachment/upload_foto', body) const uploadFoto = (body) => api.post('attachment/upload_foto', body)
// MANAGEMENT DOCUMENT // MANAGEMENT DOCUMENT
const getDocumentCategory = () => api.get('document_category/get_all_document_category') const getDocumentCategory = (body) => api.post('setting/get_all_setting_document_category', body)
const getAllDocument = (body) => api.post('document/get_all_document', body) const getAllDocument = (body) => api.post('document/get_all_document', body)
const uploadDocument = (body) => api.post('document/upload_document', body) const uploadDocument = (body) => api.post('document/upload_document', body)
......
...@@ -309,7 +309,7 @@ export default class BudgetTahunan extends Component { ...@@ -309,7 +309,7 @@ export default class BudgetTahunan extends Component {
this.setState({ alert: false }) this.setState({ alert: false })
} }
getDataBalanceSheet(data) { saveToMasterBudget(data) {
this.setState({ loading: true }) this.setState({ loading: true })
// console.log(JSON.stringify(data)); // console.log(JSON.stringify(data));
api.create().createSubmitReport(data).then(response => { api.create().createSubmitReport(data).then(response => {
...@@ -318,7 +318,11 @@ export default class BudgetTahunan extends Component { ...@@ -318,7 +318,11 @@ export default class BudgetTahunan extends Component {
if (response.data.status === "success") { if (response.data.status === "success") {
this.getReport() this.getReport()
this.getSubmission() this.getSubmission()
} else {
this.setState({ loading: true })
} }
} else {
this.setState({ loading: true })
} }
}) })
} }
...@@ -646,18 +650,21 @@ export default class BudgetTahunan extends Component { ...@@ -646,18 +650,21 @@ export default class BudgetTahunan extends Component {
revision={this.state.revisionTable} revision={this.state.revisionTable}
periode={this.state.periode.periode} periode={this.state.periode.periode}
submissionID={this.state.submissionID} submissionID={this.state.submissionID}
getDataBalanceSheet={this.getDataBalanceSheet.bind(this)} saveToMasterBudget={this.saveToMasterBudget.bind(this)}
onClickClose={() => this.setState({ visibleBS: false, visibleBudgetTahunan: true })} onClickClose={() => this.setState({ visibleBS: false, visibleBudgetTahunan: true })}
/> />
)} )}
{this.state.visiblePL && ( {this.state.visiblePL && (
<ProfitLoss <ProfitLoss
open={this.props.open}
report_id={this.state.report_id} report_id={this.state.report_id}
height={this.props.height} height={this.props.height}
width={this.props.width} width={this.props.width}
company={this.state.company} company={this.state.company}
revision={this.state.revisionTable} revision={this.state.revisionTable}
periode={this.state.periode.periode} periode={this.state.periode.periode}
submissionID={this.state.submissionID}
saveToMasterBudget={this.saveToMasterBudget.bind(this)}
onClickClose={() => this.setState({ visiblePL: false, visibleBudgetTahunan: true })} onClickClose={() => this.setState({ visiblePL: false, visibleBudgetTahunan: true })}
/> />
......
...@@ -6,6 +6,8 @@ import api from '../../api'; ...@@ -6,6 +6,8 @@ import api from '../../api';
import AddIcon from '@material-ui/icons/Add'; import AddIcon from '@material-ui/icons/Add';
import { values } from 'ramda'; import { values } from 'ramda';
import PropagateLoader from "react-spinners/PropagateLoader" import PropagateLoader from "react-spinners/PropagateLoader"
import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip';
var ct = require("../../library/CustomTable"); var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable3()); const getMuiTheme = () => createMuiTheme(ct.customTable3());
...@@ -746,7 +748,7 @@ export default class BalanceSheet extends Component { ...@@ -746,7 +748,7 @@ export default class BalanceSheet extends Component {
"balance_sheet": data "balance_sheet": data
} }
// console.log(data); // console.log(data);
this.props.getDataBalanceSheet(payload) this.props.saveToMasterBudget(payload)
this.props.onClickClose() this.props.onClickClose()
} }
...@@ -2002,10 +2004,58 @@ export default class BalanceSheet extends Component { ...@@ -2002,10 +2004,58 @@ export default class BalanceSheet extends Component {
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Budget Tahunan - Balance Sheet</Typography> <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Budget Tahunan - Balance Sheet</Typography>
</div> </div>
<div style={{ padding: 20 }}> <div style={{ padding: 20 }}>
<div> <div style={{ display: 'flex', justifyContent: 'space-between'}}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography> <div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Periode : {this.props.periode}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Periode : {this.props.periode}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
<div style={{ width: '50%'}}>
<div style={{justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download Template'} data-for="template">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => null}
>
<img src={Images.template} />
</button>
</a>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
<a data-tip={'Upload'} data-for="upload">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => null}
>
<img src={Images.upload} />
</button>
</a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<a data-tip={'Download'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => null}
>
<img src={Images.download} />
</button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div>
</div>
</div> </div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150), height: this.props.height - 400 }}> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150), height: this.props.height - 400 }}>
......
This diff is collapsed.
...@@ -14,23 +14,32 @@ export default class AuditTahunan extends Component { ...@@ -14,23 +14,32 @@ export default class AuditTahunan extends Component {
super(props) super(props)
this.state = { this.state = {
dataTable: [], dataTable: [],
visibleCreate: false visibleCreate: false,
refresh: ''
} }
} }
componentDidMount() { componentDidMount() {
console.log(this.props.data) // console.log(this.props.data)
this.getData() this.getData()
} }
componentWillReceiveProps(props) {
// console.log(props);
const { refresh, id } = this.props;
if (props.refresh !== refresh) {
this.getData()
}
}
getData() { getData() {
let payload = { let payload = {
"company_id": 1, "setting_id": this.props.data.setting_id
"document_category_id": 1
} }
api.create().getAllDocument(payload).then(respone => { api.create().getAllDocument(payload).then(response => {
let dataTable = respone.data.data.map(item => { console.log(response)
let dataTable = response.data.data.map(item => {
return [ return [
item.document_name, item.document_name,
item.description, item.description,
......
...@@ -83,15 +83,21 @@ export default class CreateManagementDoc extends Component { ...@@ -83,15 +83,21 @@ export default class CreateManagementDoc extends Component {
} }
getDataDocument() { getDataDocument() {
api.create().getDocumentCategory().then(response => { let payload = {
"setting_group_id": 7,
"setting_type_id": 167,
"company_id": 0
}
api.create().getDocumentCategory(payload).then(response => {
console.log(response); console.log(response);
if (response.data) { if (response.data) {
if (response.data.status == 'success') { if (response.data.status == 'success') {
let data = response.data.data let data = response.data.data
let typeData = data.map((item) => { let typeData = data.map((item) => {
return { return {
document_category_id: item.document_category_id, document_category_id: item.setting_id,
document_category_name: item.document_category_name document_category_name: item.value
} }
}) })
let typeProps = { let typeProps = {
...@@ -173,7 +179,7 @@ export default class CreateManagementDoc extends Component { ...@@ -173,7 +179,7 @@ export default class CreateManagementDoc extends Component {
const formData = new FormData(); const formData = new FormData();
formData.append("file", this.state.file); formData.append("file", this.state.file);
formData.append("companyId", this.state.getPerusahaan.company_id); formData.append("companyId", this.state.getPerusahaan.company_id);
formData.append("documentCategoryId", this.state.getDocument.document_category_id); formData.append("settingId", this.state.getDocument.document_category_id);
formData.append("documentPeriode", this.state.periode.periode); formData.append("documentPeriode", this.state.periode.periode);
formData.append("description", this.state.description); formData.append("description", this.state.description);
formData.append("extension", this.state.fileType); formData.append("extension", this.state.fileType);
...@@ -186,6 +192,12 @@ export default class CreateManagementDoc extends Component { ...@@ -186,6 +192,12 @@ export default class CreateManagementDoc extends Component {
createDocument(){ createDocument(){
api.create().uploadDocument(this.state.formData).then(response => { api.create().uploadDocument(this.state.formData).then(response => {
console.log(response) console.log(response)
if (response) {
if (response.data.status === "success") {
this.props.getDataDocument(this.props.setting_id)
this.props.onClickClose()
}
}
}) })
} }
......
...@@ -20,21 +20,37 @@ export default class DocumentManagement extends Component { ...@@ -20,21 +20,37 @@ export default class DocumentManagement extends Component {
selectTab = (event, newEvent) => { selectTab = (event, newEvent) => {
this.setState({ tab: newEvent }) this.setState({ tab: newEvent })
console.log(this.state.tab) // console.log(this.state.tab)
} }
componentDidMount() { componentDidMount() {
this.getDataDocument() this.getDataDocument()
} }
getDataDocument() { getDataDocument(id) {
api.create().getDocumentCategory().then(response => { let payload = {
this.setState({ "setting_group_id": 7,
listData: response.data.data, "setting_type_id": 167,
id: response.data.data[0].document_category_id, "company_id": 0
loadTable: true
}) }
console.log(this.state.listData) api.create().getDocumentCategory(payload).then(response => {
console.log(response);
if (response) {
if (response.data.status === "success") {
this.setState({
listData: response.data.data,
id: id === undefined ? response.data.data[0].setting_id : id,
loadTable: true,
refresh: id === undefined ? '' : 'create'
})
// console.log(this.state.listData)
} else {
}
} else {
}
}) })
} }
...@@ -54,7 +70,7 @@ export default class DocumentManagement extends Component { ...@@ -54,7 +70,7 @@ export default class DocumentManagement extends Component {
<div style={{ display: 'grid', justifyContent: 'flex-end' }}> <div style={{ display: 'grid', justifyContent: 'flex-end' }}>
<button <button
type="button" type="button"
onClick={() => this.setState({ visibleCreate: true })} onClick={() => this.setState({ visibleCreate: true, refresh: '' })}
style={{ marginRight: 25 }} style={{ marginRight: 25 }}
> >
<div style={{ width: 150, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}> <div style={{ width: 150, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
...@@ -74,27 +90,28 @@ export default class DocumentManagement extends Component { ...@@ -74,27 +90,28 @@ export default class DocumentManagement extends Component {
{this.state.listData.map((item, index) => { {this.state.listData.map((item, index) => {
return ( return (
<Tab <Tab
onClick={() => this.setState({ id: item.document_category_id })} onClick={() => this.setState({ id: item.setting_id })}
label={item.document_category_name} label={item.value}
/> />
) )
})} })}
</Tabs> </Tabs>
{this.state.loadTable && ( {this.state.loadTable && (
this.state.id === 2 ? this.state.id === 68542 ?
<AuditTahunan <AuditTahunan
data={this.state.listData[this.state.tab]} data={this.state.listData[this.state.tab]}
/> refresh={this.state.refresh}
: />
this.state.id === 1 ? :
<ManualBookTia /> this.state.id === 68541 ?
: <ManualBookTia />
this.state.id === 3 ? :
<QReview this.state.id === 3 ?
data={this.state.listData[this.state.tab]} <QReview
/> data={this.state.listData[this.state.tab]}
: />
<span>Test2</span> :
<span>Test2</span>
)} )}
</div> </div>
...@@ -104,6 +121,8 @@ export default class DocumentManagement extends Component { ...@@ -104,6 +121,8 @@ export default class DocumentManagement extends Component {
{this.state.visibleCreate && ( {this.state.visibleCreate && (
<CreateManagementDoc <CreateManagementDoc
onClickClose={() => this.setState({ visibleCreate: false })} onClickClose={() => this.setState({ visibleCreate: false })}
getDataDocument={this.getDataDocument.bind(this)}
setting_id={this.state.id}
/> />
)} )}
</div> </div>
......
...@@ -143,7 +143,11 @@ export default class CreatePerusahaan extends Component { ...@@ -143,7 +143,11 @@ export default class CreatePerusahaan extends Component {
options: perusahaanData, options: perusahaanData,
getOptionLabel: (option) => option.company_name, getOptionLabel: (option) => option.company_name,
}; };
this.setState({ perusahaan: typeProps, perusahaanData: response.data.data, getPerusahaan: index == -1 ? null : perusahaanData[index], msgErrorPC: index === -1 ? 'Company has been Inactive' : "", errorPC: index === -1 ? true : false }) if (this.props.type === 'edit') {
this.setState({ perusahaan: typeProps, perusahaanData: response.data.data, getPerusahaan: index == -1 ? null : perusahaanData[index], msgErrorPC: index === -1 ? 'Company has been Inactive' : "", errorPC: index === -1 ? true : false })
} else {
this.setState({ perusahaan: typeProps, perusahaanData: response.data.data, getPerusahaan: index == -1 ? null : perusahaanData[index] })
}
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) { if (response.data.message.includes("Someone Logged In")) {
...@@ -182,8 +186,12 @@ export default class CreatePerusahaan extends Component { ...@@ -182,8 +186,12 @@ export default class CreatePerusahaan extends Component {
let typeProps = { let typeProps = {
options: typeData, options: typeData,
getOptionLabel: (option) => option.business_unit_name, getOptionLabel: (option) => option.business_unit_name,
}; };
this.setState({ types: typeProps, typeData: response.data.data, getTypes: index == -1 ? null : typeData[index], msgErrorUB: index === -1 ? 'Business Unit has been Inactive' : "", errorUB: index === -1 ? true : false }) if (this.props.type === 'edit') {
this.setState({ types: typeProps, typeData: response.data.data, getTypes: index == -1 ? null : typeData[index], msgErrorUB: index === -1 ? 'Business Unit has been Inactive' : "", errorUB: index === -1 ? true : false })
} else {
this.setState({ types: typeProps, typeData: response.data.data, getTypes: index == -1 ? null : typeData[index] })
}
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) { if (response.data.message.includes("Someone Logged In")) {
......
...@@ -439,6 +439,33 @@ export default class Perusahaan extends Component { ...@@ -439,6 +439,33 @@ export default class Perusahaan extends Component {
}) })
} }
updateHierarchy = (payload) => {
this.setState({ visibleVisual: false, visiblePerusahaan: true })
api.create().saveVisualisasiPerusahaan(payload).then((response) => {
if (response.data) {
if (response.ok) {
if (response.data.status == 'success') {
this.getData()
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
downloadFile = async () => { downloadFile = async () => {
let res = await fetch( let res = await fetch(
"https://tia.eksad.com/tia-reporting-dev/public/attachment/download_file?fileName=CompanyTemplate&&fileType=xlsx" "https://tia.eksad.com/tia-reporting-dev/public/attachment/download_file?fileName=CompanyTemplate&&fileType=xlsx"
...@@ -737,9 +764,9 @@ export default class Perusahaan extends Component { ...@@ -737,9 +764,9 @@ export default class Perusahaan extends Component {
borderColor: 'transparent', borderColor: 'transparent',
margin: 5 margin: 5
}} }}
onClick={() => null} onClick={() => this.setState({ visibleVisual: true, visiblePerusahaan: false })}
> >
<img src={Images.visualisasi} onClick={() => this.setState({ visibleVisual: true, visiblePerusahaan: false })} /> <img src={Images.visualisasi} />
</button> </button>
</a> </a>
<ReactTooltip border={true} id="visual" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="visual" place="bottom" type="light" effect="solid" />
...@@ -783,6 +810,7 @@ export default class Perusahaan extends Component { ...@@ -783,6 +810,7 @@ export default class Perusahaan extends Component {
buttonEdit={this.state.edit} buttonEdit={this.state.edit}
onClickClose={() => this.setState({ visibleVisual: false, visiblePerusahaan: true })} onClickClose={() => this.setState({ visibleVisual: false, visiblePerusahaan: true })}
height={this.props.height} height={this.props.height}
updateHierarchy={this.updateHierarchy.bind(this)}
/> />
: :
<div> <div>
......
...@@ -100,7 +100,9 @@ export default class VisualPerusahaan extends Component { ...@@ -100,7 +100,9 @@ export default class VisualPerusahaan extends Component {
let payload = { let payload = {
"company": this.state.items "company": this.state.items
} }
api.create().saveVisualisasiPerusahaan(payload).then((response) => { this.props.updateHierarchy(payload)
/* api.create().saveVisualisasiPerusahaan(payload).then((response) => {
// console.log(response.data)
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status == 'success') { if (response.data.status == 'success') {
...@@ -129,7 +131,7 @@ export default class VisualPerusahaan extends Component { ...@@ -129,7 +131,7 @@ export default class VisualPerusahaan extends Component {
// } else { // } else {
// alert(response.data.message) // alert(response.data.message)
// } // }
}) }) */
} }
renderItem = ({ item, collapseIcon }) => { renderItem = ({ item, collapseIcon }) => {
......
...@@ -163,7 +163,7 @@ export default class AddUser extends Component { ...@@ -163,7 +163,7 @@ export default class AddUser extends Component {
let uniqueCompany = company.filter((val, id, array) => { let uniqueCompany = company.filter((val, id, array) => {
return array.indexOf(val) == id; return array.indexOf(val) == id;
}); });
company = this.state.role.role_id === 1? uniqueCompany : [] company = this.state.role == null? [] : this.state.role.role_id === 1? uniqueCompany : []
// console.log(uniqueCompany) // console.log(uniqueCompany)
this.setState({ this.setState({
......
...@@ -147,7 +147,7 @@ export default class EditUser extends Component { ...@@ -147,7 +147,7 @@ export default class EditUser extends Component {
let uniqueCompany = company.filter((val, id, array) => { let uniqueCompany = company.filter((val, id, array) => {
return array.indexOf(val) == id; return array.indexOf(val) == id;
}); });
company = this.state.role.role_id === 1? uniqueCompany : [] company = this.state.role == null? [] : this.state.role.role_id === 1? uniqueCompany : []
// console.log(uniqueCompany) // console.log(uniqueCompany)
this.setState({ this.setState({
...@@ -213,6 +213,8 @@ export default class EditUser extends Component { ...@@ -213,6 +213,8 @@ export default class EditUser extends Component {
this.setState({ errorStartDate: true, msgErrorSD: 'Valid From Cannot be Empty' }) 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: 'Valid To Cannot be Empty' }) this.setState({ errorEndDate: true, msgErrorED: 'Valid To Cannot be Empty' })
} else if (this.state.company.length < 1) {
this.setState({ alert: true, messageAlert: 'Authorization company cannot be empty', tipeAlert: 'warning' })
} }
// 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 !!')
......
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