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/') =>
const uploadFoto = (body) => api.post('attachment/upload_foto', body)
// 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 uploadDocument = (body) => api.post('document/upload_document', body)
......
......@@ -309,7 +309,7 @@ export default class BudgetTahunan extends Component {
this.setState({ alert: false })
}
getDataBalanceSheet(data) {
saveToMasterBudget(data) {
this.setState({ loading: true })
// console.log(JSON.stringify(data));
api.create().createSubmitReport(data).then(response => {
......@@ -318,7 +318,11 @@ export default class BudgetTahunan extends Component {
if (response.data.status === "success") {
this.getReport()
this.getSubmission()
} else {
this.setState({ loading: true })
}
} else {
this.setState({ loading: true })
}
})
}
......@@ -646,18 +650,21 @@ export default class BudgetTahunan extends Component {
revision={this.state.revisionTable}
periode={this.state.periode.periode}
submissionID={this.state.submissionID}
getDataBalanceSheet={this.getDataBalanceSheet.bind(this)}
saveToMasterBudget={this.saveToMasterBudget.bind(this)}
onClickClose={() => this.setState({ visibleBS: false, visibleBudgetTahunan: true })}
/>
)}
{this.state.visiblePL && (
<ProfitLoss
open={this.props.open}
report_id={this.state.report_id}
height={this.props.height}
width={this.props.width}
company={this.state.company}
revision={this.state.revisionTable}
periode={this.state.periode.periode}
submissionID={this.state.submissionID}
saveToMasterBudget={this.saveToMasterBudget.bind(this)}
onClickClose={() => this.setState({ visiblePL: false, visibleBudgetTahunan: true })}
/>
......
......@@ -6,6 +6,8 @@ import api from '../../api';
import AddIcon from '@material-ui/icons/Add';
import { values } from 'ramda';
import PropagateLoader from "react-spinners/PropagateLoader"
import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip';
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable3());
......@@ -746,7 +748,7 @@ export default class BalanceSheet extends Component {
"balance_sheet": data
}
// console.log(data);
this.props.getDataBalanceSheet(payload)
this.props.saveToMasterBudget(payload)
this.props.onClickClose()
}
......@@ -2002,11 +2004,59 @@ export default class BalanceSheet extends Component {
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Budget Tahunan - Balance Sheet</Typography>
</div>
<div style={{ padding: 20 }}>
<div style={{ display: 'flex', justifyContent: 'space-between'}}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</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 style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150), height: this.props.height - 400 }}>
<MuiThemeProvider theme={getMuiTheme()}>
......
This diff is collapsed.
......@@ -14,23 +14,32 @@ export default class AuditTahunan extends Component {
super(props)
this.state = {
dataTable: [],
visibleCreate: false
visibleCreate: false,
refresh: ''
}
}
componentDidMount() {
console.log(this.props.data)
// console.log(this.props.data)
this.getData()
}
componentWillReceiveProps(props) {
// console.log(props);
const { refresh, id } = this.props;
if (props.refresh !== refresh) {
this.getData()
}
}
getData() {
let payload = {
"company_id": 1,
"document_category_id": 1
"setting_id": this.props.data.setting_id
}
api.create().getAllDocument(payload).then(respone => {
let dataTable = respone.data.data.map(item => {
api.create().getAllDocument(payload).then(response => {
console.log(response)
let dataTable = response.data.data.map(item => {
return [
item.document_name,
item.description,
......
......@@ -83,15 +83,21 @@ export default class CreateManagementDoc extends Component {
}
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);
if (response.data) {
if (response.data.status == 'success') {
let data = response.data.data
let typeData = data.map((item) => {
return {
document_category_id: item.document_category_id,
document_category_name: item.document_category_name
document_category_id: item.setting_id,
document_category_name: item.value
}
})
let typeProps = {
......@@ -173,7 +179,7 @@ export default class CreateManagementDoc extends Component {
const formData = new FormData();
formData.append("file", this.state.file);
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("description", this.state.description);
formData.append("extension", this.state.fileType);
......@@ -186,6 +192,12 @@ export default class CreateManagementDoc extends Component {
createDocument(){
api.create().uploadDocument(this.state.formData).then(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 {
selectTab = (event, newEvent) => {
this.setState({ tab: newEvent })
console.log(this.state.tab)
// console.log(this.state.tab)
}
componentDidMount() {
this.getDataDocument()
}
getDataDocument() {
api.create().getDocumentCategory().then(response => {
getDataDocument(id) {
let payload = {
"setting_group_id": 7,
"setting_type_id": 167,
"company_id": 0
}
api.create().getDocumentCategory(payload).then(response => {
console.log(response);
if (response) {
if (response.data.status === "success") {
this.setState({
listData: response.data.data,
id: response.data.data[0].document_category_id,
loadTable: true
id: id === undefined ? response.data.data[0].setting_id : id,
loadTable: true,
refresh: id === undefined ? '' : 'create'
})
console.log(this.state.listData)
// console.log(this.state.listData)
} else {
}
} else {
}
})
}
......@@ -54,7 +70,7 @@ export default class DocumentManagement extends Component {
<div style={{ display: 'grid', justifyContent: 'flex-end' }}>
<button
type="button"
onClick={() => this.setState({ visibleCreate: true })}
onClick={() => this.setState({ visibleCreate: true, refresh: '' })}
style={{ marginRight: 25 }}
>
<div style={{ width: 150, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
......@@ -74,19 +90,20 @@ export default class DocumentManagement extends Component {
{this.state.listData.map((item, index) => {
return (
<Tab
onClick={() => this.setState({ id: item.document_category_id })}
label={item.document_category_name}
onClick={() => this.setState({ id: item.setting_id })}
label={item.value}
/>
)
})}
</Tabs>
{this.state.loadTable && (
this.state.id === 2 ?
this.state.id === 68542 ?
<AuditTahunan
data={this.state.listData[this.state.tab]}
refresh={this.state.refresh}
/>
:
this.state.id === 1 ?
this.state.id === 68541 ?
<ManualBookTia />
:
this.state.id === 3 ?
......@@ -104,6 +121,8 @@ export default class DocumentManagement extends Component {
{this.state.visibleCreate && (
<CreateManagementDoc
onClickClose={() => this.setState({ visibleCreate: false })}
getDataDocument={this.getDataDocument.bind(this)}
setting_id={this.state.id}
/>
)}
</div>
......
......@@ -143,7 +143,11 @@ export default class CreatePerusahaan extends Component {
options: perusahaanData,
getOptionLabel: (option) => option.company_name,
};
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 {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
......@@ -183,7 +187,11 @@ export default class CreatePerusahaan extends Component {
options: typeData,
getOptionLabel: (option) => option.business_unit_name,
};
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 {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
......
......@@ -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 () => {
let res = await fetch(
"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 {
borderColor: 'transparent',
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>
</a>
<ReactTooltip border={true} id="visual" place="bottom" type="light" effect="solid" />
......@@ -783,6 +810,7 @@ export default class Perusahaan extends Component {
buttonEdit={this.state.edit}
onClickClose={() => this.setState({ visibleVisual: false, visiblePerusahaan: true })}
height={this.props.height}
updateHierarchy={this.updateHierarchy.bind(this)}
/>
:
<div>
......
......@@ -100,7 +100,9 @@ export default class VisualPerusahaan extends Component {
let payload = {
"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.ok) {
if (response.data.status == 'success') {
......@@ -129,7 +131,7 @@ export default class VisualPerusahaan extends Component {
// } else {
// alert(response.data.message)
// }
})
}) */
}
renderItem = ({ item, collapseIcon }) => {
......
......@@ -163,7 +163,7 @@ export default class AddUser extends Component {
let uniqueCompany = company.filter((val, id, array) => {
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)
this.setState({
......
......@@ -147,7 +147,7 @@ export default class EditUser extends Component {
let uniqueCompany = company.filter((val, id, array) => {
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)
this.setState({
......@@ -213,6 +213,8 @@ export default class EditUser extends Component {
this.setState({ errorStartDate: true, msgErrorSD: 'Valid From Cannot be Empty' })
} else if (R.isNil(this.state.tempData.end_date)) {
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) {
// 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