Commit 8d4d3d4e authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'rifka' into 'master'

add email column in upload preview apprv

See merge request !257
parents 4a5b3424 1d481be1
...@@ -55,7 +55,7 @@ export default class ApprovalMatrix extends Component { ...@@ -55,7 +55,7 @@ export default class ApprovalMatrix 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);
} }
...@@ -63,12 +63,14 @@ export default class ApprovalMatrix extends Component { ...@@ -63,12 +63,14 @@ export default class ApprovalMatrix extends Component {
let isi = resp.rows.slice(3) let isi = resp.rows.slice(3)
let payload = [] let payload = []
isi.map((item, index) => { isi.map((item, index) => {
console.log(item)
if (item.length > 0) { if (item.length > 0) {
payload.push({ payload.push({
id: index + 1, id: index + 1,
approval_type_name: item[0] === undefined ? "" : item[0], approval_type_name: item[0] === undefined ? "" : item[0],
orders: item[1] === undefined ? "" : item[1], orders: item[1] === undefined ? "" : item[1],
fullname: item[2] === undefined ? "" : item[2], email: item[2] === undefined ? "" : item[2],
// fullname: item[2] === undefined ? "" : item[2],
operator_type_name: item[3] === undefined ? "" : item[3], operator_type_name: item[3] === undefined ? "" : item[3],
start_date: item[4] === undefined ? "" : item[4], start_date: item[4] === undefined ? "" : item[4],
end_date: item[5] === undefined ? "" : item[5], end_date: item[5] === undefined ? "" : item[5],
...@@ -95,6 +97,7 @@ export default class ApprovalMatrix extends Component { ...@@ -95,6 +97,7 @@ export default class ApprovalMatrix extends Component {
return [ return [
item.approval_type_name, item.approval_type_name,
item.orders, item.orders,
item.email,
item.fullname, item.fullname,
item.operator_type_name, item.operator_type_name,
item.start_date, item.start_date,
...@@ -108,16 +111,16 @@ export default class ApprovalMatrix extends Component { ...@@ -108,16 +111,16 @@ export default class ApprovalMatrix extends Component {
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[6] != null) { if (tableMeta.rowData[7] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('approval_type_name')) check = tableMeta.rowData[7].findIndex((val) => val.field.includes('approval_type_name'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
} }
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[6] != null && check > -1 ? {tableMeta.rowData[7] != null && check > -1 ?
<a data-tip={tableMeta.rowData[6][check].message} data-for="approvaltype"> <a data-tip={tableMeta.rowData[7][check].message} data-for="approvaltype">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
...@@ -133,16 +136,16 @@ export default class ApprovalMatrix extends Component { ...@@ -133,16 +136,16 @@ export default class ApprovalMatrix extends Component {
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[6] != null) { if (tableMeta.rowData[7] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('orders')) check = tableMeta.rowData[7].findIndex((val) => val.field.includes('orders'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
} }
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[6] != null && check > -1 ? {tableMeta.rowData[7] != null && check > -1 ?
<a data-tip={tableMeta.rowData[6][check].message} data-for="order"> <a data-tip={tableMeta.rowData[7][check].message} data-for="order">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
...@@ -153,21 +156,46 @@ export default class ApprovalMatrix extends Component { ...@@ -153,21 +156,46 @@ export default class ApprovalMatrix extends Component {
} }
} }
}, },
{
name: "Approver Email",
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[7] != null) {
check = tableMeta.rowData[7].findIndex((val) => val.field.includes('email'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[7] != null && check > -1 ?
<a data-tip={tableMeta.rowData[7][check].message} data-for="email">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
}
<ReactTooltip border={true} id="email" place="bottom" type="light" effect="solid" />
</div >
);
}
}
},
{ {
name: "Approver Name", name: "Approver Name",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[6] != null) { if (tableMeta.rowData[7] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('fullname')) check = tableMeta.rowData[7].findIndex((val) => val.field.includes('fullname'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
} }
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[6] != null && check > -1 ? {tableMeta.rowData[7] != null && check > -1 ?
<a data-tip={tableMeta.rowData[6][check].message} data-for="fullname"> <a data-tip={tableMeta.rowData[7][check].message} data-for="fullname">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
...@@ -183,16 +211,16 @@ export default class ApprovalMatrix extends Component { ...@@ -183,16 +211,16 @@ export default class ApprovalMatrix extends Component {
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[6] != null) { if (tableMeta.rowData[7] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('operator_type_name')) check = tableMeta.rowData[7].findIndex((val) => val.field.includes('operator_type_name'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
} }
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[6] != null && check > -1 ? {tableMeta.rowData[7] != null && check > -1 ?
<a data-tip={tableMeta.rowData[6][check].message} data-for="operatorname"> <a data-tip={tableMeta.rowData[7][check].message} data-for="operatorname">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
...@@ -208,16 +236,16 @@ export default class ApprovalMatrix extends Component { ...@@ -208,16 +236,16 @@ export default class ApprovalMatrix extends Component {
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[6] != null) { if (tableMeta.rowData[7] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('start_date')) check = tableMeta.rowData[7].findIndex((val) => val.field.includes('start_date'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
} }
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[6] != null && check > -1 ? {tableMeta.rowData[7] != null && check > -1 ?
<a data-tip={tableMeta.rowData[6][check].message} data-for="startdate"> <a data-tip={tableMeta.rowData[7][check].message} data-for="startdate">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
...@@ -233,16 +261,16 @@ export default class ApprovalMatrix extends Component { ...@@ -233,16 +261,16 @@ export default class ApprovalMatrix extends Component {
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[6] != null) { if (tableMeta.rowData[7] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('end_date')) check = tableMeta.rowData[7].findIndex((val) => val.field.includes('end_date'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
} }
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[6] != null && check > -1 ? {tableMeta.rowData[7] != null && check > -1 ?
<a data-tip={tableMeta.rowData[6][check].message} data-for="enddate"> <a data-tip={tableMeta.rowData[7][check].message} data-for="enddate">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
...@@ -580,6 +608,7 @@ export default class ApprovalMatrix extends Component { ...@@ -580,6 +608,7 @@ export default class ApprovalMatrix extends Component {
filter: false, filter: false,
sort: false, sort: false,
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
console.log(tableMeta)
return ( return (
this.state.btnedit && ( this.state.btnedit && (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
......
...@@ -612,7 +612,11 @@ export default class BudgetTahunan extends Component { ...@@ -612,7 +612,11 @@ export default class BudgetTahunan extends Component {
{this.state.visibleTP && ( {this.state.visibleTP && (
<TaxPlanning <TaxPlanning
report_id={this.state.report_id} report_id={this.state.report_id}
height={this.props.height}
width={this.props.width}
company={this.state.company} company={this.state.company}
revision={this.state.revisionTable}
periode={this.state.periode.periode}
onClickClose={() => this.setState({ visibleTP: false, visibleBudgetTahunan: true })} onClickClose={() => this.setState({ visibleTP: false, visibleBudgetTahunan: true })}
/> />
)} )}
......
...@@ -15,7 +15,7 @@ import { ExcelRenderer } from 'react-excel-renderer'; ...@@ -15,7 +15,7 @@ import { ExcelRenderer } from 'react-excel-renderer';
import ReactTooltip from "react-tooltip"; import ReactTooltip from "react-tooltip";
import PopUpFailedSave from "../../library/PopUpFailedSave"; import PopUpFailedSave from "../../library/PopUpFailedSave";
import Constant from "../../library/Constant"; import Constant from "../../library/Constant";
import PopUpDelete from "../ApprovalMatrix/PopUpDelete"; import PopUpDelete from "../ApprovalMatrix/PopUpDeleteAM";
var ct = require("../../library/CustomTable"); var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable()); const getMuiTheme = () => createMuiTheme(ct.customTable());
......
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