Commit 06308efb authored by Dida Adams Arizona's avatar Dida Adams Arizona

update

parent d5824a92
...@@ -81,7 +81,7 @@ export default class BudgetTahunan extends Component { ...@@ -81,7 +81,7 @@ export default class BudgetTahunan extends Component {
}) })
this.props.selectIndex('Master Budget & CAT') this.props.selectIndex('Master Budget & CAT')
if (this.props.location.state !== undefined) { if (this.props.location.state !== undefined) {
// console.log(this.props); // // console.log(this.props);
this.setState({ userType: this.props.location.state.userType, intent: 'Home', lastPeriod: this.props.location.state.rawData.periode, rawData: this.props.location.state.rawData }, () => { this.setState({ userType: this.props.location.state.userType, intent: 'Home', lastPeriod: this.props.location.state.rawData.periode, rawData: this.props.location.state.rawData }, () => {
this.checkApprover() this.checkApprover()
}) })
...@@ -96,7 +96,7 @@ export default class BudgetTahunan extends Component { ...@@ -96,7 +96,7 @@ export default class BudgetTahunan extends Component {
if (response.ok) { if (response.ok) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
// this.setState({ tempData: response.data.data, privileges: response.data.data.privileges }) // this.setState({ tempData: response.data.data, privileges: response.data.data.privileges })
// console.log(response.data.data) // // console.log(response.data.data)
if (String(response.data.data.role_name).toLocaleLowerCase() == 'superadmin') { if (String(response.data.data.role_name).toLocaleLowerCase() == 'superadmin') {
this.setState({isAdmin: true}) this.setState({isAdmin: true})
} }
...@@ -125,10 +125,10 @@ export default class BudgetTahunan extends Component { ...@@ -125,10 +125,10 @@ export default class BudgetTahunan extends Component {
checkApprover() { checkApprover() {
api.create().checkApprover().then(response => { api.create().checkApprover().then(response => {
console.log(response.data.data) // console.log(response.data.data)
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
// console.log(response); // // console.log(response);
if (response.data.data.is_approver === true) { if (response.data.data.is_approver === true) {
this.setState({ isApprover: true, checkApprover: true }, () => this.setState({ isApprover: true, checkApprover: true }, () =>
this.getPeriode()) this.getPeriode())
...@@ -157,7 +157,7 @@ export default class BudgetTahunan extends Component { ...@@ -157,7 +157,7 @@ export default class BudgetTahunan extends Component {
"periode": this.state.periode.periode "periode": this.state.periode.periode
} }
api.create().getCompanySubmitted(body).then(response => { api.create().getCompanySubmitted(body).then(response => {
// console.log(response); // // console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
if (response.data.data.length > 0) { if (response.data.data.length > 0) {
...@@ -179,7 +179,7 @@ export default class BudgetTahunan extends Component { ...@@ -179,7 +179,7 @@ export default class BudgetTahunan extends Component {
} }
this.setState({ listCompany: defaultProps, company: indexID == null? companyData[0] : companyData[indexID]}, () => { this.setState({ listCompany: defaultProps, company: indexID == null? companyData[0] : companyData[indexID]}, () => {
// console.log(response.data.data); // // console.log(response.data.data);
if (response.data.data.length > 0) { if (response.data.data.length > 0) {
this.getRevision() this.getRevision()
} else { } else {
...@@ -215,13 +215,13 @@ export default class BudgetTahunan extends Component { ...@@ -215,13 +215,13 @@ export default class BudgetTahunan extends Component {
"revision": this.state.revision.revision, "revision": this.state.revision.revision,
} }
api.create().getMasterBudgetAtt(payload).then(response => { api.create().getMasterBudgetAtt(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") {
this.setState({ listAttachment: response.data.data }) this.setState({ listAttachment: response.data.data })
} }
} }
// console.log(response); // // console.log(response);
}) })
} }
...@@ -232,7 +232,7 @@ export default class BudgetTahunan extends Component { ...@@ -232,7 +232,7 @@ export default class BudgetTahunan extends Component {
"report_type": "Master Budget", "report_type": "Master Budget",
} }
api.create().getReportTypeBody(payload).then(response => { api.create().getReportTypeBody(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 dataTable = response.data.data.map((item, index) => { let dataTable = response.data.data.map((item, index) => {
...@@ -256,7 +256,7 @@ export default class BudgetTahunan extends Component { ...@@ -256,7 +256,7 @@ export default class BudgetTahunan extends Component {
]) ])
} }
}) })
// console.log(dataTableRevision); // // console.log(dataTableRevision);
this.setState({ dataTable, loading: false, dataTableRevision, dataForRevision: response.data.data }, ()=> { this.setState({ dataTable, loading: false, dataTableRevision, dataForRevision: response.data.data }, ()=> {
document.body.style.overflow = 'unset'; document.body.style.overflow = 'unset';
}) })
...@@ -275,7 +275,7 @@ export default class BudgetTahunan extends Component { ...@@ -275,7 +275,7 @@ export default class BudgetTahunan extends Component {
"periode": this.state.periode.periode "periode": this.state.periode.periode
} }
api.create().getSubmitMasterBudget(body).then(response => { api.create().getSubmitMasterBudget(body).then(response => {
// console.log(response); // // console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ isSubmit: response.data.data.is_can_submit }, () => { this.setState({ isSubmit: response.data.data.is_can_submit }, () => {
...@@ -305,7 +305,7 @@ export default class BudgetTahunan extends Component { ...@@ -305,7 +305,7 @@ export default class BudgetTahunan extends Component {
getCompanyActive() { getCompanyActive() {
api.create().getPerusahaanActive().then((response) => { api.create().getPerusahaanActive().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
...@@ -351,7 +351,7 @@ export default class BudgetTahunan extends Component { ...@@ -351,7 +351,7 @@ export default class BudgetTahunan extends Component {
getLastPeriod() { getLastPeriod() {
api.create().getLastPeriod(this.state.company.company_id).then(response => { api.create().getLastPeriod(this.state.company.company_id).then(response => {
// console.log(response); // // console.log(response);
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ lastPeriod: response.data.data.last_periode, latestPeriode: response.data.data.latest_periode }, () => { this.setState({ lastPeriod: response.data.data.last_periode, latestPeriode: response.data.data.latest_periode }, () => {
this.getPeriode() this.getPeriode()
...@@ -365,7 +365,7 @@ export default class BudgetTahunan extends Component { ...@@ -365,7 +365,7 @@ export default class BudgetTahunan extends Component {
// let dateNow = new Date // let dateNow = new Date
// let year = this.state.rawData ? this.state.rawData.periode : format(dateNow, 'yyyy') // let year = this.state.rawData ? this.state.rawData.periode : format(dateNow, 'yyyy')
let currentYear = new Date().getFullYear() let currentYear = new Date().getFullYear()
// console.log(currentYear) // // console.log(currentYear)
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
let data = [] let data = []
...@@ -391,10 +391,10 @@ export default class BudgetTahunan extends Component { ...@@ -391,10 +391,10 @@ export default class BudgetTahunan extends Component {
}; };
let periode = (this.state.lastPeriod == "" ? String(Number(currentYear) + 1) : this.state.lastPeriod) let periode = (this.state.lastPeriod == "" ? String(Number(currentYear) + 1) : this.state.lastPeriod)
let index = data.sort((a, b) => a - b).findIndex((val) => val === periode) let index = data.sort((a, b) => a - b).findIndex((val) => val === periode)
// console.log(data) // // console.log(data)
// console.log(this.state.latestPeriode) // // console.log(this.state.latestPeriode)
// console.log(periodeData) // // console.log(periodeData)
// console.log(index) // // console.log(index)
this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => { this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => {
if (this.state.isApprover === true) { if (this.state.isApprover === true) {
this.getCompanySubmitted() this.getCompanySubmitted()
...@@ -413,7 +413,7 @@ export default class BudgetTahunan extends Component { ...@@ -413,7 +413,7 @@ export default class BudgetTahunan extends Component {
"periode": this.state.periode.periode "periode": this.state.periode.periode
} }
api.create().getRevision(payload).then(response => { api.create().getRevision(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
...@@ -455,7 +455,7 @@ export default class BudgetTahunan extends Component { ...@@ -455,7 +455,7 @@ export default class BudgetTahunan extends Component {
"is_approver": this.state.isApprover "is_approver": this.state.isApprover
} }
api.create().getSubmission(payload).then(response => { api.create().getSubmission(payload).then(response => {
console.log(response.data.data.last_status) // console.log(response.data.data.last_status)
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ this.setState({
...@@ -467,11 +467,11 @@ export default class BudgetTahunan extends Component { ...@@ -467,11 +467,11 @@ export default class BudgetTahunan extends Component {
btnApprove: response.data.data.is_submit, btnApprove: response.data.data.is_submit,
// loading: false // loading: false
}, () => { }, () => {
// console.log(this.state.lastStatus); // // console.log(this.state.lastStatus);
this.historyApproval() this.historyApproval()
this.getLatestPeriodSubmit() this.getLatestPeriodSubmit()
api.create().checkApprover().then(response => { api.create().checkApprover().then(response => {
// console.log(response); // // console.log(response);
if (response.data.data.is_approver === true) { if (response.data.data.is_approver === true) {
this.setState({ isApprover: true, checkApprover: true }) this.setState({ isApprover: true, checkApprover: true })
} else { } else {
...@@ -503,7 +503,7 @@ export default class BudgetTahunan extends Component { ...@@ -503,7 +503,7 @@ export default class BudgetTahunan extends Component {
"periode": this.state.periode.periode "periode": this.state.periode.periode
} }
api.create().historyApproval(body).then(response => { api.create().historyApproval(body).then(response => {
// console.log(response); // // console.log(response);
if (response.data.data.length > 0) { if (response.data.data.length > 0) {
let dataTableHistory = response.data.data.map(item => { let dataTableHistory = response.data.data.map(item => {
return [ return [
...@@ -534,10 +534,10 @@ export default class BudgetTahunan extends Component { ...@@ -534,10 +534,10 @@ export default class BudgetTahunan extends Component {
"min_periode": moment(this.state.minDateRevision).format('YYYY-MM-DD'), "min_periode": moment(this.state.minDateRevision).format('YYYY-MM-DD'),
"max_periode": moment(this.state.maxDateRevision).format('YYYY-MM-DD') "max_periode": moment(this.state.maxDateRevision).format('YYYY-MM-DD')
} }
console.log(payload) // // console.log(payload)
console.log(body) // // console.log(body)
api.create().approvalSubmission(body).then((res) => { api.create().approvalSubmission(body).then((res) => {
console.log(res) // // console.log(res)
// this.setState({ loading: false }, () => { // this.setState({ loading: false }, () => {
// }) // })
if (type == 'revision') { if (type == 'revision') {
...@@ -554,7 +554,7 @@ export default class BudgetTahunan extends Component { ...@@ -554,7 +554,7 @@ export default class BudgetTahunan extends Component {
} else { } else {
items = item items = item
} }
// console.log(this.state.dataForRevision); // // console.log(this.state.dataForRevision);
this.state.dataForRevision.map(i => { this.state.dataForRevision.map(i => {
if (i.report_name === items) { if (i.report_name === items) {
if (i.revision !== revision) { if (i.revision !== revision) {
...@@ -641,9 +641,9 @@ export default class BudgetTahunan extends Component { ...@@ -641,9 +641,9 @@ export default class BudgetTahunan extends Component {
fileHandler = (event) => { fileHandler = (event) => {
let fileObj = event let fileObj = event
ExcelRenderer(fileObj, (err, resp) => { ExcelRenderer(fileObj, (err, resp) => {
// console.log(resp) // // console.log(resp)
if (err) { if (err) {
// console.log(err); // // console.log(err);
} }
else { else {
const formData = new FormData(); const formData = new FormData();
...@@ -670,7 +670,7 @@ export default class BudgetTahunan extends Component { ...@@ -670,7 +670,7 @@ export default class BudgetTahunan extends Component {
deleteAttachment(item) { deleteAttachment(item) {
api.create().deleteAttachment(item.attachment_id).then(response => { api.create().deleteAttachment(item.attachment_id).then(response => {
// console.log(response); // // console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.getSubmission() this.getSubmission()
...@@ -687,9 +687,9 @@ export default class BudgetTahunan extends Component { ...@@ -687,9 +687,9 @@ export default class BudgetTahunan extends Component {
this.setState({ loading: true }, ()=> { this.setState({ loading: true }, ()=> {
document.body.style.overflow = 'hidden'; document.body.style.overflow = 'hidden';
}) })
// console.log(JSON.stringify(data)); // // console.log(JSON.stringify(data));
api.create('UPLOAD').createSubmitReport(data).then(response => { api.create('UPLOAD').createSubmitReport(data).then(response => {
// console.log(response); // // console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.getSubmission() this.getSubmission()
...@@ -711,9 +711,9 @@ export default class BudgetTahunan extends Component { ...@@ -711,9 +711,9 @@ export default class BudgetTahunan extends Component {
async downloadAttachment(fileurl, name) { async downloadAttachment(fileurl, name) {
let length = name.split(".").length let length = name.split(".").length
let fileType = name.split(".")[length - 1] let fileType = name.split(".")[length - 1]
// console.log(fileType); // // console.log(fileType);
let url = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/download_attachment?fileName=${fileurl}&&fileType=${fileType}` let url = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/download_attachment?fileName=${fileurl}&&fileType=${fileType}`
// console.log(url); // // console.log(url);
let res = await fetch( let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/download_attachment?fileName=${fileurl}&&fileType=${fileType}` `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/download_attachment?fileName=${fileurl}&&fileType=${fileType}`
) )
...@@ -754,7 +754,7 @@ export default class BudgetTahunan extends Component { ...@@ -754,7 +754,7 @@ export default class BudgetTahunan extends Component {
submission_id: this.state.submissionID submission_id: this.state.submissionID
} }
api.create().submitMasterBudget(body).then(response => { api.create().submitMasterBudget(body).then(response => {
// console.log(response); // // console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.getSubmission() this.getSubmission()
...@@ -767,9 +767,9 @@ export default class BudgetTahunan extends Component { ...@@ -767,9 +767,9 @@ export default class BudgetTahunan extends Component {
}) })
} }
// if (array.includes("not-yet" || "draft")) { // if (array.includes("not-yet" || "draft")) {
// console.log('gagal'); // // console.log('gagal');
// } else { // } else {
// console.log('masuk'); // // console.log('masuk');
// } // }
} }
...@@ -783,7 +783,7 @@ export default class BudgetTahunan extends Component { ...@@ -783,7 +783,7 @@ export default class BudgetTahunan extends Component {
remarksKosong += 1 remarksKosong += 1
} }
}) })
console.log(arrayRevisi) // console.log(arrayRevisi)
if (arrayRevisi.length == 0 || remarksKosong > 0) { if (arrayRevisi.length == 0 || remarksKosong > 0) {
this.setState({ alert: true, messageAlert: 'Remarks Cannot be Empty', tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: 'Remarks Cannot be Empty', tipeAlert: 'error' })
} else { } else {
...@@ -814,7 +814,7 @@ export default class BudgetTahunan extends Component { ...@@ -814,7 +814,7 @@ export default class BudgetTahunan extends Component {
<Select <Select
value={val} value={val}
onChange={event => { onChange={event => {
// console.log(event.target) // // console.log(event.target)
updateValue(event.target.value) updateValue(event.target.value)
this.handleChange(event.target.value, tableMeta) this.handleChange(event.target.value, tableMeta)
}} }}
...@@ -942,10 +942,10 @@ export default class BudgetTahunan extends Component { ...@@ -942,10 +942,10 @@ export default class BudgetTahunan extends Component {
defaultValue={value} defaultValue={value}
color={"#5198ea"} color={"#5198ea"}
onBlur={(event) => { onBlur={(event) => {
// console.log(event.target.value) // // console.log(event.target.value)
// updateValue(event.target.value) // updateValue(event.target.value)
handleChangeText(event.target.value, tableMeta) handleChangeText(event.target.value, tableMeta)
// console.log(dataTable2) // // console.log(dataTable2)
}} }}
/>} />}
/> />
...@@ -983,7 +983,7 @@ export default class BudgetTahunan extends Component { ...@@ -983,7 +983,7 @@ export default class BudgetTahunan extends Component {
detailRevisiCheck.splice(indexId, 1) detailRevisiCheck.splice(indexId, 1)
} }
this.setState({ detailRevisiCheck }) this.setState({ detailRevisiCheck })
// console.log(detailRevisiCheck) // // console.log(detailRevisiCheck)
} }
const options = { const options = {
......
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