Commit f2ac3d17 authored by faisalhamdi's avatar faisalhamdi

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

parents 6e90b9ac 644d4c0a
......@@ -249,14 +249,28 @@ const create = (type = "") => {
const getRollingOutlookLastUpdate = (body) => api.post('transaction/rolling_outlook/get_latest_update', body)
const getRollingOutlookRevision = (body) => api.post('transaction/rolling_outlook/get_revision', body)
const getRollingOutlookIsApprover = (body) => api.get('transaction/rolling_outlook/is_approver')
const uploadAttachmentRO = (body) => api.post('transaction/rolling_outlook/upload_attachment', body)
const deleteAttachmentRO = (id) => api.post(`transaction/rolling_outlook/delete_attachment/${id}`)
const getRollingOutlookBS = (body) => api.post('transaction/balance_sheet/rolling_outlook/get_report_hierarki', body)
const checkImportRollingOutlookBS = (body) => api.post('transaction/balance_sheet/rolling_outlook/check_import', body)
const importRollingOutlookBS = (body) => api.post('transaction/balance_sheet/rolling_outlook/import_rolling_outlook', body)
const createRollingOutlookBS = (body) => api.post('transaction/balance_sheet/rolling_outlook/create_rolling_outlook', body)
const getRollingOutlookPL = (body) => api.post('transaction/profit_loss/rolling_outlook/get_report_hierarki', body)
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 getRollingOutlookCAT = (body) => api.post('transaction/cat/rolling_outlook/get_report_hierarki', body)
const getSubmitRollingOutlook = (body) => api.post('transaction/rolling_outlook/get_latest_periode_submit', body)
const getRollingOI = (body) => api.post('transaction/operating_indicator/rolling_outlook/get_operating_indicator_id', body)
const getHierarkiRollingOI = (body) => api.post('transaction/operating_indicator/rolling_outlook/get_report_hierarki', body)
const createRollingOI = (body) => api.post('transaction/operating_indicator/rolling_outlook/create_rolling_outlook', body)
const getLastestUpdateROOI = (body) => api.post('transaction/operating_indicator/rolling_outlook/get_latest_update', body)
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)
//REPORT NEW
......@@ -728,9 +742,21 @@ const create = (type = "") => {
getRollingOutlookLastUpdate,
getRollingOutlookRevision,
getRollingOutlookIsApprover,
uploadAttachmentRO,
deleteAttachmentRO,
checkImportRollingOutlookBS,
importRollingOutlookBS,
getRollingOutlookCAT
getRollingOutlookCAT,
createRollingOutlookPL,
checkImportRollingOutlookPL,
importRollingOutlookPL,
getSubmitRollingOutlook,
getRollingOI,
getHierarkiRollingOI,
createRollingOI,
getLastestUpdateROOI,
checkUploadRollingOutlookOI,
uploadRollingOutlookOI
}
}
......
......@@ -50,7 +50,7 @@ export default class getAllDocument extends Component {
}
this.setState({ loading: true })
api.create().getAllDocument(payload).then(response => {
// console.log(response)
console.log(response)
if (response.data) {
if (response.ok) {
if (response.data.status == 'success') {
......@@ -69,6 +69,7 @@ export default class getAllDocument extends Component {
String(Number(item.document_size) / 1000 + ' KB'),
item.created_by,
item.created_at,
item.values
])
} else {
if (indexId !== -1) {
......@@ -83,6 +84,7 @@ export default class getAllDocument extends Component {
String(Number(item.document_size) / 1000 + ' KB'),
item.created_by,
item.created_at,
item.values
])
}
}
......@@ -121,17 +123,18 @@ export default class getAllDocument extends Component {
}
openPopUp = async (index, val, type) =>{
console.log(index)
if (type === 'download') {
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/document/download_document?documentName=`+this.state.docPath[val]+"&&fileType="+index[6]
)
res = await res.blob()
// console.log(res)
console.log(res)
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = index[1];
a.download = (String(index[3]).includes(":") ? String(index[3]).replace(":", " (") + ` )` : String(index[3])) +" - "+index[4]+" - "+index[5]+" - "+index[10]+"."+index[6];
a.click();
}
}
......@@ -270,7 +273,14 @@ export default class getAllDocument extends Component {
);
}
}
}, "File Name", "Description",
},
{
name: "File Name",
options: {
display: false
}
},
"Description",
{
name: "Company Name",
options: {
......@@ -289,7 +299,13 @@ export default class getAllDocument extends Component {
display: String(this.props.data.value).includes('Manual Book TIA') ? false : true
}
},
"Type", "File Size", "Created By", "Created Date"
"Type", "File Size", "Created By", "Created Date",
{
name: "Category",
options: {
display: false
}
},
]
const loadingComponent = (
......
......@@ -80,7 +80,7 @@ export default class OperatingIndicator extends Component {
}
getLastPeriod() {
api.create().getLastPeriodOI(this.state.company.company_id).then(response => {
api.create().getLastPeriodOI(this.state.company.company_id).then(response => {
// console.log(response);
if (response.data.status === "success") {
this.setState({ lastPeriod: response.data.data.last_periode, latestPeriode: response.data.data.latest_periode }, () => {
......@@ -190,7 +190,7 @@ export default class OperatingIndicator 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 = {
......@@ -315,22 +315,22 @@ export default class OperatingIndicator extends Component {
visibleDetailOpt: true,
visibleDetailMonthly: false,
visibleDetailRolling: false
})
} else if (String(item[1]).toLocaleLowerCase().includes("monthly report")) {
console.log(item);
let month = String(item[1]).toLocaleLowerCase().includes('jan') ? 1 :
String(item[1]).toLocaleLowerCase().includes('feb') ? 2 :
String(item[1]).toLocaleLowerCase().includes('mar') ? 3 :
String(item[1]).toLocaleLowerCase().includes('apr') ? 4 :
String(item[1]).toLocaleLowerCase().includes('may') ? 5 :
String(item[1]).toLocaleLowerCase().includes('jun') ? 6 :
String(item[1]).toLocaleLowerCase().includes('jul') ? 7 :
String(item[1]).toLocaleLowerCase().includes('aug') ? 8 :
String(item[1]).toLocaleLowerCase().includes('sep') ? 9 :
String(item[1]).toLocaleLowerCase().includes('oct') ? 10 :
String(item[1]).toLocaleLowerCase().includes('nov') ? 11 :
String(item[1]).toLocaleLowerCase().includes('dec') ? 12 : null
let month = String(item[1]).toLocaleLowerCase().includes('jan') ? 1 :
String(item[1]).toLocaleLowerCase().includes('feb') ? 2 :
String(item[1]).toLocaleLowerCase().includes('mar') ? 3 :
String(item[1]).toLocaleLowerCase().includes('apr') ? 4 :
String(item[1]).toLocaleLowerCase().includes('may') ? 5 :
String(item[1]).toLocaleLowerCase().includes('jun') ? 6 :
String(item[1]).toLocaleLowerCase().includes('jul') ? 7 :
String(item[1]).toLocaleLowerCase().includes('aug') ? 8 :
String(item[1]).toLocaleLowerCase().includes('sep') ? 9 :
String(item[1]).toLocaleLowerCase().includes('oct') ? 10 :
String(item[1]).toLocaleLowerCase().includes('nov') ? 11 :
String(item[1]).toLocaleLowerCase().includes('dec') ? 12 : null
this.setState({
statusDetail: String(item[2]).toLocaleLowerCase(),
dataDetail: { ...this.state.dataReport[index], periode: this.state.periode.periode, operatingIndID: this.state.operatingIndID, company: this.state.company },
......@@ -339,18 +339,22 @@ export default class OperatingIndicator extends Component {
visibleDetailMonthly: true,
visibleDetailRolling: false,
months: month
})
} else if (String(item[1]).toLocaleLowerCase().includes("rolling outlook")) {
let quarter =String(item[1]).toLocaleLowerCase().includes('q1') ? "q1" :
String(item[1]).toLocaleLowerCase().includes('q2') ? "q2" :
String(item[1]).toLocaleLowerCase().includes('q3') ? "q3" : null
this.setState({
statusDetail: String(item[2]).toLocaleLowerCase(),
dataDetail: { ...this.state.dataReport[index], periode: this.state.periode.periode, operatingIndID: this.state.operatingIndID, company: this.state.company },
visibleOperatingIndicator: false,
visibleDetailOpt: false,
visibleDetailMonthly: false,
visibleDetailRolling: true
visibleDetailRolling: true,
quartal: quarter
})
} else {
this.setState({
......@@ -360,7 +364,7 @@ export default class OperatingIndicator extends Component {
visibleDetailOpt: false,
visibleDetailMonthly: false,
visibleDetailRolling: true
})
}
......@@ -421,7 +425,7 @@ export default class OperatingIndicator extends Component {
}
saveRollingOI(payload) {
api.create().createMonthlyReportOI(payload).then((response) => {
api.create().createRollingOI(payload).then((response) => {
console.log(response);
this.getReport()
this.getOperatingID()
......@@ -504,10 +508,10 @@ export default class OperatingIndicator extends Component {
borderColor: 'transparent'
}}
onClick={() =>
tableMeta.rowData[4] ?
this.clickDetail(tableMeta.rowData, tableMeta.rowData[1], tableMeta.rowData[3], tableMeta.rowData[2])
:
null
// tableMeta.rowData[4] ?
this.clickDetail(tableMeta.rowData, tableMeta.rowData[1], tableMeta.rowData[3], tableMeta.rowData[2])
// :
// null
}
>
<Typography style={{ color: tableMeta.rowData[4] ? '#5198ea' : 'GrayText', fontSize: 12, }}>Detail</Typography>
......@@ -640,7 +644,7 @@ export default class OperatingIndicator extends Component {
})}
getReport={() => this.getOperatingID()}
saveOperatingInd={this.saveOperatingInd.bind(this)}
isSubmit={this.state.statusDetail == 'closed'? false : this.state.isSubmit}
isSubmit={this.state.statusDetail == 'closed' ? false : this.state.isSubmit}
permission={{ create: this.state.buttonCreate, edit: this.state.buttonEdit, delete: this.state.buttonDelete }}
/>
}
......@@ -658,7 +662,7 @@ export default class OperatingIndicator extends Component {
})}
getReport={() => this.getOperatingID()}
saveMonthlyOI={this.saveMonthlyOI.bind(this)}
isSubmit={this.state.statusDetail == 'closed'? false : this.state.isSubmit}
isSubmit={this.state.statusDetail == 'closed' ? false : this.state.isSubmit}
permission={{ create: this.state.buttonCreate, edit: this.state.buttonEdit, delete: this.state.buttonDelete }}
/>
}
......@@ -669,7 +673,7 @@ export default class OperatingIndicator extends Component {
data={this.state.dataDetail}
height={this.props.height}
width={this.props.width}
months={this.state.months}
quartal={this.state.quartal}
company={this.state.company}
onClickClose={() => this.setState({ visibleDetailRolling: false, visibleOperatingIndicator: true }, () => {
this.getOperatingID()
......@@ -677,7 +681,7 @@ export default class OperatingIndicator extends Component {
})}
getReport={() => this.getOperatingID()}
saveRollingOI={this.saveRollingOI.bind(this)}
isSubmit={this.state.statusDetail == 'closed'? false : this.state.isSubmit}
isSubmit={this.state.statusDetail == 'closed' ? false : this.state.isSubmit}
permission={{ create: this.state.buttonCreate, edit: this.state.buttonEdit, delete: this.state.buttonDelete }}
/>
}
......
......@@ -212,13 +212,15 @@ export default class RollingOutlook extends Component {
getLatestPeriodSubmit() {
let body = {
"company_id": this.state.company.company_id,
"periode": this.state.periode.periode
"periode": this.state.periode.periode,
"is_approver": this.state.isApprover,
"quartal": this.state.quarter.value
}
api.create().getSubmitMasterBudget(body).then(response => {
api.create().getSubmitRollingOutlook(body).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.setState({ isSubmit: true }, () => {
this.setState({ isSubmit: response.data.data.is_can_submit }, () => {
this.getReport()
this.getReportAttachment()
})
......@@ -552,14 +554,14 @@ export default class RollingOutlook extends Component {
}
uploadAttachment(formData) {
// var object = {};
// formData.forEach(function (value, key) {
// object[key] = value;
// });
// var json = JSON.stringify(object);
// console.log(object)
// console.log(json)
api.create().uploadAttachment(formData).then(response => {
var object = {};
formData.forEach(function (value, key) {
object[key] = value;
});
var json = JSON.stringify(object);
console.log(object)
console.log(json)
api.create().uploadAttachmentRO(formData).then(response => {
console.log(response)
if (response.data) {
if (response.data.status === "success") {
......@@ -572,7 +574,7 @@ export default class RollingOutlook extends Component {
}
deleteAttachment(item) {
api.create().deleteAttachment(item.attachment_id).then(response => {
api.create().deleteAttachmentRO(item.attachment_id).then(response => {
if (response.data) {
if (response.data.status === "success") {
this.getRollingOutlookID()
......@@ -610,6 +612,17 @@ export default class RollingOutlook extends Component {
let length = name.split(".").length
let fileType = name.split(".")[length - 1]
console.log(fileType);
// console.log(fileurl);
let indexStrip = String(fileurl).indexOf("-")
let fileName = String(fileurl).substr(indexStrip + 1, String(fileurl).length)
let cobaSplit = String(fileName).split("-")
let mapSplit = ""
cobaSplit.map((item, index) => {
if (item != ""){
mapSplit+= index == 0 ? `${titleCase(item)}` : ` ${item}`
}
})
// console.log(mapSplit);
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/download_attachment?fileName=${fileurl}&&fileType=${fileType}`
// console.log(url);
let res = await fetch(
......@@ -621,7 +634,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.xlsx';
a.download = "(Rolling Outlook Attachment) - " +mapSplit;
a.click();
}
}
......@@ -760,9 +773,9 @@ export default class RollingOutlook extends Component {
borderColor: 'transparent'
}}
onClick={() =>
// tableMeta.rowData[5] == true ?
tableMeta.rowData[5] == true ?
this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4], tableMeta.rowData[2], tableMeta.rowData[3])
// : null
: null
}
>
{/* {this.state.isApprover == true ?
......@@ -1251,8 +1264,9 @@ export default class RollingOutlook extends Component {
rollingOutlookID={this.state.rollingOutlookID}
refresh={this.getRollingOutlookID.bind(this)}
onClickClose={() => this.setState({ visibleBS: false, visibleRollingOutlook: true })}
isApprover={'false'}
isApprover={this.state.isApprover}
quarter={this.state.quarter.value}
prevRevision={this.state.isSubmit ? this.state.prevRevision : true}
/>
)}
......@@ -1269,7 +1283,8 @@ export default class RollingOutlook extends Component {
onClickClose={() => this.setState({ visiblePL: false, visibleRollingOutlook: true })}
refresh={this.getRollingOutlookID.bind(this)}
quarter={this.state.quarter.value}
isApprover={'false'}
isApprover={this.state.isApprover}
prevRevision={this.state.isSubmit ? this.state.prevRevision : true}
/>
)}
......@@ -1288,7 +1303,8 @@ export default class RollingOutlook extends Component {
status={this.state.status}
lastStatus={this.state.lastStatus}
quarter={this.state.quarter.value}
isApprover={'false'}
isApprover={this.state.isApprover}
prevRevision={this.state.isSubmit ? this.state.prevRevision : true}
/>
)}
......
......@@ -64,6 +64,40 @@ export default class BalanceSheetRO extends Component {
componentDidMount() {
// this.getItemHierarki()
this.getSettingControl()
this.handleViewOnly()
}
handleViewOnly() {
let checkApprover = false
let checkLastStatus = false
let checkStatus = false
let checkPrevRev = false
if (this.props.isApprover) {
checkApprover = true
} else {
checkApprover = false
}
if (this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') {
checkLastStatus = true
} else {
checkLastStatus = false
}
if (this.props.prevRevision) {
checkPrevRev = true
} else {
checkPrevRev = false
}
if (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') {
checkStatus = true
} else {
checkStatus = false
}
this.setState({ viewOnly: !checkApprover && checkLastStatus && checkStatus && checkPrevRev })
}
getSettingControl() {
......@@ -212,7 +246,7 @@ export default class BalanceSheetRO extends Component {
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/balance_sheet/rolling_outlook/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&quartal=${this.props.quarter}`
)
res = await res.blob()
// console.log(res)
console.log(`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/balance_sheet/rolling_outlook/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&quartal=${this.props.quarter}`)
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
......@@ -1481,7 +1515,7 @@ export default class BalanceSheetRO extends Component {
type="text"
placeholder=""
// disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
disabled={this.props.quarter == 'q1'? true : false}
disabled={this.props.quarter == 'q1'? false : true}
value={Number(val).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
......@@ -1612,7 +1646,7 @@ export default class BalanceSheetRO extends Component {
type="text"
placeholder=""
// disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
disabled={this.props.quarter == 'q1'? true : false}
disabled={this.props.quarter == 'q1'? false : true}
value={Number(val).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
......@@ -1743,7 +1777,7 @@ export default class BalanceSheetRO extends Component {
type="text"
placeholder=""
// disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
disabled={this.props.quarter == 'q1'? true : false}
disabled={this.props.quarter == 'q1'? false : true}
value={Number(val).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
......@@ -1874,7 +1908,7 @@ export default class BalanceSheetRO extends Component {
type="text"
placeholder=""
// disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
disabled={this.props.quarter == 'q1' || this.props.quarter == 'q2'? true : false}
disabled={this.props.quarter == 'q1' || this.props.quarter == 'q2'? false : true}
value={Number(val).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
......@@ -2005,7 +2039,7 @@ export default class BalanceSheetRO extends Component {
type="text"
placeholder=""
// disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
disabled={this.props.quarter == 'q1' || this.props.quarter == 'q2'? true : false}
disabled={this.props.quarter == 'q1' || this.props.quarter == 'q2'? false : true}
value={Number(val).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
......@@ -2136,7 +2170,7 @@ export default class BalanceSheetRO extends Component {
type="text"
placeholder=""
// disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
disabled={this.props.quarter == 'q1' || this.props.quarter == 'q2'? true : false}
disabled={this.props.quarter == 'q1' || this.props.quarter == 'q2'? false : true}
value={Number(val).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
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