Commit 8f7847d3 authored by Riri Novita's avatar Riri Novita

push notif

parent c1892a84
...@@ -493,6 +493,9 @@ const create = (type = "") => { ...@@ -493,6 +493,9 @@ const create = (type = "") => {
const createMaintenanceMode = (body) => api.post('maintenance/mode/create_maintenance_mode', body) const createMaintenanceMode = (body) => api.post('maintenance/mode/create_maintenance_mode', body)
const updateMaintenanceMode = (body) => api.post('maintenance/mode/update_maintenance_mode', body) const updateMaintenanceMode = (body) => api.post('maintenance/mode/update_maintenance_mode', body)
// Reminder Manual
const sendEmail = (body) => api.post('transaction/monitoring/reminder_progress_report', body)
// Superadmin Approve // Superadmin Approve
const getListApprover = (report, monthlyReportId) => api.get(`transaction/${report}/get_approver/${monthlyReportId}`) const getListApprover = (report, monthlyReportId) => api.get(`transaction/${report}/get_approver/${monthlyReportId}`)
const getIdToken = (userId) => api.get(`transaction/get_token/${userId}`) const getIdToken = (userId) => api.get(`transaction/get_token/${userId}`)
......
...@@ -201,7 +201,7 @@ class ReportProgress extends Component { ...@@ -201,7 +201,7 @@ class ReportProgress extends Component {
// report // report
// ]) // ])
// }) // })
console.log(dataTable) // console.log(dataTable)
this.setState({dataTable, loading: false}) this.setState({dataTable, loading: false})
} 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 }, () => {
...@@ -560,8 +560,10 @@ class ReportProgress extends Component { ...@@ -560,8 +560,10 @@ class ReportProgress extends Component {
// dataTable={this.state.dataTable} // dataTable={this.state.dataTable}
periode={this.state.periode ? this.state.periode.periode : null} periode={this.state.periode ? this.state.periode.periode : null}
quarter={this.state.quarter.name} quarter={this.state.quarter.name}
month={this.state.month.month_id}
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}
/> />
)} )}
</div> </div>
......
import React, { Component } from "react"; import React, { Component } from "react";
import { createMuiTheme, FormControlLabel, Input, MuiThemeProvider, TableCell, Typography } from "@material-ui/core"; import { createMuiTheme, FormControlLabel, Input, MuiThemeProvider, TableCell, Typography } from "@material-ui/core";
import MUIDataTable from "mui-datatables"; import MUIDataTable from "mui-datatables";
import api from '../../api';
import Constant from '../../library/Constant';
var ct = require("../../library/CustomTable"); var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable4()); const getMuiTheme = () => createMuiTheme(ct.customTable4());
...@@ -26,7 +29,46 @@ export default class TableProgressReport extends Component { ...@@ -26,7 +29,46 @@ export default class TableProgressReport extends Component {
} }
} }
handleSendEmail(idCompany) {
// console.log(this.props);
let data = this.props
let q1 = data.reportType === 2 && data.quarter === "Q1"
let q2 = data.reportType === 2 && data.quarter === "Q2"
let q3 = data.reportType === 2 && data.quarter === "Q3"
console.log(q1);
let payload = {
"company_id": idCompany,
"setting_type_name": data.reportType === 0 ? "master_budget" : data.reportType === 1 ? "monthly_report" : q1 ? "outlook_q1" : q2 ? "outlook_q2" : q3 ? "outlook_q3" : data.reportType === 3 ? "outlook_pa" : null,
"year": data.year,
"month": data.reportType === 1 ? data.month : null
}
// api.create().sendEmail(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") || response.data.message.includes("Token Expired")) {
// 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' })
// }
// })
}
render() { render() {
let dataTable2 = this.props.dataTable; let dataTable2 = this.props.dataTable;
// console.log(this.props); // console.log(this.props);
const handleValue = (tableMeta, itemName) => { const handleValue = (tableMeta, itemName) => {
...@@ -142,7 +184,7 @@ export default class TableProgressReport extends Component { ...@@ -142,7 +184,7 @@ export default class TableProgressReport extends Component {
<button <button
type="button" type="button"
style={{ background: 'white' }} style={{ background: 'white' }}
onClick={() => alert(tableMeta.rowData[5])} onClick={() => this.handleSendEmail(tableMeta.rowData[5])}
> >
<div style={{ width: 85, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}> <div style={{ width: 85, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#fff', fontSize: 11 }}>{tableMeta.rowData[3] === null || tableMeta.rowData[3] === 0 ? "Send Email" : "Sent"}</span> <span style={{ color: '#fff', fontSize: 11 }}>{tableMeta.rowData[3] === null || tableMeta.rowData[3] === 0 ? "Send Email" : "Sent"}</span>
...@@ -300,7 +342,7 @@ export default class TableProgressReport extends Component { ...@@ -300,7 +342,7 @@ export default class TableProgressReport extends Component {
<button <button
type="button" type="button"
style={{ background: 'white' }} style={{ background: 'white' }}
onClick={() => alert(tableMeta.rowData[5])} onClick={() => this.handleSendEmail(tableMeta.rowData[5])}
> >
<div style={{ width: 85, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}> <div style={{ width: 85, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#fff', fontSize: 11 }}>{tableMeta.rowData[3] === null || tableMeta.rowData[3] === 0 ? "Send Email" : "Sent"}</span> <span style={{ color: '#fff', fontSize: 11 }}>{tableMeta.rowData[3] === null || tableMeta.rowData[3] === 0 ? "Send Email" : "Sent"}</span>
...@@ -442,7 +484,7 @@ export default class TableProgressReport extends Component { ...@@ -442,7 +484,7 @@ export default class TableProgressReport extends Component {
<button <button
type="button" type="button"
style={{ background: 'white' }} style={{ background: 'white' }}
onClick={() => alert(tableMeta.rowData[5])} onClick={() => this.handleSendEmail(tableMeta.rowData[5])}
> >
<div style={{ width: 85, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}> <div style={{ width: 85, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#fff', fontSize: 11 }}>{tableMeta.rowData[3] === null || tableMeta.rowData[3] === 0 ? "Send Email" : "Sent"}</span> <span style={{ color: '#fff', fontSize: 11 }}>{tableMeta.rowData[3] === null || tableMeta.rowData[3] === 0 ? "Send Email" : "Sent"}</span>
...@@ -584,7 +626,7 @@ export default class TableProgressReport extends Component { ...@@ -584,7 +626,7 @@ export default class TableProgressReport extends Component {
<button <button
type="button" type="button"
style={{ background: 'white' }} style={{ background: 'white' }}
onClick={() => alert(tableMeta.rowData[5])} onClick={() => this.handleSendEmail(tableMeta.rowData[5])}
> >
<div style={{ width: 85, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}> <div style={{ width: 85, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#fff', fontSize: 11 }}>{tableMeta.rowData[3] === null || tableMeta.rowData[3] === 0 ? "Send Email" : "Sent"}</span> <span style={{ color: '#fff', fontSize: 11 }}>{tableMeta.rowData[3] === null || tableMeta.rowData[3] === 0 ? "Send Email" : "Sent"}</span>
......
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