Commit 4d1cbaf5 authored by Riri Novita's avatar Riri Novita

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

parents 249edc50 d2987934
......@@ -260,8 +260,8 @@ const create = (type = "") => {
const createRollingOutlookPL = (body) => api.post('transaction/profit_loss/rolling_outlook/create_rolling_outlook', body)
const checkImportRollingOutlookPL = (body) => api.post('transaction/profit_loss/rolling_outlook/check_import', body)
const importRollingOutlookPL = (body) => api.post('transaction/profit_loss/rolling_outlook/import_rolling_outlook', body)
const getRollingOutlookTP = (body) => api.post('transaction/rolling_outlook/tax_planning/get_report_hierarki', body)
const createRollingOutlookTP = (body) => api.post('transaction/rolling_outlook/tax_planning/store_ro_tax_planning', body)
const getRollingOutlookTP = (body) => api.post('transaction/tax_planning/rolling_outlook/get_report_hierarki', body)
const createRollingOutlookTP = (body) => api.post('transaction/tax_planning/rolling_outlook/create_rolling_outlook', body)
const getRollingOutlookCAT = (body) => api.post('transaction/cat/rolling_outlook/get_report_hierarki', body)
const createRollingOutlookCAT = (body) => api.post('transaction/cat/rolling_outlook/create_rolling_outlook', body)
const checkImportRollingOutlookCAT = (body) => api.post('transaction/cat/rolling_outlook/check_import', body)
......@@ -274,6 +274,7 @@ const create = (type = "") => {
const checkUploadRollingOutlookOI = (body) => api.post('transaction/operating_indicator/rolling_outlook/check_import', body)
const uploadRollingOutlookOI = (body) => api.post('transaction/operating_indicator/rolling_outlook/import_rolling_outlook', body)
const submitRollingOutlook = (body) => api.post('transaction/rolling_outlook/submit_rolling_outlook', body)
const getRollingOutlookCompanySubmitted = (body) => api.post('transaction/rolling_outlook/get_company_submitted', body)
//REPORT NEW
const getAllReportBS = (body) => api.post('/transaction/db_balance_sheet/get_report_hierarki', body)
......@@ -762,7 +763,8 @@ const create = (type = "") => {
getLastestUpdateROOI,
checkUploadRollingOutlookOI,
uploadRollingOutlookOI,
submitRollingOutlook
submitRollingOutlook,
getRollingOutlookCompanySubmitted
}
}
......
......@@ -492,7 +492,7 @@ export default class MonthlyReport extends Component {
"months": this.state.month.month_id,
"status": selectedStatus
}
this.setState({ isApprovedMB: true })
// this.setState({ isApprovedMB: true })
api.create().getCompanySubmittedMonthly(body).then(response => {
console.log(response);
if (response.data) {
......
......@@ -64,10 +64,12 @@ export default class RollingOutlook extends Component {
minDateRevision: new Date(),
maxDateRevision: new Date(),
btnApprove: false,
listStatus: [],
selectedStatus: [],
quarterList: [
{value: 'q1', name: 'Q1'},
{value: 'q2', name: 'Q2'},
{value: 'q3', name: 'Q3'},
{ value: 'q1', name: 'Q1' },
{ value: 'q2', name: 'Q2' },
{ value: 'q3', name: 'Q3' },
// {value: 'ol_pa', name: 'OL PA'},
],
quarter: null
......@@ -87,56 +89,126 @@ export default class RollingOutlook extends Component {
// this.checkApprover()
// })
// } else {
this.checkApprover()
this.getPermission()
// }
}
getPermission() {
let payload = {
menu: "rolling outlook & cat revision"
}
api.create().getPermission(payload).then(response => {
console.log(response)
if (response.data) {
if (response.data.status === "success") {
this.setState({
btnCreate: response.data.data.create,
btnEdit: response.data.data.edit
}, () => {
this.checkApprover()
})
} 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.problem, tipeAlert: 'error' })
}
})
}
checkApprover() {
let listStatus1 = [
{ name: 'Open', value: 'not-yet' },
{ name: 'Submitted', value: 'approval_review' },
{ name: 'Waiting for Review / Approval', value: 'approval_proccess' },
{ name: 'Approved', value: 'approved' },
]
let listStatus2 = [
{ name: 'Open', value: 'not-yet' },
{ name: 'Submitted', value: 'approval_review' },
{ name: 'Approved', value: 'approved' },
]
api.create().getRollingOutlookIsApprover().then(response => {
console.log(response);
if (response.data.data.is_approver === true) {
this.setState({ isApprover: true, checkApprover: true }, () =>
this.setState({ isApprover: true, checkApprover: true, listStatus: listStatus1, selectedStatus: listStatus1 }, () =>
this.getPeriode())
} else {
this.setState({ isApprover: false, checkApprover: false }, () =>
this.getDetailUser())
this.setState({ isApprover: false, checkApprover: false, listStatus: listStatus2, selectedStatus: listStatus2 }, () =>
this.getPeriode())
// this.getDetailUser())
}
})
}
getCompanySubmitted() {
let selectedStatus = this.state.selectedStatus.map((item) => {
return item.value
})
let body = {
"periode": this.state.periode.periode
"periode": this.state.periode.periode,
"quartal": this.state.quarter.value,
"status": selectedStatus
}
api.create().getCompanySubmitted(body).then(response => {
// this.setState({ isApprovedMB: true })
api.create().getRollingOutlookCompanySubmitted(body).then(response => {
console.log(response);
if (response.data) {
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,
}
})
if (response.data.data.length > 0) {
let data = response.data.data
let companyData = data.map((item) => {
return {
company_id: item.company_id,
company_name: item.company_name,
}
})
if (companyData.length > 0) {
companyData = companyData.sort((a,b) => a.company_name.localeCompare(b.company_name))
}
let arrayBaru = []
this.state.userCompany.map((item, index) => {
let indexID = companyData.findIndex((val) => val.company_id == item)
if (indexID !== -1) {
arrayBaru.push(companyData[indexID])
}
})
let defaultProps = {
options: companyData,
getOptionLabel: (option) => titleCase(option.company_name),
};
this.setState({ listCompany: defaultProps, company: companyData[0] }, () => {
// console.log(response.data.data);
if (response.data.data.length > 0) {
this.getRevision()
} else {
this.setState({ listRevision: null, revision: null, dataTable: [], loading: false, checkApprover: false, lastRevision: "", visibleTableHistory: false })
if (arrayBaru.length > 0) {
arrayBaru = arrayBaru.sort((a, b) => a.company_name.localeCompare(b.company_name))
}
//
})
let defaultProps = {
options: arrayBaru,
getOptionLabel: (option) => titleCase(option.company_name),
}
let indexID = null
if (this.state.rawData !== undefined) {
indexID = arrayBaru.findIndex((val) => val.company_id == this.state.rawData.company_id)
}
// console.log(response.data.data.length)
this.setState({ listCompany: defaultProps, company: indexID == null ? arrayBaru[0] : arrayBaru[indexID], company_submit: defaultProps }, () => {
// console.log(response.data.data.length)
if (response.data.data.length > 0) {
this.getRevision()
} else {
// console.log(this.state.listCompany)
// console.log(this.state.company_submit)
this.setState({ listRevision: null, revision: null, dataTable: [], lastRevision: "", visibleTableHistory: false })
}
//
})
} else {
this.setState({ listRevision: null, revision: null, listCompany: null, company: null, dataTable: [], lastRevision: "", visibleTableHistory: false, loading: false }, () => {
document.body.style.overflow = 'unset';
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
......@@ -235,8 +307,9 @@ export default class RollingOutlook extends Component {
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
this.getRole(response.data.data.role_id)
this.setState({ userCompany: response.data.data.company }, () => {
this.getCompanyActive()
this.getCompanySubmitted()
})
}
}
......@@ -244,6 +317,35 @@ export default class RollingOutlook extends Component {
})
}
getRole(id) {
api.create().getDetailRole(id).then((response) => {
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
// this.setState({ tempData: response.data.data, privileges: response.data.data.privileges })
// // // console.log(response.data.data)
if (String(response.data.data.role_name).toLocaleLowerCase() == 'superadmin') {
this.setState({ isAdmin: true })
}
} 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' })
}
})
}
getCompanyActive() {
api.create().getPerusahaanActive().then((response) => {
console.log(response);
......@@ -259,7 +361,7 @@ export default class RollingOutlook extends Component {
})
if (companyData.length > 0) {
companyData = companyData.sort((a,b) => a.company_name.localeCompare(b.company_name))
companyData = companyData.sort((a, b) => a.company_name.localeCompare(b.company_name))
}
let arrayBaru = []
......@@ -271,7 +373,7 @@ export default class RollingOutlook extends Component {
})
if (arrayBaru.length > 0) {
arrayBaru = arrayBaru.sort((a,b) => a.company_name.localeCompare(b.company_name))
arrayBaru = arrayBaru.sort((a, b) => a.company_name.localeCompare(b.company_name))
}
let defaultProps = {
......@@ -311,20 +413,21 @@ export default class RollingOutlook extends Component {
getPeriode() {
api.create().getPeriodeTransaction().then(response => {
// let dateNow = new Date
// let year = this.state.rawData ? this.state.rawData.periode : format(dateNow, 'yyyy')
console.log(response)
let currentYear = new Date().getFullYear()
// console.log(currentYear)
if (response.data) {
if (response.data.status === "success") {
let data = []
response.data.data.map((item) => {
if (this.state.isApprover) {
if (item >= 2000 && item <= (Number(currentYear) + 1)) {
if (item >= 2000 && item <= (Number(currentYear))) {
data.push(item)
}
} else {
if ((item >= 2000) && (item == this.state.lastPeriod || item < this.state.lastPeriod)) {
// if ((item >= 2000) && (item == this.state.lastPeriod || item < this.state.lastPeriod)) {
// data.push(item)
// }
if ((item >= 2000) && (item == currentYear || item <= currentYear)) {
data.push(item)
}
}
......@@ -338,25 +441,42 @@ export default class RollingOutlook extends Component {
options: periodeData,
getOptionLabel: (option) => option.periode,
};
let periode = (this.state.lastPeriod == "" ? String(Number(currentYear)) : this.state.lastPeriod === undefined ? String(Number(currentYear)) : this.state.lastPeriod)
let dateNow = new Date()
dateNow.setMonth(dateNow.getMonth() - 1);
let yearNow = dateNow.getFullYear()
// let indexMonthMR = MR.findIndex((val) => val.value == yearNow)
// console.log(yearNow)
let index = data.sort((a, b) => a - b).findIndex((val) => val == yearNow)
// console.log(data)
// console.log(this.state.lastPeriod)
// console.log(periodeData)
// console.log(index)
let defaultPropsQuarter = {
options: this.state.quarterList,
getOptionLabel: (option) => option.name
}
let index = data.sort((a, b) => a - b).findIndex((val) => val === (this.state.lastPeriod == "" ? String(Number(currentYear) + 1) : this.state.latestPeriode))
// console.log(data)
console.log(this.state.lastPeriod)
// console.log(periodeData)
// console.log(index)
this.setState({ listQuarter: defaultPropsQuarter, quarter: this.state.quarterList[0], listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => {
if (this.state.isApprover === true) {
this.getCompanySubmitted()
} else {
this.getRevision()
this.setState({ listPeriode: defaultProps, listQuarter: defaultPropsQuarter, quarter: this.state.quarterList[0], periode: index === -1 ? periodeData[0] : periodeData[index] }, () => {
// if (this.state.isApprover === true && this.state.submittedOnly) {
this.getDetailUser()
// this.getCompanySubmitted()
// console.log('masuk')
// } else {
// this.getRevision()
// }
})
} 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' })
}
})
}
......@@ -517,7 +637,7 @@ export default class RollingOutlook extends Component {
visibleCAT: false,
visibleTP: true,
})
} else if (item === 'CAT') {
} else if (item === 'CAT') {
this.setState({
visibleRollingOutlook: false,
visibleBS: false,
......@@ -525,7 +645,7 @@ export default class RollingOutlook extends Component {
visibleCAT: true,
visibleTP: false,
})
}
}
})
}
......@@ -618,8 +738,8 @@ export default class RollingOutlook extends Component {
let cobaSplit = String(fileName).split("-")
let mapSplit = ""
cobaSplit.map((item, index) => {
if (item != ""){
mapSplit+= index == 0 ? `${titleCase(item)}` : ` ${item}`
if (item != "") {
mapSplit += index == 0 ? `${titleCase(item)}` : ` ${item}`
}
})
// console.log(mapSplit);
......@@ -634,7 +754,7 @@ export default class RollingOutlook extends Component {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = "(Rolling Outlook Attachment) - " +mapSplit;
a.download = "(Rolling Outlook Attachment) - " + mapSplit;
a.click();
}
}
......@@ -682,7 +802,7 @@ export default class RollingOutlook extends Component {
validateRevision() {
let arrayRevisi = this.state.detailRevisiCheck
let remarksKosong = 0
arrayRevisi.map((item,index) => {
arrayRevisi.map((item, index) => {
if (item.remarks == "") {
remarksKosong += 1
}
......@@ -697,7 +817,7 @@ export default class RollingOutlook extends Component {
render() {
const handleMaxDate = () => {
let handleDate = Number(moment(this.state.maxDateRevision).format('YYYYMMDD')) - Number(moment(this.state.minDateRevision).format('YYYYMMDD'))
return handleDate < 0? moment(this.state.minDateRevision).format('YYYY/MM/DD') : moment(this.state.maxDateRevision).format('YYYY/MM/DD')
return handleDate < 0 ? moment(this.state.minDateRevision).format('YYYY/MM/DD') : moment(this.state.maxDateRevision).format('YYYY/MM/DD')
}
const columns = ["#", "Report Type",
{
......@@ -775,7 +895,7 @@ export default class RollingOutlook extends Component {
onClick={() =>
tableMeta.rowData[5] == true ?
this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4], tableMeta.rowData[2], tableMeta.rowData[3])
: null
: null
}
>
{/* {this.state.isApprover == true ?
......@@ -943,10 +1063,10 @@ export default class RollingOutlook extends Component {
{...this.state.listPeriode}
id="periode"
onChange={(event, newInputValue) => this.setState({ periode: newInputValue }, () => {
if (this.state.isApprover === true) {
this.setState({ visibleTableHistory: false })
if (this.state.listCompany == null) {
this.getCompanySubmitted()
} else {
this.setState({ visibleTableHistory: false })
this.getRevision()
}
})}
......@@ -966,14 +1086,35 @@ export default class RollingOutlook extends Component {
disabled={this.state.intent === 'Home' ? true : false}
onChange={(event, newInputValue) => this.setState({ quarter: newInputValue }, () => {
this.setState({ visibleTableHistory: false })
this.getRevision()
if (this.state.listCompany == null) {
this.getCompanySubmitted()
} else {
this.getRevision()
}
})}
disableClearable
style={{ width: 250 }}
renderInput={(params) => <TextField {...params} label="Company" margin="normal" style={{ marginTop: 7 }} />}
renderInput={(params) => <TextField {...params} label="Quarter" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.quarter}
/>
</div>
<div style={{ marginTop: 20 }}>
<Autocomplete
multiple
id="tags-standard"
options={this.state.listStatus}
getOptionLabel={(option) => option.name}
style={{ width: 250 }}
onChange={(event, newInputValue) => {
this.setState({ selectedStatus: newInputValue, loading: true }, () => {
console.log(newInputValue);
this.getCompanySubmitted()
})
}}
value={this.state.selectedStatus}
renderInput={(params) => <TextField {...params} label="Submission Status" margin="normal" style={{ marginTop: 7 }} />}
/>
</div>
<div style={{ marginTop: 20 }}>
<Autocomplete
{...this.state.listCompany}
......@@ -1370,7 +1511,7 @@ export default class RollingOutlook extends Component {
id="startDate"
label="Valid From"
format="dd-MM-yyyy"
onChange={(e) => this.setState({minDateRevision: moment(e).format('YYYY/MM/DD')}, () => this.setState({maxDateRevision: handleMaxDate()}))}
onChange={(e) => this.setState({ minDateRevision: moment(e).format('YYYY/MM/DD') }, () => this.setState({ maxDateRevision: handleMaxDate() }))}
value={moment(this.state.minDateRevision).format('YYYY/MM/DD')}
KeyboardButtonProps={{
'aria-label': 'change date',
......@@ -1397,7 +1538,7 @@ export default class RollingOutlook extends Component {
id="startDate"
label="Valid To"
format="dd-MM-yyyy"
onChange={(e) => this.setState({maxDateRevision: moment(e).format('YYYY/MM/DD')})}
onChange={(e) => this.setState({ maxDateRevision: moment(e).format('YYYY/MM/DD') })}
minDate={moment(this.state.minDateRevision).format('YYYY/MM/DD')}
value={moment(this.state.maxDateRevision).format('YYYY/MM/DD')}
KeyboardButtonProps={{
......
......@@ -3776,7 +3776,8 @@ export default class TaxPlanning extends Component {
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
<span>{"Trial Balance (Commercial) MTD"}</span>
</div>
&&
: null }
{this.props.quarter == 'q1' || this.props.quarter == 'q2' ?
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
<span>{"Fiscal Correction Positive /(Negative)"}</span>
</div>
......@@ -3937,7 +3938,8 @@ export default class TaxPlanning extends Component {
}
</div>
</div>
&&
: null }
{this.props.quarter == 'q1' || this.props.quarter == 'q2' ?
<div className="col-2">
<div style={{ textAlign: 'right' }}>
{
......@@ -4226,7 +4228,8 @@ export default class TaxPlanning extends Component {
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
<span>{"Trial Balance (Commercial) MTD"}</span>
</div>
&&
: null }
{this.props.quarter == 'q1' || this.props.quarter == 'q2' ?
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
<span>{"Fiscal Correction Positive /(Negative)"}</span>
</div>
......@@ -4387,7 +4390,8 @@ export default class TaxPlanning extends Component {
}
</div>
</div>
&&
: null }
{this.props.quarter == 'q1' || this.props.quarter == 'q2' ?
<div className="col-2">
<div style={{ textAlign: 'right' }}>
{
......@@ -6154,7 +6158,7 @@ export default class TaxPlanning extends Component {
name: `${this.props.periode}`,
options: {
customHeadRender: (columnMeta) => (
<div style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 200, borderRight: "1px solid rgb(255, 255, 255)" }} >
<div style={{ ...style2, top: 0, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 200, borderRight: "1px solid rgb(255, 255, 255)" }} >
{/* <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> */}
......
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