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 = "") => {
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 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 getOpetratingIndID = (body) => api.post('transaction/get_operating_indicator_id', body)
......@@ -371,7 +372,8 @@ const create = (type = "") => {
approvalSubmission,
getCompanySubmitted,
getLastPeriod,
getSubmitMasterBudget
getSubmitMasterBudget,
createPeriodeRevision
}
}
......
......@@ -18,6 +18,7 @@ import Constant from '../library/Constant';
import PropagateLoader from "react-spinners/PropagateLoader"
import CashFlow from './BudgetTahunan/CashFlow';
import { DatePicker } from '@material-ui/pickers';
import moment from 'moment';
var ct = require("../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable());
......@@ -62,7 +63,9 @@ export default class BudgetTahunan extends Component {
lastRevision: "",
checkApprover: false,
lastPeriod: '',
latestPeriode: ''
latestPeriode: '',
minDateRevision: new Date(),
maxDateRevision: new Date()
}
this.fileHandler = this.fileHandler.bind(this);
}
......@@ -423,11 +426,20 @@ export default class BudgetTahunan extends Component {
"status": type,
"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) => {
console.log(res)
this.setState({ loading: false }, () => {
this.getSubmission()
})
if (type == 'revision') {
api.create().createPeriodeRevision(payload).then((res) => console.log(res))
}
})
}
......@@ -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() {
const columns = ["#", "Report Type",
{
......@@ -712,21 +739,20 @@ export default class BudgetTahunan extends Component {
<button
style={{
backgroundColor: 'transparent',
cursor: this.state.isSubmit === false ? 'default' : tableMeta.rowData[5] ? 'pointer' : 'default',
cursor: tableMeta.rowData[5] ? 'pointer' : 'default',
borderColor: 'transparent'
}}
onClick={() =>
this.state.isSubmit === false ? null :
// tableMeta.rowData[5] == true ?
this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4], tableMeta.rowData[2], tableMeta.rowData[3])
// : null
// tableMeta.rowData[5] == true ?
this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4], tableMeta.rowData[2], tableMeta.rowData[3])
// : null
}
>
{/* {this.state.isApprover == true ?
(tableMeta.rowData[5] ? '#5198ea' : 'GrayText') :
(this.state.lastRevision == 0 ? (tableMeta.rowData[5] ? '#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>
</div >
);
......@@ -1196,7 +1222,7 @@ export default class BudgetTahunan extends Component {
getReport={this.getSubmission.bind(this)}
isApprover={this.state.isApprover}
lastStatus={this.state.lastStatus}
prevRevision={this.state.prevRevision}
prevRevision={this.state.isSubmit? this.state.prevRevision : true}
status={this.state.status}
/>
)}
......@@ -1216,9 +1242,8 @@ export default class BudgetTahunan extends Component {
status={this.state.status}
isApprover={this.state.isApprover}
lastStatus={this.state.lastStatus}
prevRevision={this.state.prevRevision}
prevRevision={this.state.isSubmit? this.state.prevRevision : true}
/>
)}
{this.state.visibleTP && (
<TaxPlanning
......@@ -1236,7 +1261,7 @@ export default class BudgetTahunan extends Component {
status={this.state.status}
isApprover={this.state.isApprover}
lastStatus={this.state.lastStatus}
prevRevision={this.state.prevRevision}
prevRevision={this.state.isSubmit? this.state.prevRevision : true}
/>
)}
{this.state.visibleFAM && (
......@@ -1255,7 +1280,7 @@ export default class BudgetTahunan extends Component {
status={this.state.status}
isApprover={this.state.isApprover}
lastStatus={this.state.lastStatus}
prevRevision={this.state.prevRevision}
prevRevision={this.state.isSubmit? this.state.prevRevision : true}
/>
)}
{this.state.visibleCAT && (
......@@ -1274,7 +1299,7 @@ export default class BudgetTahunan extends Component {
isApprover={this.state.isApprover}
status={this.state.status}
lastStatus={this.state.lastStatus}
prevRevision={this.state.prevRevision}
prevRevision={this.state.isSubmit? this.state.prevRevision : true}
/>
)}
{this.state.visibleCF && (
......@@ -1290,7 +1315,7 @@ export default class BudgetTahunan extends Component {
saveToMasterBudget={this.saveToMasterBudget.bind(this)}
onClickClose={() => this.setState({ visibleCF: false, visibleBudgetTahunan: true })}
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 {
</div>
</div>
<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 }}>
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
......@@ -1325,7 +1350,7 @@ export default class BudgetTahunan extends Component {
</MuiThemeProvider>
</div>
<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>
<DatePicker
......@@ -1333,7 +1358,8 @@ export default class BudgetTahunan extends Component {
id="startDate"
label="Valid From"
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={{
'aria-label': 'change date',
}}
......@@ -1352,14 +1378,16 @@ export default class BudgetTahunan extends Component {
style={{ padding: 0, margin: 0, width: '100%' }}
/>
</div>
<span style={{ alignSelf: 'center' }}>Sampai dengan</span>
<span style={{ alignSelf: 'center' }}>Until</span>
<div>
<DatePicker
margin="normal"
id="startDate"
label="Valid To"
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={{
'aria-label': 'change date',
}}
......@@ -1395,7 +1423,7 @@ export default class BudgetTahunan extends Component {
<div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
<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' }}>
<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