Commit 0835644c authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'didam' into 'master'

apdet

See merge request !456
parents 409a1d85 675a1ea3
...@@ -206,6 +206,7 @@ const create = (type = "") => { ...@@ -206,6 +206,7 @@ const create = (type = "") => {
const getCompanySubmitted = (body) => api.post('transaction/master_budget/get_company_submitted', body) const getCompanySubmitted = (body) => api.post('transaction/master_budget/get_company_submitted', body)
const getLastPeriod = (idCompany) => api.get(`transaction/master_budget/get_last_periode/${idCompany}`) const getLastPeriod = (idCompany) => api.get(`transaction/master_budget/get_last_periode/${idCompany}`)
const getSubmitMasterBudget = (body) => api.post('transaction/master_budget/get_latest_periode_submit', body) const getSubmitMasterBudget = (body) => api.post('transaction/master_budget/get_latest_periode_submit', body)
const createPeriodeRevision = (body) => api.post('transaction/master_budget/create_periode_revision', body)
const getIdDeleteFromExcel = (body) => api.post('transaction/master_budget/delete_from_excel', body) const getIdDeleteFromExcel = (body) => api.post('transaction/master_budget/delete_from_excel', body)
const getOpetratingIndID = (body) => api.post('transaction/get_operating_indicator_id', body) const getOpetratingIndID = (body) => api.post('transaction/get_operating_indicator_id', body)
...@@ -371,7 +372,8 @@ const create = (type = "") => { ...@@ -371,7 +372,8 @@ const create = (type = "") => {
approvalSubmission, approvalSubmission,
getCompanySubmitted, getCompanySubmitted,
getLastPeriod, getLastPeriod,
getSubmitMasterBudget getSubmitMasterBudget,
createPeriodeRevision
} }
} }
......
...@@ -18,6 +18,7 @@ import Constant from '../library/Constant'; ...@@ -18,6 +18,7 @@ import Constant from '../library/Constant';
import PropagateLoader from "react-spinners/PropagateLoader" import PropagateLoader from "react-spinners/PropagateLoader"
import CashFlow from './BudgetTahunan/CashFlow'; import CashFlow from './BudgetTahunan/CashFlow';
import { DatePicker } from '@material-ui/pickers'; import { DatePicker } from '@material-ui/pickers';
import moment from 'moment';
var ct = require("../library/CustomTable"); var ct = require("../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable()); const getMuiTheme = () => createMuiTheme(ct.customTable());
...@@ -62,7 +63,9 @@ export default class BudgetTahunan extends Component { ...@@ -62,7 +63,9 @@ export default class BudgetTahunan extends Component {
lastRevision: "", lastRevision: "",
checkApprover: false, checkApprover: false,
lastPeriod: '', lastPeriod: '',
latestPeriode: '' latestPeriode: '',
minDateRevision: new Date(),
maxDateRevision: new Date()
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -423,11 +426,20 @@ export default class BudgetTahunan extends Component { ...@@ -423,11 +426,20 @@ export default class BudgetTahunan extends Component {
"status": type, "status": type,
"detail": this.state.detailRevisiCheck "detail": this.state.detailRevisiCheck
} }
let payload = {
"company_id": this.state.company.company_id,
"min_periode": moment(this.state.minDateRevision).format('YYYY-MM-DD'),
"max_periode": moment(this.state.maxDateRevision).format('YYYY-MM-DD')
}
console.log(payload)
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 }, () => {
this.getSubmission() this.getSubmission()
}) })
if (type == 'revision') {
api.create().createPeriodeRevision(payload).then((res) => console.log(res))
}
}) })
} }
...@@ -641,6 +653,21 @@ export default class BudgetTahunan extends Component { ...@@ -641,6 +653,21 @@ export default class BudgetTahunan extends Component {
} }
validateRevision() {
let arrayRevisi = this.state.detailRevisiCheck
let remarksKosong = 0
arrayRevisi.map((item,index) => {
if (item.remarks == "") {
remarksKosong += 1
}
})
if (remarksKosong > 0) {
this.setState({ alert: true, messageAlert: 'Remarks Cannot be Empty', tipeAlert: 'error' })
} else {
this.setState({ visibleRevision: false }, () => this.approvalSubmission('revision'))
}
}
render() { render() {
const columns = ["#", "Report Type", const columns = ["#", "Report Type",
{ {
...@@ -712,21 +739,20 @@ export default class BudgetTahunan extends Component { ...@@ -712,21 +739,20 @@ export default class BudgetTahunan extends Component {
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.isSubmit === false ? 'default' : tableMeta.rowData[5] ? 'pointer' : 'default', cursor: tableMeta.rowData[5] ? 'pointer' : 'default',
borderColor: 'transparent' borderColor: 'transparent'
}} }}
onClick={() => onClick={() =>
this.state.isSubmit === false ? null : // tableMeta.rowData[5] == true ?
// tableMeta.rowData[5] == true ? this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4], tableMeta.rowData[2], tableMeta.rowData[3])
this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4], tableMeta.rowData[2], tableMeta.rowData[3]) // : null
// : null
} }
> >
{/* {this.state.isApprover == true ? {/* {this.state.isApprover == true ?
(tableMeta.rowData[5] ? '#5198ea' : 'GrayText') : (tableMeta.rowData[5] ? '#5198ea' : 'GrayText') :
(this.state.lastRevision == 0 ? (tableMeta.rowData[5] ? '#5198ea' : 'GrayText') : (this.state.lastRevision == 0 ? (tableMeta.rowData[5] ? '#5198ea' : 'GrayText') :
(tableMeta.rowData[3] !== 'submitted' ? '#5198ea' : 'GrayText'))} */} (tableMeta.rowData[3] !== 'submitted' ? '#5198ea' : 'GrayText'))} */}
<Typography style={{ color: this.state.isSubmit === false ? 'GrayText' : tableMeta.rowData[5] ? '#5198ea' : 'GrayText', fontSize: 12, }}>Detail</Typography> <Typography style={{ color: tableMeta.rowData[5] ? '#5198ea' : 'GrayText', fontSize: 12, }}>Detail</Typography>
</button> </button>
</div > </div >
); );
...@@ -1196,7 +1222,7 @@ export default class BudgetTahunan extends Component { ...@@ -1196,7 +1222,7 @@ export default class BudgetTahunan extends Component {
getReport={this.getSubmission.bind(this)} getReport={this.getSubmission.bind(this)}
isApprover={this.state.isApprover} isApprover={this.state.isApprover}
lastStatus={this.state.lastStatus} lastStatus={this.state.lastStatus}
prevRevision={this.state.prevRevision} prevRevision={this.state.isSubmit? this.state.prevRevision : true}
status={this.state.status} status={this.state.status}
/> />
)} )}
...@@ -1216,9 +1242,8 @@ export default class BudgetTahunan extends Component { ...@@ -1216,9 +1242,8 @@ export default class BudgetTahunan extends Component {
status={this.state.status} status={this.state.status}
isApprover={this.state.isApprover} isApprover={this.state.isApprover}
lastStatus={this.state.lastStatus} lastStatus={this.state.lastStatus}
prevRevision={this.state.prevRevision} prevRevision={this.state.isSubmit? this.state.prevRevision : true}
/> />
)} )}
{this.state.visibleTP && ( {this.state.visibleTP && (
<TaxPlanning <TaxPlanning
...@@ -1236,7 +1261,7 @@ export default class BudgetTahunan extends Component { ...@@ -1236,7 +1261,7 @@ export default class BudgetTahunan extends Component {
status={this.state.status} status={this.state.status}
isApprover={this.state.isApprover} isApprover={this.state.isApprover}
lastStatus={this.state.lastStatus} lastStatus={this.state.lastStatus}
prevRevision={this.state.prevRevision} prevRevision={this.state.isSubmit? this.state.prevRevision : true}
/> />
)} )}
{this.state.visibleFAM && ( {this.state.visibleFAM && (
...@@ -1255,7 +1280,7 @@ export default class BudgetTahunan extends Component { ...@@ -1255,7 +1280,7 @@ export default class BudgetTahunan extends Component {
status={this.state.status} status={this.state.status}
isApprover={this.state.isApprover} isApprover={this.state.isApprover}
lastStatus={this.state.lastStatus} lastStatus={this.state.lastStatus}
prevRevision={this.state.prevRevision} prevRevision={this.state.isSubmit? this.state.prevRevision : true}
/> />
)} )}
{this.state.visibleCAT && ( {this.state.visibleCAT && (
...@@ -1274,7 +1299,7 @@ export default class BudgetTahunan extends Component { ...@@ -1274,7 +1299,7 @@ export default class BudgetTahunan extends Component {
isApprover={this.state.isApprover} isApprover={this.state.isApprover}
status={this.state.status} status={this.state.status}
lastStatus={this.state.lastStatus} lastStatus={this.state.lastStatus}
prevRevision={this.state.prevRevision} prevRevision={this.state.isSubmit? this.state.prevRevision : true}
/> />
)} )}
{this.state.visibleCF && ( {this.state.visibleCF && (
...@@ -1290,7 +1315,7 @@ export default class BudgetTahunan extends Component { ...@@ -1290,7 +1315,7 @@ export default class BudgetTahunan extends Component {
saveToMasterBudget={this.saveToMasterBudget.bind(this)} saveToMasterBudget={this.saveToMasterBudget.bind(this)}
onClickClose={() => this.setState({ visibleCF: false, visibleBudgetTahunan: true })} onClickClose={() => this.setState({ visibleCF: false, visibleBudgetTahunan: true })}
getReport={this.getSubmission.bind(this)} getReport={this.getSubmission.bind(this)}
prevRevision={this.state.prevRevision} prevRevision={this.state.isSubmit? this.state.prevRevision : true}
/> />
)} )}
...@@ -1314,7 +1339,7 @@ export default class BudgetTahunan extends Component { ...@@ -1314,7 +1339,7 @@ export default class BudgetTahunan extends Component {
</div> </div>
</div> </div>
<div className="border-bottom" style={{ padding: 20 }}> <div className="border-bottom" style={{ padding: 20 }}>
<span>Anda meminta anak perusahaan untuk melakukan revisi.</span> <span>You ask your subsidiary to make a revision</span>
<div style={{ marginTop: 20 }}> <div style={{ marginTop: 20 }}>
<MuiThemeProvider theme={getMuiTheme()}> <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
...@@ -1325,7 +1350,7 @@ export default class BudgetTahunan extends Component { ...@@ -1325,7 +1350,7 @@ export default class BudgetTahunan extends Component {
</MuiThemeProvider> </MuiThemeProvider>
</div> </div>
<div style={{ marginTop: 20 }}> <div style={{ marginTop: 20 }}>
<span>Durasi waktu yang anda berikan untuk revisi: </span> <span>Timing duration you give for revision:</span>
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: 20 }}> <div style={{ display: 'flex', justifyContent: 'space-between', marginTop: 20 }}>
<div> <div>
<DatePicker <DatePicker
...@@ -1333,7 +1358,8 @@ export default class BudgetTahunan extends Component { ...@@ -1333,7 +1358,8 @@ export default class BudgetTahunan extends Component {
id="startDate" id="startDate"
label="Valid From" label="Valid From"
format="dd-MM-yyyy" format="dd-MM-yyyy"
onChange={(e) => null} onChange={(e) => this.setState({minDateRevision: moment(e).format('YYYY/MM/DD')})}
value={moment(this.state.minDateRevision).format('YYYY/MM/DD')}
KeyboardButtonProps={{ KeyboardButtonProps={{
'aria-label': 'change date', 'aria-label': 'change date',
}} }}
...@@ -1352,14 +1378,16 @@ export default class BudgetTahunan extends Component { ...@@ -1352,14 +1378,16 @@ export default class BudgetTahunan extends Component {
style={{ padding: 0, margin: 0, width: '100%' }} style={{ padding: 0, margin: 0, width: '100%' }}
/> />
</div> </div>
<span style={{ alignSelf: 'center' }}>Sampai dengan</span> <span style={{ alignSelf: 'center' }}>Until</span>
<div> <div>
<DatePicker <DatePicker
margin="normal" margin="normal"
id="startDate" id="startDate"
label="Valid To" label="Valid To"
format="dd-MM-yyyy" format="dd-MM-yyyy"
onChange={(e) => null} onChange={(e) => this.setState({maxDateRevision: moment(e).format('YYYY/MM/DD')})}
minDate={moment(this.state.minDateRevision).format('YYYY/MM/DD')}
value={moment(this.state.maxDateRevision).format('YYYY/MM/DD')}
KeyboardButtonProps={{ KeyboardButtonProps={{
'aria-label': 'change date', 'aria-label': 'change date',
}} }}
...@@ -1395,7 +1423,7 @@ export default class BudgetTahunan extends Component { ...@@ -1395,7 +1423,7 @@ export default class BudgetTahunan extends Component {
<div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}> <div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
<button <button
type="button" type="button"
onClick={() => this.setState({ visibleRevision: false }, () => this.approvalSubmission('revision'))} onClick={() => this.validateRevision()}
> >
<div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}> <div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#fff', fontSize: 11 }}>Revision</span> <span style={{ color: '#fff', fontSize: 11 }}>Revision</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