Commit a6b340bf authored by Riri Novita's avatar Riri Novita

Merge branch 'dev/riri' into 'ENV-DEV'

Reminder Cuti

See merge request !1742
parents aa7168d4 7786dbeb
...@@ -570,6 +570,10 @@ class ReportProgress extends Component { ...@@ -570,6 +570,10 @@ class ReportProgress extends Component {
company={this.state.company} company={this.state.company}
typeReport={String(this.state.reportType.name).toLocaleUpperCase()} typeReport={String(this.state.reportType.name).toLocaleUpperCase()}
year={this.state.periodeMB.value} year={this.state.periodeMB.value}
getMonitoringMB={this.getMonitoringMB.bind(this)}
getMonitoringMR={this.getMonitoringMR.bind(this)}
getMonitoringRO={this.getMonitoringRO.bind(this)}
getMonitoringOLPA={this.getMonitoringOLPA.bind(this)}
/> />
)} )}
</div> </div>
......
...@@ -41,6 +41,7 @@ export default class TableProgressReport extends Component { ...@@ -41,6 +41,7 @@ export default class TableProgressReport extends Component {
} }
handleShowPopup(id, data) { handleShowPopup(id, data) {
console.log(this.props);
let item = this.props let item = this.props
let bulan = item.month == 1 ? "Jan" : item.month == 2 ? "Feb" : item.month == 3 ? "Mar" : item.month == 4 ? "Apr" : item.month == 5 ? "May" : item.month == 6 ? "Jun" : item.month == 7 ? "Jul" : item.month == 8 ? "Aug" : item.month == 9 ? "Sep" : item.month == 10 ? "Oct" : item.month == 11 ? "Nov" : item.month == 12 ? "Dec" : null let bulan = item.month == 1 ? "Jan" : item.month == 2 ? "Feb" : item.month == 3 ? "Mar" : item.month == 4 ? "Apr" : item.month == 5 ? "May" : item.month == 6 ? "Jun" : item.month == 7 ? "Jul" : item.month == 8 ? "Aug" : item.month == 9 ? "Sep" : item.month == 10 ? "Oct" : item.month == 11 ? "Nov" : item.month == 12 ? "Dec" : null
this.setState({ visiblePopup: true, idCompany: id, companyName: data[0], month: bulan }) this.setState({ visiblePopup: true, idCompany: id, companyName: data[0], month: bulan })
...@@ -58,17 +59,46 @@ export default class TableProgressReport extends Component { ...@@ -58,17 +59,46 @@ export default class TableProgressReport extends Component {
"year": data.year, "year": data.year,
"month": data.reportType === 1 ? data.month : null "month": data.reportType === 1 ? data.month : null
} }
console.log(payload); let payloadGetData = {
"year": data.year,
"month": data.month,
"quarter": data.quarter === "Q1" ? "q1" : data.quarter === "Q2" ? "q2" : data.quarter === "Q3" ? "q3" : null
}
console.log(payloadGetData);
api.create().sendEmail(payload).then(response => { api.create().sendEmail(payload).then(response => {
console.log(response); console.log(response);
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
this.setState({ loading: false }) this.setState({ loading: false })
if (response.data.status == 'success') { if (response.data.status == 'success') {
this.setState({ loading: false, visiblePopup: false, alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) if (data.reportType === 0) {
this.props.getMonitoringMB(payloadGetData)
} else if (data.reportType === 1) {
this.props.getMonitoringMR(payloadGetData)
} else if (data.reportType === 2) {
this.props.getMonitoringRO(payloadGetData)
} else if (data.reportType === 3) {
this.props.getMonitoringOLPA(payloadGetData)
}
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success', visiblePopup: false, loading: false })
// this.setState({ visiblePopup: false, alert: true, messageAlert: response.data.message, tipeAlert: 'success' }, () => {
// setTimeout(() => {
// if (data.reportType === 0 ) {
// this.props.getMonitoringMB(payloadGetData)
// } else if (data.reportType === 1 ) {
// this.props.getMonitoringMR(payloadGetData)
// } else if (data.reportType === 2 ) {
// this.props.getMonitoringRO(payloadGetData)
// } else if (data.reportType === 3 ) {
// this.props.getMonitoringOLPA(payloadGetData)
// }
// this.setState({ loading: false })
// }, 1000)
// })
// this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) // this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false}, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) { if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
...@@ -78,7 +108,7 @@ export default class TableProgressReport extends Component { ...@@ -78,7 +108,7 @@ export default class TableProgressReport extends Component {
}) })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false}) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
......
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